Skip to contents

Add random effects to a model

Usage

addEta(model, eta)

Arguments

model

The model as a function

eta

vector with the parameters to add random effects (sometimes referred to as inter-individual variability, IIV) on

Value

The model with eta added to the requested parameters

Examples

library(rxode2)
#> rxode2 2.0.13.9000 using 1 threads (see ?getRxThreads)
#>   no cache: create with `rxCreateCache()`
readModelDb("PK_1cmt") |> addEta("ka")
#>  
#>  
#>  
#>  
#> → 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
#>  promote `etalka` to between subject variability with initial estimate 0.1
#>  change initial estimate of `etalka` to `0.1`
#> function () 
#> {
#>     description <- "One compartment PK model with linear clearance"
#>     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)")
#>         etalka ~ 0.1
#>     })
#>     model({
#>         ka <- exp(lka + etalka)
#>         cl <- exp(lcl)
#>         vc <- exp(lvc)
#>         Cc <- linCmt()
#>         Cc ~ prop(propSd)
#>     })
#> }
#> <environment: 0x5604e2ff8ae0>