Get started with CAMPSIS model"

Load example from model library

First import the campsismod package. This step is not required if you have already loaded the campsis package.

library(campsismod)

Load 2-compartment PK model from built-in model library and show content.

model <- model_suite$pk$`2cpt_fo`
show(model)

Write CAMPSIS model

A CAMPSIS model can be persisted on your local drive as follows:

model %>% write(file="path_to_model_folder")
list.files("path_to_model_folder")

As shown, the output directory will contain the model (all code records) and 1 csv file per type of parameter (THETA, OMEGA and SIGMA).

Read CAMPSIS model

To read a CAMPSIS model from your local drive, use the read.campsis function. The exact same model should be retrieved.

model <- read.campsis(file="path_to_model_folder")
show(model)

The MAIN record is the part of the model where your model parameters are defined. The ODE record is where your ordinary differential equations (ODE) go, as well as any equation depending on the simulation time. The ERROR record is the place where the error model is defined. The model parameters are then shown, followed by the all the compartments.

Export CAMPSIS model to RxODE

campsismod has powerful export capabilities to RxODE and mrgsolve, the 2 simulation engines supported by campsis. The following code exports the model to RxODE. Please note that this step is implicit in CAMPSIS when you call the simulate method with your preferred simulation engine.

rxmod <- model %>% export(dest="RxODE")
rxmod

Export CAMPSIS model to mrgsolve

The following code exports the model to mrgsolve (text form).

mrgmod <- model %>% export(dest="mrgsolve")
mrgmod


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.