[Stable]

Primarily an internal function. This will (by default) add a parameter (mixed effect) to your code $PK/$PRED and $THETA/$OMEGA.

add_mixed_param(
  m,
  name,
  init = 1,
  unit = "",
  trans = c("LOG"),
  position = NA_integer_,
  after = character()
)

Arguments

m

An nm object.

name

Character. Name of NONMEM variable to create.

init

Numeric (default = 1). Initial value of fixed effect.

unit

Character (default = ""). Unit of variable.

trans

Character (default = "LOG"). Transformation of the variable.

position

Integer. Not used.

after

Character. Pattern to match and include the mixed effect after.

Value

An nm object with modified ctl_contents field.

Examples


# create example object m1 from package demo files
exdir <- system.file("extdata", "examples", "theopp", package = "NMproject")
m1 <- new_nm(run_id = "m1", 
             based_on = file.path(exdir, "Models", "ADVAN2.mod"),
             data_path = file.path(exdir, "SourceData", "THEOPP.csv"))

m1 %>% dollar("PK")
#> $`execute.Models/m1`
#>   1| $PK
#>   2| 
#>   3| TVKA=EXP(THETA(1))
#>   4| MU_1=LOG(TVKA)
#>   5| KA = EXP(MU_1+ETA(1))
#>   6| 
#>   7| TVK=EXP(THETA(2))
#>   8| MU_2=LOG(TVK)
#>   9| K = EXP(MU_2+ETA(2))
#>  10| 
#>  11| TVV=EXP(THETA(3))
#>  12| MU_3=LOG(TVV)
#>  13| V = EXP(MU_3+ETA(3))
#>  14| 
#>  15| CL = K*V
#>  16| 
#>  17| S2 = V
#>  18| 
#> 
m1 %>% dollar("THETA")
#> $`execute.Models/m1`
#>   1| $THETA
#>   2| .....          	; KA ; h-1 ; LOG
#>   3| .....          	; K  ; h-1 ; LOG
#>   4| .....          	; V  ; L ; LOG
#>   5| 
#> 

m1 <- m1 %>% add_mixed_param("ALAG1", init = 1.1, unit = "h", trans = "LOG")

m1 %>% dollar("PK")
#> $`execute.Models/m1`
#>   1| $PK
#>   2| 
#>   3| TVKA=EXP(THETA(1))
#>   4| MU_1=LOG(TVKA)
#>   5| KA = EXP(MU_1+ETA(1))
#>   6| 
#>   7| TVK=EXP(THETA(2))
#>   8| MU_2=LOG(TVK)
#>   9| K = EXP(MU_2+ETA(2))
#>  10| 
#>  11| TVV=EXP(THETA(3))
#>  12| MU_3=LOG(TVV)
#>  13| V = EXP(MU_3+ETA(3))
#>  14| 
#>  15| CL = K*V
#>  16| 
#>  17| S2 = V
#>  18| 
#>  19| TVALAG1=EXP(THETA(4))
#>  20| MU_4=LOG(TVALAG1)
#>  21| ALAG1 = EXP(MU_4+ETA(4))
#> 
m1 %>% dollar("THETA")
#> $`execute.Models/m1`
#>   1| $THETA
#>   2| .....          	; KA ; h-1 ; LOG
#>   3| .....          	; K  ; h-1 ; LOG
#>   4| .....          	; V  ; L ; LOG
#>   5| 
#>   6| 0.095       ; ALAG1 ; h ;  LOG
#>