nlmixrdevelopment / nlmixr

nlmixr: an R package for population PKPD modeling
https://nlmixrdevelopment.github.io/nlmixr/
GNU General Public License v2.0
114 stars 45 forks source link

Error when trying to use different residual error in the same model #640

Open nlmixr-user opened 1 year ago

nlmixr-user commented 1 year ago

Hi @mattfidler ,

I am trying to use different residual error in my model, I followed the same proposal as for #231 and it actually works for theo_sd example. When trying the same method on my data, the following error appears Error : The simulated residual errors do not match the model specification (1=2) In addition: Warning message: In UseMethod("depth") : no applicable method for 'depth' applied to an object of class "NULL" Error: The simulated residual errors do not match the model specification (1=2)

Here is the piece of code used: model123 <- function() {

ini({ tcl1 <- log(0.2) #Log cl1 tvl1 <- log(8) #Log vl1 tcl2 <- log(0.1) #Log cl2 tvl2 <- log(3) #Log vl2 tka <- log(0.3) #Log ka(fa) eta.cl1 + eta.vl1 ~ c(0.05, 0.03,0.12) eta.ka ~ 0.26 #standard error prop.err.P1 <- 0.40 prop.err.P2 <- 0.60

}) model({ cl1 = exp(tcl1 + 0.75log(WT/76.35)+ eta.cl1); vl1 = exp(tvl1 + 1log(WT/76.35)+eta.vl1); cl2 = exp(tcl2); vl2 = exp(tvl2); ka <- exp(tka+eta.ka); k10 = cl1/vl1; k12 = cl2/vl1; k21 = cl2/vl2;

## ODEs for depot, central and peripheral compartments

d/dt(depot) = -ka*depot
d/dt(center)  = ka*depot-(k10+k12)*center+k21*peripheral
d/dt(peripheral) = k12*center-k21*peripheral
cp = center / vl1
cp ~ prop(prop.err.P1) | p1
cp ~ prop(prop.err.P2) | p2

}) }

fit123<- nlmixr2(model123, data, est="focei", foceiControl(outerOpt="nlminb"), table=tableControl(cwres=T, npde=T))

fit123

Also, when checking with nlmixr(model123) function, it seems ok: image

Would you have any idea? Many thanks in advance.

mattfidler commented 1 year ago

Sorry, I haven't looked at this, I don't tend to this forum as well as the nlmixr2 forum.

I will move that to the nlmixr2 for now.