EXPORT_PNG <- FALSE
The examples below require the package campismod
.
library(campsismod)
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))
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
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
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) })
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.