Primarily an internal function. This will (by default) add a parameter (mixed effect) to your code $PK/$PRED and $THETA/$OMEGA.
An nm object.
Character. Name of NONMEM variable to create.
Numeric (default = 1
). Initial value of fixed effect.
Character (default = ""
). Unit of variable.
Character (default = "LOG"
). Transformation of the variable.
Integer. Not used.
Character. Pattern to match and include the mixed effect after.
An nm object with modified ctl_contents
field.
# 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
#>