Add random effects to a model
Arguments
- ui
The model as a function
- eta
vector with the parameters to add random effects (sometimes referred to as inter-individual variability, IIV) on
- priorName
logical, if TRUE, the parameter name specified in
etawill be used to add the eta value prior name is used instead of the left handed side of the equation. Defaults tooptions(rxode2.priorEta=)(or the legacynlmixr2lib.priorEta).- etaCombineType
the option for the how to combine the eta with the parameter name. Can be: "default", "snake", "camel", "dot", "blank". When missing it is taken from
options(rxode2.etaCombineType=)(or the legacynlmixr2lib.etaCombineType).- model
Deprecated alias for
ui. Supplyingmodelinstead ofuistill works but emits a deprecation warning.
See also
Other Parameter and naming building blocks:
addLogEstimates(),
addResErr(),
combinePaste2(),
defaultCombine(),
pkTrans(),
removeLinesAndInis(),
searchReplace(),
setCombineType()
Examples
pk1cmt <- function() {
ini({
lka <- 0.45; label("Absorption rate (Ka)")
lcl <- 1; label("Clearance (CL)")
lvc <- 3.45; label("Central volume of distribution (V)")
propSd <- 0.5; label("Proportional residual error (fraction)")
})
model({
ka <- exp(lka)
cl <- exp(lcl)
vc <- exp(lvc)
Cc <- linCmt()
Cc ~ prop(propSd)
})
}
library(rxode2)
pk1cmt |> addEta("ka")
#>
#>
#> ℹ parameter labels from comments are typically ignored in non-interactive mode
#> ℹ Need to run with the source intact to parse comments
#> → Adding eta to lka instead of ka due to mu-referencing
#>
#>
#> ℹ parameter labels from comments are typically ignored in non-interactive mode
#> ℹ Need to run with the source intact to parse comments
#>
#>
#> ℹ parameter labels from comments are typically ignored in non-interactive mode
#> ℹ Need to run with the source intact to parse comments
#> ℹ promote `etaKa` to between subject variability with initial estimate 0.1
#> ℹ change initial estimate of `etaKa` to `0.1`
#> function ()
#> {
#> ini({
#> lka <- 0.45
#> label("Absorption rate (Ka)")
#> lcl <- 1
#> label("Clearance (CL)")
#> lvc <- 3.45
#> label("Central volume of distribution (V)")
#> propSd <- c(0, 0.5)
#> label("Proportional residual error (fraction)")
#> etaKa ~ 0.1
#> })
#> model({
#> ka <- exp(lka + etaKa)
#> cl <- exp(lcl)
#> vc <- exp(lvc)
#> Cc <- linCmt()
#> Cc ~ prop(propSd)
#> })
#> }
#> <environment: 0x61cbbfba1068>
