Adapt your parameters"

EXPORT_PNG <- FALSE

Prerequisite

The examples below require the package campismod.

library(campsismod)

Retrieve your parameters

The examples below are illustrated based on the reference 2-compartment PK model that you find in the built-in library. This model has 5 parameters. All these parameters have inter-individual variability defined.

model <- model_suite$pk$`2cpt_fo`
model

To retrieve a parameter by its name, just call the method find as follows:

model %>% find(Theta("CL"))
model %>% find(Omega("KA"))
model %>% find(Sigma("RUV_FIX"))

These parameters can also alternatively be retrieved by their index(es). Use the specific method getByIndex created for that purpose:

model@parameters %>% getByIndex(Theta(index=5))
model@parameters %>% getByIndex(Omega(index=1, index2=1))
model@parameters %>% getByIndex(Sigma(index=1, index2=1))

Access parameter values

Accessing parameter values is straightforward. Parameters have a slot value that may be accessed.

thetaCL <- model %>% find(Theta("CL"))
thetaCL@value

For OMEGA and SIGMA parameters, be careful; the interpretation of this value depends on the type of the parameter. It may be var (for a variance), covar (for a covariance), sd (for standard deviation), cv (value expressed as coefficient of variation), cv% (value expressed as coefficient of variation in percentage).
For a quick access to the value as variance or covariance, the method standardise can be called first on the parameter itself. This is especially useful for values expressed in CV or in standard deviation.

theta <- Omega(name="TEST", index=1, index2=1, value=15, type="cv%")
theta@value # 15 is returned

theta_standardised <- theta %>% standardise() # Conversion to variance
theta_standardised 
theta_standardised@value

Replace parameters

Parameters can be replaced easily. Here are a few examples:

model <- model %>% replace(Theta("KA", value=2)) # Previous value for KA was 1
model <- model %>% replace(Omega("CL", value=20, type="cv%")) # Previous value was a 25% CV
model

Delete parameters

Parameters can be deleted. Please note that it does not do anything to the equations. Also, the indexes won't be re-adjusted. Here are a few examples:

model <- model %>% delete(Theta("KA"))
model <- model %>% delete(Omega("CL"))
model

As expected, this model will not be valid anymore:

tryCatch({validObject(model, complete=TRUE)}, error=function(msg) {
  print(msg)
})


Try the campsismod package in your browser

Any scripts or data that you put into this service are public.

campsismod documentation built on Oct. 12, 2023, 5:13 p.m.