See numericlist for methods to deal with parameter_list objects.

param(.x, ...)

# S4 method for mrgmod
param(.x, .y = NULL, ..., .pat = "*", .strict = FALSE)

# S4 method for mrgsims
param(.x, ...)

# S4 method for missing
param(..., .strict = TRUE)

# S4 method for list
param(.x, ...)

# S4 method for ANY
param(.x, ...)

allparam(.x)

Arguments

.x

the model object

...

passed along or name/value pairs to update the parameters in a model object

.y

list to be merged into parameter list

.pat

a regular expression (character) to be applied as a filter for which parameters to show when printing

.strict

if TRUE, all names to be updated must be found in the parameter list

Value

An object of class parameter_list (see numericlist).

Details

Can be used to either get a parameter list object from a mrgmod model object or to update the parameters in a model object. For both uses, the return value is a parameter_list object. For the former use, param is usually called to print the parameters to the screen, but the parameter_list object can also be coerced to a list or numeric R object.

Use allparam to get a parameter_list object including both model parameters and data items listed in $FIXED.

Examples

## example("param")

mod <- mrgsolve::house()

param(mod)
#> 
#>  Model parameters (N=14):
#>  name value . name  value
#>  CL   1     | SEX   0    
#>  D1   2     | SEXCL 0.7  
#>  F1   1     | SEXVC 0.85 
#>  IC50 10    | VC    20   
#>  KA   1.2   | WT    70   
#>  KIN  100   | WTCL  0.75 
#>  KOUT 2     | WTVC  1    

param(mod, .pat="^(C|F)") ## may be useful when large number of parameters
#> 
#>  Model parameters (N=14):
#>  name value . name value
#>  CL   1     | F1   1    

class(param(mod))
#> [1] "parameter_list"
#> attr(,"package")
#> [1] "mrgsolve"

param(mod)$KA
#> [1] 1.2

param(mod)[["KA"]]
#> [1] 1.2

as.list(param(mod))
#> $CL
#> [1] 1
#> 
#> $VC
#> [1] 20
#> 
#> $KA
#> [1] 1.2
#> 
#> $F1
#> [1] 1
#> 
#> $D1
#> [1] 2
#> 
#> $WT
#> [1] 70
#> 
#> $SEX
#> [1] 0
#> 
#> $WTCL
#> [1] 0.75
#> 
#> $WTVC
#> [1] 1
#> 
#> $SEXCL
#> [1] 0.7
#> 
#> $SEXVC
#> [1] 0.85
#> 
#> $KIN
#> [1] 100
#> 
#> $KOUT
#> [1] 2
#> 
#> $IC50
#> [1] 10
#> 

as.data.frame(param(mod))
#>   CL VC  KA F1 D1 WT SEX WTCL WTVC SEXCL SEXVC KIN KOUT IC50
#> 1  1 20 1.2  1  2 70   0 0.75    1   0.7  0.85 100    2   10

param(mod, CL = 1.2)
#> 
#> 
#> --------------  source: housemodel.cpp  --------------
#> 
#>   project: /data/GHE/deploy...solve/project
#>   shared object: mrgsolve 
#> 
#>   time:          start: 0 end: 120 delta: 0.25
#>                  add: <none>
#> 
#>   compartments:  GUT CENT RESP [3]
#>   parameters:    CL VC KA F1 D1 WT SEX WTCL WTVC SEXCL
#>                  SEXVC KIN KOUT IC50 [14]
#>   captures:      DV CP [2]
#>   omega:         4x4 
#>   sigma:         1x1 
#> 
#>   solver:        atol: 1e-08 rtol: 1e-08 maxsteps: 20k
#> ------------------------------------------------------

new_values <- list(CL = 1.3, VC = 20.5)

param(mod, new_values)
#> 
#> 
#> --------------  source: housemodel.cpp  --------------
#> 
#>   project: /data/GHE/deploy...solve/project
#>   shared object: mrgsolve 
#> 
#>   time:          start: 0 end: 120 delta: 0.25
#>                  add: <none>
#> 
#>   compartments:  GUT CENT RESP [3]
#>   parameters:    CL VC KA F1 D1 WT SEX WTCL WTVC SEXCL
#>                  SEXVC KIN KOUT IC50 [14]
#>   captures:      DV CP [2]
#>   omega:         4x4 
#>   sigma:         1x1 
#> 
#>   solver:        atol: 1e-08 rtol: 1e-08 maxsteps: 20k
#> ------------------------------------------------------