Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pdDiag() has errors #14

Closed
mattfidler opened this issue Dec 13, 2022 · 4 comments
Closed

pdDiag() has errors #14

mattfidler opened this issue Dec 13, 2022 · 4 comments

Comments

@mattfidler
Copy link
Member

From here:

nlmixrdevelopment/nlmixr#580 (comment)

lotri::lotri({
    temax <- -9.91
    ted50 <- 11.9
    eta.emax ~ pdDiag(2.9)
    add.err <-12.7
})
#> �[1mlotri syntax error:
#> ================================================================================�[0m
#> �[1m:001�[0m: temax <- -9.91
#> �[1m:002�[0m: ted50 <- 11.9
#> lotri error:
#>    bad matrix expression: 'eta.emax ~ pdDiag(2.9)'
#>      matrix expression should be 'name ~ c(lower-tri)'
#> �[1m:003�[0m: eta.emax ~ pdDiag(2.9)
#> �[1m:004�[0m: add.err <- 12.7
#> �[1m================================================================================�[0m
#> Error: lotri syntax errors above

Created on 2022-12-13 with reprex v2.0.2

from @hrishikesh1985

@mattfidler
Copy link
Member Author

Hi @hrishikesh1985,

This is because that pdDiag() does not produce a numeric value. That is what is required for this function. Perhaps a better error would be helpful here...

@mattfidler
Copy link
Member Author

This works though,

lotri::lotri({
    temax <- -9.91
    ted50 <- 11.9
    eta.emax ~ 7.389056
    add.err <-12.7
})
#> Lotri Estimates (get with `lotriEst()`):
#>      name lower   est upper   fix label backTransform
#> 1   temax  -Inf -9.91   Inf FALSE  <NA>          <NA>
#> 2   ted50  -Inf 11.90   Inf FALSE  <NA>          <NA>
#> 3 add.err  -Inf 12.70   Inf FALSE  <NA>          <NA>
#> 
#> Matrix:
#>          eta.emax
#> eta.emax 7.389056

Created on 2022-12-13 with reprex v2.0.2

Or if you still want a single element matrix, then:

library(nlme)
library(lotri)
#> Warning: package 'lotri' was built under R version 4.2.2
lotri::lotri({
    temax <- -9.91
    ted50 <- 11.9
    eta.emax ~ as.numeric(as.matrix(pdDiag(1)))
    add.err <-12.7
})
#> Lotri Estimates (get with `lotriEst()`):
#>      name lower   est upper   fix label backTransform
#> 1   temax  -Inf -9.91   Inf FALSE  <NA>          <NA>
#> 2   ted50  -Inf 11.90   Inf FALSE  <NA>          <NA>
#> 3 add.err  -Inf 12.70   Inf FALSE  <NA>          <NA>
#> 
#> Matrix:
#>          eta.emax
#> eta.emax 7.389056

Created on 2022-12-13 with reprex v2.0.2

@mattfidler
Copy link
Member Author

pdDiag() is not how matrices are specified in nlmixr2

@hrishikesh1985
Copy link

Hi Matthew,

as.numeric(as.matrix(pdDiag(1))) works !!!

Thanks for the quick support and response as ever...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants