residual error not assigned to variable defined using lincmt #851
-
In code below, variable Cc is not assigned proportional error as expected. However, the output "sim" variable does exhibit residual error. rm(list=ls())
require(rxode2)
mymdl <- function(){
ini({
lcl <- 1.6
lvc <- log(90)
lka <- 0.1
prop.err <- 0.2
eta.cl ~ 0.1
eta.vc ~ 0.1
eta.ka ~ 0.1
})
model({
cl <- exp(lcl + eta.cl)
vc <- exp(lvc + eta.vc)
ka <- exp(lka + eta.ka)
Cc <- linCmt()
Cc ~ prop(prop.err)
})
}
ev <- et(amt=100, ii=24, addl=3, cmt="depot")
mysim <- rxSolve(mymdl, ev, nSub=1)
plot(mysim)
|
Beta Was this translation helpful? Give feedback.
Answered by
mattfidler
Feb 21, 2025
Replies: 1 comment 4 replies
-
Hi @crgfn In This is what is shown in your plots, so this is expected behavior. The underlying require(rxode2)
#> Loading required package: rxode2
#> Warning: package 'rxode2' was built under R version 4.4.2
#> rxode2 3.0.2.9000 using 4 threads (see ?getRxThreads)
#> no cache: create with `rxCreateCache()`
mymdl <- function(){
ini({
lcl <- 1.6
lvc <- log(90)
lka <- 0.1
prop.err <- 0.2
eta.cl ~ 0.1
eta.vc ~ 0.1
eta.ka ~ 0.1
})
model({
cl <- exp(lcl + eta.cl)
vc <- exp(lvc + eta.vc)
ka <- exp(lka + eta.ka)
Cc <- linCmt()
Cc ~ prop(prop.err)
})
}
mymdl <- mymdl()
summary(mymdl$simulationModel)
#> rxode2 3.0.2.9000 model named rx_000ac6be307786ed4194123ebb6a5938_x6 model (✔ ready).
#> DLL: C:\Users\fidlema3\AppData\Local\Temp\1\RTMPK0~1\rxode2\RX_000~1.RXD/rx_000ac6be307786ed4194123ebb6a5938_x64.dll
#> NULL
#>
#> Calculated Variables:
#> [1] "cl" "vc" "ka" "Cc" "ipredSim" "sim"
#> ── rxode2 Model Syntax ──
#> rxode2({
#> param(lcl, lvc, lka, prop.err, eta.cl, eta.vc, eta.ka)
#> cl = exp(lcl + eta.cl)
#> vc = exp(lvc + eta.vc)
#> ka = exp(lka + eta.ka)
#> Cc = linCmt()
#> rx_yj_ ~ 2
#> rx_lambda_ ~ 1
#> rx_low_ ~ 0
#> rx_hi_ ~ 1
#> rx_pred_f_ ~ Cc
#> rx_pred_ ~ rx_pred_f_
#> rx_r_ ~ (rx_pred_f_ * prop.err)^2
#> ipredSim = rxTBSi(rx_pred_, rx_lambda_, rx_yj_, rx_low_,
#> rx_hi_)
#> sim = rxTBSi(rx_pred_ + sqrt(rx_r_) * rxerr.Cc, rx_lambda_,
#> rx_yj_, rx_low_, rx_hi_)
#> cmt(Cc)
#> dvid(1)
#> }) Created on 2025-02-20 with reprex v2.1.1 You can see that the |
Beta Was this translation helpful? Give feedback.
4 replies
Answer selected by
mattfidler
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @crgfn
In
nlmixr2
style simulations thesim
includes the proportional error,Cc
is thelinCmt()
concentrations andipredSim
is the simulated individual predictions.This is what is shown in your plots, so this is expected behavior.
The underlying
rxode2
low-level model can show this a bit more clearly: