Closed jranke closed 3 years ago
There seems to be 2 different types of additive + proportional error models defined:
combined1
s2(v) = t1^2 + t2^2*v^2
And
combined2
s2(v) = (t1 + abs(v)^t2)^2
You are saying the patch referred to above allows combined1
style of additive + proportional errors?
These naming conventions come from monolix:
In the next release you can switch between the two error models.
See https://github.com/nlmixrdevelopment/nlmixr/blob/foceiDur/NEWS.md
It would be great if we could switch in nlme
as well.
The nlme variance is defined here:
Your model above produces:
varConstPower(form=~fitted(.), fixed=list(power=1))
But in your comparison you use:
varConstProp()
I could add this when the error model is combined1; I believe the first is correct for combined2.
It seems that are two different schools of thoughts with combined1 and combined2. The next release defaults to combined2 which is more commonly used in NONMEM, but perhaps it should be a nlmixr
option you can choose at the beginning as well. If you are a fan of the combined1 approach, it would be a pain to always have to specify it instead of combined2
There seems to be 2 different types of additive + proportional error models defined:
combined1
s2(v) = t1^2 + t2^2*v^2
And
combined2
s2(v) = (t1 + abs(v)^t2)^2
You are saying the patch refered to above allows
combined1
style of additive + proportional errors? Yes, indeed.
Ok @jranke
Let me know when the patch is accepted. When it is, let me know the version of nlme
that is used so I an add combined1
as an option for nlme
.
Sorry, I was too quick. The nlme patch provides
s2(v) = t1^2 + t2^2*v^2
which is equivalent to combined2 in Monolix terms. Note that s2(v) is on a variance scale. See also my post to R-devel https://stat.ethz.ch/pipermail/r-devel/2020-October/080046.html and the references cited there. The patch is currently being reviewed by Martin Maechler - it would be great if it would make it into nlme - I will let you know!
So, misspoke:
combined1
s2(v) = (t1 + abs(v)^t2)^2
combined2
s2(v) = t1^2 + t2^2*v^2
It would good to have combined2 in nlmixr nlme, especially since it is the default for the other routines.
The patch to nlme was merged yesterday, yay! You can easily get it from their subversion repo if you have subversion installed:
svn co https://svn.r-project.org/R-packages/trunk/nlme
Great! I will look into using it for nlmixr too
Probably all you need to do is change varConstPow to varConstProp, fix sigma in the call to nlme ..., control = list(sigma = 1)
and initialise const with the additive error and prop with the proportional error.... good luck!
This has been integrated; Do you know when nlme
will be released (only with a new version of R)?
This has been integrated; Do you know when
nlme
will be released (only with a new version of R)?
Nice! nlme has its own release cycle, and has releases every couple of months, so it depends.
I think you need to check the formula in the news entry you wrote for this, as nlme::varConstProp()
does not include parameter c
in the error model
y = f + sqrt(a^2+b^2*f^(2c))*err
only the additive component a
and the proportionality constant b
.
Indeed you are right; I have an error issued if this occurs:
I was testing and noticed that b can be negative, I will adjust this to be positive just for consistency between the methods.
Note you can always get the underlying nlme by as.nlme
I misread your comment, I will adjust the news item.
Ah, I see, but your explanation was nevertheless helpful as I hadn't looked at the code!
Hi, just in case you did not notice, nlme version 3.1.151 containing varConstProp
has been published a couple of days ago.
Awesome!
We will be publishing soon too so it should work perfectly.
On Wed, Dec 16, 2020, 3:07 AM Johannes Ranke notifications@github.com wrote:
Hi, just in case you did not notice, nlme version 3.1.151 containing varConstProp has been published a couple of days ago.
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/nlmixrdevelopment/nlmixr/issues/428#issuecomment-745956215, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAD5VWQCWA7BEOPZOUNATNTSVB2DPANCNFSM4TD5SPXA .
nlme can now do this if you apply the patch at https://bugs.r-project.org/bugzilla/show_bug.cgi?id=17954
Created on 2020-10-29 by the reprex package (v0.3.0)
Session info
``` r devtools::session_info() #> ─ Session info ─────────────────────────────────────────────────────────────── #> setting value #> version R version 4.0.3 (2020-10-10) #> os Debian GNU/Linux 10 (buster) #> system x86_64, linux-gnu #> ui X11 #> language en #> collate de_DE.UTF-8 #> ctype de_DE.UTF-8 #> tz Europe/Berlin #> date 2020-10-29 #> #> ─ Packages ─────────────────────────────────────────────────────────────────── #> package * version date lib source #> assertthat 0.2.1 2019-03-21 [1] CRAN (R 4.0.0) #> backports 1.1.10 2020-09-15 [1] CRAN (R 4.0.2) #> brew 1.0-6 2011-04-13 [1] CRAN (R 4.0.0) #> callr 3.5.1 2020-10-13 [1] CRAN (R 4.0.3) #> cli 2.1.0 2020-10-12 [1] CRAN (R 4.0.3) #> colorspace 1.4-1 2019-03-18 [1] CRAN (R 4.0.0) #> crayon 1.3.4 2017-09-16 [1] CRAN (R 4.0.0) #> data.table 1.13.2 2020-10-19 [1] CRAN (R 4.0.3) #> desc 1.2.0 2018-05-01 [1] CRAN (R 4.0.0) #> devtools 2.3.2 2020-09-18 [1] CRAN (R 4.0.2) #> digest 0.6.27 2020-10-24 [1] CRAN (R 4.0.3) #> dparser 0.1.8 2017-11-13 [1] CRAN (R 4.0.0) #> dplyr 1.0.2 2020-08-18 [1] CRAN (R 4.0.2) #> ellipsis 0.3.1 2020-05-15 [1] CRAN (R 4.0.1) #> evaluate 0.14 2019-05-28 [1] CRAN (R 4.0.0) #> fansi 0.4.1 2020-01-08 [1] CRAN (R 4.0.0) #> fs 1.5.0 2020-07-31 [1] CRAN (R 4.0.2) #> generics 0.0.2 2018-11-29 [1] CRAN (R 4.0.0) #> ggplot2 3.3.2 2020-06-19 [1] CRAN (R 4.0.2) #> glue 1.4.2 2020-08-27 [1] CRAN (R 4.0.2) #> gtable 0.3.0 2019-03-25 [1] CRAN (R 4.0.0) #> highr 0.8 2019-03-20 [1] CRAN (R 4.0.0) #> htmltools 0.5.0 2020-06-16 [1] CRAN (R 4.0.2) #> jsonlite 1.7.1 2020-09-07 [1] CRAN (R 4.0.2) #> knitr 1.30 2020-09-22 [1] CRAN (R 4.0.2) #> lattice 0.20-41 2020-04-02 [1] CRAN (R 4.0.0) #> lazyeval 0.2.2 2019-03-15 [1] CRAN (R 4.0.0) #> lifecycle 0.2.0 2020-03-06 [1] CRAN (R 4.0.0) #> lotri 0.2.2 2020-05-29 [1] CRAN (R 4.0.2) #> magrittr 1.5 2014-11-22 [1] CRAN (R 4.0.0) #> Matrix 1.2-18 2019-11-27 [3] CRAN (R 4.0.3) #> memoise 1.1.0 2017-04-21 [1] CRAN (R 4.0.0) #> munsell 0.5.0 2018-06-12 [1] CRAN (R 4.0.0) #> mvnfast 0.2.5.1 2020-10-14 [1] CRAN (R 4.0.3) #> n1qn1 6.0.1-9 2020-07-02 [1] CRAN (R 4.0.2) #> nlme * 3.1-150.1 2020-10-29 [1] local #> nlmixr * 1.1.1-9 2020-10-29 [1] local #> pillar 1.4.6 2020-07-10 [1] CRAN (R 4.0.2) #> pkgbuild 1.1.0 2020-07-13 [1] CRAN (R 4.0.2) #> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.0.0) #> pkgload 1.1.0 2020-05-29 [1] CRAN (R 4.0.1) #> PreciseSums 0.4 2020-07-10 [1] CRAN (R 4.0.2) #> prettyunits 1.1.1 2020-01-24 [1] CRAN (R 4.0.0) #> processx 3.4.4 2020-09-03 [1] CRAN (R 4.0.2) #> ps 1.4.0 2020-10-07 [1] CRAN (R 4.0.2) #> purrr 0.3.4 2020-04-17 [1] CRAN (R 4.0.0) #> R6 2.5.0 2020-10-28 [1] CRAN (R 4.0.3) #> Rcpp 1.0.5 2020-07-06 [1] CRAN (R 4.0.2) #> RcppArmadillo 0.10.1.0.0 2020-10-20 [1] CRAN (R 4.0.3) #> remotes 2.2.0 2020-07-21 [1] CRAN (R 4.0.2) #> rex 1.2.0 2020-04-21 [1] CRAN (R 4.0.0) #> rlang 0.4.8 2020-10-08 [1] CRAN (R 4.0.3) #> rmarkdown 2.5 2020-10-21 [1] CRAN (R 4.0.3) #> rprojroot 1.3-2 2018-01-03 [1] CRAN (R 4.0.0) #> rstudioapi 0.11 2020-02-07 [1] CRAN (R 4.0.0) #> RxODE * 0.9.2-1 2020-10-15 [1] CRAN (R 4.0.3) #> scales 1.1.1 2020-05-11 [1] CRAN (R 4.0.2) #> sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 4.0.0) #> SnakeCharmR 1.0.8 2020-05-04 [1] Github (asieira/SnakeCharmR@26002e0) #> stringi 1.5.3 2020-09-09 [1] CRAN (R 4.0.2) #> stringr 1.4.0 2019-02-10 [1] CRAN (R 4.0.0) #> sys 3.4 2020-07-23 [1] CRAN (R 4.0.2) #> testthat 2.3.2 2020-03-02 [1] CRAN (R 4.0.0) #> tibble 3.0.4 2020-10-12 [1] CRAN (R 4.0.3) #> tidyselect 1.1.0 2020-05-11 [1] CRAN (R 4.0.2) #> units 0.6-7 2020-06-13 [1] CRAN (R 4.0.2) #> usethis 1.6.3 2020-09-17 [1] CRAN (R 4.0.2) #> utf8 1.1.4 2018-05-24 [1] CRAN (R 4.0.0) #> vctrs 0.3.4 2020-08-29 [1] CRAN (R 4.0.2) #> withr 2.3.0 2020-09-22 [1] CRAN (R 4.0.2) #> xfun 0.18 2020-09-29 [1] CRAN (R 4.0.2) #> yaml 2.2.1 2020-02-01 [1] CRAN (R 4.0.0) #> #> [1] /usr/local/lib/R/site-library #> [2] /usr/lib/R/site-library #> [3] /usr/lib/R/library ```