Error when nesting more than one level of variability #841
-
|
Hi! I am trying to simulate the PK based on a simple one-compartment model with first-order absorption and run into problems when adding IIV and IOV at the same time. The error message is:
We put both IIV and IOV on bioavailability and we coded it by adapting the script from this example (https://nlmixrdevelopment.github.io/RxODE-manual/examples.html#inter-occasion-and-other-nesting-examples) The code is as followed: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
This is a different error than I get; library(rxode2)
#> rxode2 3.0.3 using 8 threads (see ?getRxThreads)
#> no cache: create with `rxCreateCache()`
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
#Set model code
model <-
RxODE({
#Parameters
KA <- KA * exp(eta.KA)
Fa <- Fa * exp(eta.Fa + iov.Fa) # IIV and IOV on bioavailability
#Initial conditions
A2(0) = 0
#Model
d/dt(DEPOT) = -KA * DEPOT
f(DEPOT) = Fa
d/dt(A2) = KA * DEPOT - (CL/V)*A2
Cp = A2/V * 1000
})
#Define thetas
theta <- c(KA = 0.925, # Absorption rate constant (hr-1)
V = 0.431, # Central volume (mL)
CL = 0.137, # Central clearance (mL/hr)
Fa = 0.134) # Bioavailability
#Define omegas
omega <- lotri(lotri(eta.KA ~ 0.293^2,
eta.Fa ~ 0.0836^2) | id(nu=20),
lotri(iov.Fa ~ 0.767^2) | occ(nu=10))
#Define event table
ev <- et(amount.units = "mg", time.units = "hours") %>%
et(amt = 30*0.25 , cmt = "DEPOT", addl = 9, ii = 12) %>% #Dose is 30mg/kg, multiply by average rat weight of 250 grams
et(0,120) %>%
et(id = 1:20) %>%
mutate(occ = ceiling(as.numeric(time) / 12)) %>% # 10 occasions in total
mutate(occ = ifelse(occ == 0, 1, occ))
#Solve model
results <- rxSolve(object=model, params=theta, events=ev, omega=omega, sigma=NULL)
#> Model:
#>
#> iov.Fa=(occ==1)*ETA[1]+(occ==2)*ETA[11]+(occ==3)*ETA[21]+(occ==4)*ETA[31]+(occ==5)*ETA[41]+(occ==6)*ETA[51]+(occ==7)*ETA[61]+(occ==8)*ETA[71]+(occ==9)*ETA[81]+(occ==10)*ETA[91];
#> KA=KA*exp(eta.KA);
#> Fa=Fa*exp(eta.Fa+iov.Fa);
#> A2(0)=0;
#> d/dt(DEPOT)=-KA*DEPOT;
#> f(DEPOT)=Fa;
#> d/dt(A2)=KA*DEPOT-(CL/V)*A2;
#> Cp=A2/V*1000;
#> Error in rxSolveSEXP(object, .ctl, .nms, .xtra, params, events, inits, : The following parameter(s) are required for solving: ETA[91], ETA[81], ETA[71], ETA[61], ETA[51], ETA[41], ETA[31], ETA[21], ETA[11]Created on 2025-01-20 with reprex v2.1.1 So, I am assuming you are not using the latest rxode2. I will have to look at this further. |
Beta Was this translation helpful? Give feedback.
This is fixed in #844