| Title: | Generic PK/PD Simulation Platform Campsis |
|---|---|
| Description: | A generic, easy-to-use and intuitive pharmacokinetic/pharmacodynamic (PK/PD) simulation platform based on the R packages 'rxode2' and 'mrgsolve'. Campsis provides an abstraction layer over the underlying processes of defining a PK/PD model, assembling a custom dataset and running a simulation. The package has a strong dependency on the R package 'campsismod', which allows models to be read from and written to files, including through a JSON-based interface, and to be adapted further on the fly in the R environment. In addition, 'campsis' allows users to assemble datasets in an intuitive manner, including via a JSON-based interface to import Campsis datasets defined using formal JSON schemas distributed with the package. Once the dataset is ready, the package prepares the simulation, calls 'rxode2' or 'mrgsolve' (at the user's choice), and returns the results for the given model, dataset and desired simulation settings. The package itself is licensed under the GPL (>= 3); the JSON schema files shipped in inst/extdata are licensed separately under the Creative Commons Attribution 4.0 International (CC BY 4.0). |
| Authors: | Nicolas Luyckx [aut, cre], Calvagone [cph] |
| Maintainer: | Nicolas Luyckx <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 1.9.3 |
| Built: | 2026-10-20 10:25:12 UTC |
| Source: | https://github.com/campsisverse/campsis |
Apply some action on the given object.
apply_action(object, action) ## S4 method for signature 'campsis_model,replace_action' apply_action(object, action) ## S4 method for signature 'dataset,replace_action' apply_action(object, action)apply_action(object, action) ## S4 method for signature 'campsis_model,replace_action' apply_action(object, action) ## S4 method for signature 'dataset,replace_action' apply_action(object, action)
object |
any object |
action |
action to apply |
updated object
Apply compartment characteristics from model. In practice, only compartment infusion duration needs to be applied.
apply_compartment_characteristics(table, properties)apply_compartment_characteristics(table, properties)
table |
current dataset |
properties |
compartment properties from model |
updated dataset
Apply output function(s) on the given Campsis results.
apply_outfun(x, outfun, level = NULL, ...) ## S4 method for signature 'outfun' apply_outfun(x, outfun, level = NULL, ...) ## S4 method for signature 'outfuns' apply_outfun(x, outfun, level = NULL, ...)apply_outfun(x, outfun, level = NULL, ...) ## S4 method for signature 'outfun' apply_outfun(x, outfun, level = NULL, ...) ## S4 method for signature 'outfuns' apply_outfun(x, outfun, level = NULL, ...)
x |
Campsis simulation results |
outfun |
output function(s), an 'outfun' or 'outfuns' object |
level |
level at which the output function is applied, 'replicate' by default |
... |
extra arguments transmitted automatically by Campsis (e.g. 'replicate' for the replicate number) |
the updated Campsis results
Create a treatment arm.
Arm(id = as.integer(NA), subjects = 1, label = as.character(NA))Arm(id = as.integer(NA), subjects = 1, label = as.character(NA))
id |
unique identifier for this arm (available trough dataset), integer. If NA (default), this identifier is auto-incremented. |
subjects |
number of subjects in arm, integer |
label |
arm label, single character string. If set, this label will be output in the ARM column of Campsis instead of the identifier. |
an arm
Arm class.
idarm unique ID, integer
subjectsnumber of subjects in arm, integer
labelarm label, single character string
protocolprotocol
covariatescovariates
bootstrapcovariates to be bootstrapped
Time sequence to numeric vector.
## S4 method for signature 'time_sequence' as.numeric(x)## S4 method for signature 'time_sequence' as.numeric(x)
x |
time sequence object |
a numeric vector
Time vector to numeric vector.
## S4 method for signature 'time_vector' as.numeric(x)## S4 method for signature 'time_vector' as.numeric(x)
x |
time vector object |
a numeric vector
Binomial distribution.
BinomialDistribution(trials, prob)BinomialDistribution(trials, prob)
trials |
number of Bernoulli trials per observation (=subject), integer |
prob |
probability of success for each trial |
a binomial distribution
Create one or several bolus(es).
Bolus( time, amount, compartment = NULL, f = NULL, lag = NULL, ii = NULL, addl = NULL, wrap = TRUE, ref = NULL, rep = NULL )Bolus( time, amount, compartment = NULL, f = NULL, lag = NULL, ii = NULL, addl = NULL, wrap = TRUE, ref = NULL, rep = NULL )
time |
treatment time(s), numeric value or vector. First treatment time if used together with ii and addl. |
amount |
amount to give as bolus, single numeric value |
compartment |
compartment index or name to give the bolus(es). A vector of integers or names can be used for a complex model administration. |
f |
fraction of dose amount, list of distributions (one per compartment) |
lag |
dose lag time, list of distributions (one per compartment) |
ii |
inter-dose interval, requires argument 'time' to be a single numeric value |
addl |
number of additional doses, requires argument 'time' to be a single integer value |
wrap |
if TRUE, the bolus wrapper will be stored as is in the dataset, otherwise, it will be split into a list of boluses distinct in time. Default is TRUE. |
ref |
any reference name used to identify this bolus, single character value |
rep |
repeat the base dosing schedule several times, a 'repeated schedule' object is expected. Default is NULL (no repetition). |
a single bolus or a list of boluses
Create a bootstrap object.
Bootstrap( data, id = "BS_ID", replacement = FALSE, random = FALSE, export_id = FALSE )Bootstrap( data, id = "BS_ID", replacement = FALSE, random = FALSE, export_id = FALSE )
data |
data frame to be bootstrapped. It must have a unique identifier column named according to the specified argument 'id' (default value is 'BS_ID'). Other columns are covariates to bootstrap. They must all be numeric. Whatever the configuration of the bootstrap, these covariates are always read row by row and belong to a same individual. |
id |
unique identifier column name in data |
replacement |
values can be reused or not when drawn, logical |
random |
values are drawn randomly, logical |
export_id |
tell Campsis if the identifier 'BS_ID' must be output or not, logical |
a bootstrap object
Bootstrap distribution class.
datavalues to draw, numeric vector
replacementvalues can be reused or not, logical
randomvalues are drawn randomly, logical
Bootstrap class.
datadata frame to be bootstrapped. Column 'BS_ID' is mandatory and corresponds to the original row ID from the bootstrap. It must be numeric and unique. Other columns are covariates to be bootstrapped (row by row).
replacementvalues can be reused or not, logical
randomvalues are drawn randomly, logical
export_idtell Campsis if 'BS_ID' must be exported into the dataset, logical
Create a bootstrap distribution. During function sampling, Campsis will generate values depending on the given data and arguments.
BootstrapDistribution(data, replacement = FALSE, random = FALSE)BootstrapDistribution(data, replacement = FALSE, random = FALSE)
data |
values to draw, numeric vector |
replacement |
values can be reused or not, logical |
random |
values are drawn randomly, logical |
a bootstrap distribution
Suggested Campsis handler for showing the progress bar.
campsis_handler()campsis_handler()
a progressr handler list
Campsis metadata class.
datasetCampsis dataset object
destdestination simulation engine
scenariosCampsis scenarios object
outvarscharacter vector of output variable names
outfuncollection of output functions
replicatesnumber of replicates
Campsis table class (see this class as an interface)
Compute the prediction interval summary over time.
compute_pi(x, variable, strata = get_default_strata(), level = 0.9)compute_pi(x, variable, strata = get_default_strata(), level = 0.9)
x |
data frame |
variable |
variable(s) used to compute the prediction interval, character vector. |
strata |
named vector with the strata to use, default is c(SCENARIO="all", ARM="all"). |
level |
PI level, default is 0.9 (90% PI) |
a summary table
Compute generic statistics over time.
compute_stats( x, variable, strata = get_default_strata(), stats = c("p5", "median", "p95") )compute_stats( x, variable, strata = get_default_strata(), stats = c("p5", "median", "p95") )
x |
data frame |
variable |
variable(s) used to compute the statistics, character vector. |
strata |
named vector with the strata to use, default is c(SCENARIO="all", ARM="all"). |
stats |
character vector of statistics to compute. Supported: "median", "mean", or percentiles like "p5", "p95", "p2.5", "p97.5". |
a summary table in long format
Constant distribution class.
valuecovariate value, single numeric value
Create a constant distribution. Its value will be constant across all generated samples.
ConstantDistribution(value)ConstantDistribution(value)
value |
covariate value, single numeric value |
a constant distribution (same value for all samples)
Convert numeric time vector based on the provided units.
convert_time(x, from, to)convert_time(x, from, to)
x |
numeric time vector |
from |
unit of x, single character value |
to |
destination unit, single character value |
numeric vector with the converted times
Create a non time-varying (fixed) covariate.
Covariate(name, distribution)Covariate(name, distribution)
name |
covariate name, single character value |
distribution |
covariate distribution |
a fixed covariate
Covariate class.
namecovariate name, single character value
distributioncovariate distribution
Cyclic schedule class.
durationduration of the cycle, numeric value
repetitionsnumber of additional repetitions to the base pattern, integer value
Cyclic schedule constructor.
CyclicSchedule(duration, repetitions)CyclicSchedule(duration, repetitions)
duration |
duration of the cycle, numeric value |
repetitions |
number of additional repetitions to the base pattern, integer value |
a cyclic schedule
Create a dataset.
Dataset(subjects = NULL, label = as.character(NA), json = NULL)Dataset(subjects = NULL, label = as.character(NA), json = NULL)
subjects |
number of subjects in the default arm |
label |
label of the default arm, NA by default |
json |
path to JSON dataset file or JSON content in string form |
a dataset
Dataset configuration class.
def_depot_cmtdefault depot compartment, integer
def_obs_cmtdefault observation compartment, integer
export_tsldexport column TSLD, logical
export_tdosexport column TDOS, logical
time_unit_datasetunit of time in dataset, character ('hour' by default)
time_unit_exportunit of time in export, character ('hour' by default)
Dataset class.
armsa list of treatment arms
configdataset configuration for export
iivdata frame containing the inter-individual variability (all ETAS) for the export
Create a dataset configuration. This configuration allows Campsis to know which are the default depot and observed compartments.
DatasetConfig( defDepotCmt = 1, defObsCmt = 1, exportTSLD = FALSE, exportTDOS = FALSE, timeUnitDataset = "hour", timeUnitExport = "hour" )DatasetConfig( defDepotCmt = 1, defObsCmt = 1, exportTSLD = FALSE, exportTDOS = FALSE, timeUnitDataset = "hour", timeUnitExport = "hour" )
defDepotCmt |
default depot compartment, integer |
defObsCmt |
default observation compartment, integer |
exportTSLD |
export column TSLD (time since last dose), logical |
exportTDOS |
export column TDOS (time of last dose), logical |
timeUnitDataset |
unit of time in dataset, character ('hour' by default) |
timeUnitExport |
unit of time in export, character ('hour' by default) |
a dataset configuration
Convert days to hours.
days(x)days(x)
x |
numeric vector in days |
numeric vector in hours
Create declare settings.
Declare(variables = character(0))Declare(variables = character(0))
variables |
uninitialized variables to be declared, only needed with mrgsolve |
Declare settings
Declare settings class.
variablesuninitialized variables to be declared, only needed with mrgsolve
Default settings class.
engineSimulation engine: 'rxode2' or 'mrgsolve'.
Default is NULL (unspecified). If NULL, 'mrgsolve' is used first
(if installed), followed by 'rxode2' (if installed).
seedrandom seed number, integer
replicatesnumber of replicates, integer
outvarsoutput variables, character vector
outfunsoutput functions, outfuns object
disabled_variabilitiesvariabilities to disable in the simulation, character vector
dosingoutput dosing information, logical
Default output function (identity function).
DefaultOutfun()DefaultOutfun()
an output function that returns the Campsis results as is.
Create default settings.
DefaultSettings( engine = NULL, seed = NULL, replicates = 1L, outvars = character(), outfuns = Outfuns(), disabled_variabilities = character(), dosing = FALSE )DefaultSettings( engine = NULL, seed = NULL, replicates = 1L, outvars = character(), outfuns = Outfuns(), disabled_variabilities = character(), dosing = FALSE )
engine |
Simulation engine: |
seed |
random seed number, integer (or NULL for auto-generated seed) |
replicates |
number of replicates, integer. Default is 1. |
outvars |
output variables, character vector |
outfuns |
output functions, outfuns object |
disabled_variabilities |
variabilities to disable in the simulation, character vector |
dosing |
output dosing information, logical |
default settings
Discrete distribution.
DiscreteDistribution(x, prob, replace = TRUE)DiscreteDistribution(x, prob, replace = TRUE)
x |
vector of one or more integers from which to choose |
prob |
a vector of probability weights for obtaining the elements of the vector being sampled |
replace |
should sampling be with replacement, default is TRUE |
a discrete distribution
Distribution class. See this class as an interface.
Dose adaptation class.
formulaformula to apply, single character string, e.g. "AMT*WT"
compartmentscompartment numbers where the formula needs to be applied
Create a dose adaptation.
DoseAdaptation(formula, compartments = NULL)DoseAdaptation(formula, compartments = NULL)
formula |
formula to apply, single character string, e.g. "AMT*WT" |
compartments |
compartment indexes or names where the formula needs to be applied, integer or character vector. Default is NULL (formula applied on all compartments) |
a fixed covariate
Filter Campsis output on dosing rows.
dosing_only(x)dosing_only(x)
x |
data frame, Campsis output |
a data frame with the dosing rows
Dosing schedule constructor.
DosingSchedule()DosingSchedule()
a dosing schedule (schedule repeated at dose times)
Create an ETA distribution. The resulting distribution is a normal distribution, with mean=0 and sd=sqrt(OMEGA).
EtaDistribution(model, omega)EtaDistribution(model, omega)
model |
model |
omega |
corresponding THETA name, character |
an ETA distribution
Create an interruption event.
Event(name = NULL, times, fun, debug = FALSE)Event(name = NULL, times, fun, debug = FALSE)
name |
event name, character value |
times |
interruption times, numeric vector |
fun |
event function to apply at each interruption |
debug |
output the variables that were changed through this event |
an event definition
Event class.
nameevent name, character value
timesinterruption times, numeric vector
funevent function to apply at each interruption
debugoutput the variables that were changed through this event
Create an event covariate. These covariates can be modified further in interruption events.
EventCovariate(name, distribution)EventCovariate(name, distribution)
name |
covariate name, character |
distribution |
covariate distribution at time 0 |
a time-varying covariate
Create a list of interruption events.
Events()Events()
a events object
Fixed distribution class.
valuescovariate values, numeric vector (1 value per sample)
Create a fixed distribution. Each sample will be assigned a fixed value coming from vector 'values'.
FixedDistribution(values)FixedDistribution(values)
values |
covariate values, numeric vector (1 value per sample) |
a fixed distribution (1 value per sample)
Function distribution class.
funfunction name, character (e.g. 'rnorm')
argslist of arguments (e.g list(mean=70, sd=10))
Create a function distribution. During distribution sampling, the provided function will be responsible for generating values for each sample. If first argument of this function is not the size (n), please tell which argument corresponds to the size 'n' (e.g. list(size="n")).
FunctionDistribution(fun, args)FunctionDistribution(fun, args)
fun |
function name, character (e.g. 'rnorm') |
args |
list of arguments (e.g list(mean=70, sd=10)) |
a function distribution
Generate IIV matrix for the given Campsis model.
generate_iiv(model, n, offset = 0)generate_iiv(model, n, offset = 0)
model |
Campsis model |
n |
number of subjects |
offset |
if specified, resulting ID will be ID + offset |
IIV data frame with ID column
Generate IIV matrix for the given OMEGA matrix.
generate_iiv_(omega, n)generate_iiv_(omega, n)
omega |
omega matrix |
n |
number of subjects |
IIV data frame
Return the list of available time units.
get_available_time_units()get_available_time_units()
character vector
Get Campsis option logic.
get_campsis_option(name, default)get_campsis_option(name, default)
name |
option to search |
default |
default value if option not found |
option value
Get all covariates (fixed / time-varying / event covariates).
get_covariates(object) ## S4 method for signature 'covariates' get_covariates(object) ## S4 method for signature 'arm' get_covariates(object) ## S4 method for signature 'arms' get_covariates(object) ## S4 method for signature 'dataset' get_covariates(object)get_covariates(object) ## S4 method for signature 'covariates' get_covariates(object) ## S4 method for signature 'arm' get_covariates(object) ## S4 method for signature 'arms' get_covariates(object) ## S4 method for signature 'dataset' get_covariates(object)
object |
any object |
all covariates from object
Get all event-related covariates.
get_event_covariates(object) ## S4 method for signature 'covariates' get_event_covariates(object) ## S4 method for signature 'arm' get_event_covariates(object) ## S4 method for signature 'arms' get_event_covariates(object) ## S4 method for signature 'dataset' get_event_covariates(object)get_event_covariates(object) ## S4 method for signature 'covariates' get_event_covariates(object) ## S4 method for signature 'arm' get_event_covariates(object) ## S4 method for signature 'arms' get_event_covariates(object) ## S4 method for signature 'dataset' get_event_covariates(object)
object |
any object |
all event-related covariates from object
Get all fixed covariates.
get_fixed_covariates(object) ## S4 method for signature 'covariates' get_fixed_covariates(object) ## S4 method for signature 'arm' get_fixed_covariates(object) ## S4 method for signature 'arms' get_fixed_covariates(object) ## S4 method for signature 'dataset' get_fixed_covariates(object)get_fixed_covariates(object) ## S4 method for signature 'covariates' get_fixed_covariates(object) ## S4 method for signature 'arm' get_fixed_covariates(object) ## S4 method for signature 'arms' get_fixed_covariates(object) ## S4 method for signature 'dataset' get_fixed_covariates(object)
object |
any object |
all fixed covariates from object
Get all IOV objects.
get_iovs(object) ## S4 method for signature 'arm' get_iovs(object) ## S4 method for signature 'arms' get_iovs(object) ## S4 method for signature 'dataset' get_iovs(object)get_iovs(object) ## S4 method for signature 'arm' get_iovs(object) ## S4 method for signature 'arms' get_iovs(object) ## S4 method for signature 'dataset' get_iovs(object)
object |
any object |
all IOV's from object
Get all occasions.
get_occasions(object) ## S4 method for signature 'arm' get_occasions(object) ## S4 method for signature 'arms' get_occasions(object) ## S4 method for signature 'dataset' get_occasions(object)get_occasions(object) ## S4 method for signature 'arm' get_occasions(object) ## S4 method for signature 'arms' get_occasions(object) ## S4 method for signature 'dataset' get_occasions(object)
object |
any object |
all occasions from object
Get splitting configuration for parallel export.
get_splitting_configuration(dataset, hardware)get_splitting_configuration(dataset, hardware)
dataset |
Campsis dataset to export |
hardware |
hardware configuration |
splitting configuration list (if 'dataset_parallel' is enabled) or NA (if 'dataset_parallel' disabled or if the length of the dataset is less than the dataset export slice size)
Get all time-varying covariates.
get_time_varying_covariates(object) ## S4 method for signature 'covariates' get_time_varying_covariates(object) ## S4 method for signature 'arm' get_time_varying_covariates(object) ## S4 method for signature 'arms' get_time_varying_covariates(object) ## S4 method for signature 'dataset' get_time_varying_covariates(object)get_time_varying_covariates(object) ## S4 method for signature 'covariates' get_time_varying_covariates(object) ## S4 method for signature 'arm' get_time_varying_covariates(object) ## S4 method for signature 'arms' get_time_varying_covariates(object) ## S4 method for signature 'dataset' get_time_varying_covariates(object)
object |
any object |
all time-varying covariates from object
Get all distinct times for the specified object.
get_times(object, ...) ## S4 method for signature 'treatment' get_times(object, unwrap = TRUE) ## S4 method for signature 'observations' get_times(object, doseTimes = NULL) ## S4 method for signature 'observations_set' get_times(object, doseTimes = NULL) ## S4 method for signature 'arm' get_times(object) ## S4 method for signature 'arms' get_times(object) ## S4 method for signature 'events' get_times(object) ## S4 method for signature 'dataset' get_times(object)get_times(object, ...) ## S4 method for signature 'treatment' get_times(object, unwrap = TRUE) ## S4 method for signature 'observations' get_times(object, doseTimes = NULL) ## S4 method for signature 'observations_set' get_times(object, doseTimes = NULL) ## S4 method for signature 'arm' get_times(object) ## S4 method for signature 'arms' get_times(object) ## S4 method for signature 'events' get_times(object) ## S4 method for signature 'dataset' get_times(object)
object |
any object |
... |
extra arguments like 'doseTimes' in observations or 'unwrap' in treatment |
unwrap |
unwrap treatment before accessing the times, default value is TRUE |
doseTimes |
times of the doses, only needed if a [DosingSchedule()] is referred to |
numeric vector with all unique times, sorted
Create hardware settings.
Hardware( cpu = 1, replicate_parallel = FALSE, scenario_parallel = FALSE, slice_parallel = FALSE, slice_size = NULL, dataset_parallel = FALSE, dataset_slice_size = 500, auto_setup_plan = NULL )Hardware( cpu = 1, replicate_parallel = FALSE, scenario_parallel = FALSE, slice_parallel = FALSE, slice_size = NULL, dataset_parallel = FALSE, dataset_slice_size = 500, auto_setup_plan = NULL )
cpu |
number of CPU cores to use, default is 1 |
replicate_parallel |
enable parallel computing for replicates, default is FALSE |
scenario_parallel |
enable parallel computing for scenarios, default is FALSE |
slice_parallel |
enable parallel computing for slices, default is FALSE |
slice_size |
number of subjects per simulated slice, default is NULL (auto-configured by Campsis depending on the specified engine) |
dataset_parallel |
enable parallelisation when exporting dataset into a table, default is FALSE |
dataset_slice_size |
dataset slice size when exporting subjects to a table, default is 500. Only applicable if 'dataset_parallel' is enabled. |
auto_setup_plan |
auto-setup plan with the library future, if not set (i.e. =NULL), plan will be setup automatically if the number of CPU's > 1. |
hardware settings
Hardware settings class.
cpunumber of CPU cores to use, default is 1
replicate_parallelenable parallel computing for replicates, default is FALSE
scenario_parallelenable parallel computing for scenarios, default is FALSE
slice_parallelenable parallel computing for slices, default is FALSE
slice_sizenumber of subjects per simulated slice, default is NULL (auto-configured by Campsis depending on the specified engine)
dataset_parallelenable parallelisation when exporting dataset into a table, default is FALSE
dataset_slice_sizedataset slice size when exporting subjects to a table, default is 500. Only applicable if 'dataset_parallel' is enabled.
auto_setup_planauto-setup plan with the library future, default is FALSE
Convert hours to hours (do nothing).
hours(x)hours(x)
x |
numeric vector in hours |
numeric vector in hours
Create one or several infusion(s).
Infusion( time, amount, compartment = NULL, f = NULL, lag = NULL, duration = NULL, rate = NULL, ii = NULL, addl = NULL, wrap = TRUE, ref = NULL, rep = NULL )Infusion( time, amount, compartment = NULL, f = NULL, lag = NULL, duration = NULL, rate = NULL, ii = NULL, addl = NULL, wrap = TRUE, ref = NULL, rep = NULL )
time |
treatment time(s), numeric value or vector. First treatment time if used together with ii and addl. |
amount |
amount to infuse, single numeric value |
compartment |
compartment index or name to give the infusion(s). A vector of integers or names can be used for a complex model administration. |
f |
fraction of infusion amount, list of distributions (one per compartment) |
lag |
infusion lag time, , list of distributions (one per compartment) |
duration |
infusion duration, list of distributions (one per compartment) |
rate |
infusion rate, list of distributions (one per compartment) |
ii |
inter-dose interval, requires argument 'time' to be a single numeric value |
addl |
number of additional doses, requires argument 'time' to be a single integer value |
wrap |
if TRUE, the infusion wrapper will be stored as is in the dataset, otherwise, it will be split into a list of infusions distinct in time. Default is TRUE. |
ref |
any reference name used to identify this infusion, single character value |
rep |
repeat the base dosing schedule several times, a 'repeated schedule' object is expected. Default is NULL (no repetition). |
a single infusion or a list of infusions.
Infusion class.
durationinfusion duration, distribution list
rateinfusion rate, distribution list
Internal settings class (transient object from the simulation settings).
dataset_summarydataset summary
progresssimulation progress
iterationslist of event iterations
Define inter-occasion variability (IOV) into the dataset. A new variable of name 'colname' will be output into the dataset and will vary at each dose number according to the given distribution.
IOV(colname, distribution = NULL, dose_numbers = NULL, omega_ref = NULL)IOV(colname, distribution = NULL, dose_numbers = NULL, omega_ref = NULL)
colname |
name of the column that will be output in dataset |
distribution |
distribution |
dose_numbers |
dose numbers, if provided, IOV is generated at these doses only. By default, IOV is generated for all doses. |
omega_ref |
name of the OMEGA (e.g. 'IOV' without the 'OMEGA_') |
an IOV object
Treatment IOV class.
colnamename of the column that will be output in dataset
distributiondistribution
dose_numbersassociated dose numbers, integer vector, same length as values
omega_refname of the OMEGA (e.g. 'IOV' without the 'OMEGA_')
Return the number of subjects contained in this arm.
## S4 method for signature 'arm' length(x)## S4 method for signature 'arm' length(x)
x |
arm |
a number
Return the number of repetition cycles.
## S4 method for signature 'cyclic_schedule' length(x)## S4 method for signature 'cyclic_schedule' length(x)
x |
schedule object |
a number
Return the number of subjects contained in this dataset.
## S4 method for signature 'dataset' length(x)## S4 method for signature 'dataset' length(x)
x |
dataset |
a number
Return the number of repetition cycles.
## S4 method for signature 'repeat_at_schedule' length(x)## S4 method for signature 'repeat_at_schedule' length(x)
x |
schedule object |
a number
Create a log normal distribution.
LogNormalDistribution(meanlog, sdlog)LogNormalDistribution(meanlog, sdlog)
meanlog |
mean value of distribution in log domain |
sdlog |
standard deviation of distribution in log domain |
a log normal distribution
Convert minutes to hours.
minutes(x)minutes(x)
x |
numeric vector in minutes |
numeric vector in hours
Convert pharma months (1 month = 4 weeks) to hours.
months(x)months(x)
x |
numeric vector in months |
numeric vector in hours
NCA table output function class.
tableCampsisnca table object
export_typetype of export, 'summary', 'summary_wide', 'summary_pretty', 'individual' or 'individual_wide'
Create a NCA table output function
NCATableOutfun(table, export_type = "summary", name = "default_nca_table")NCATableOutfun(table, export_type = "summary", name = "default_nca_table")
table |
NCA table from campsisnca, object, path to JSON, or JSON element |
export_type |
type of export, 'summary', 'summary_wide', 'summary_pretty', 'individual' or 'individual_wide' |
name |
name of the output function. Default is 'default_nca_table'. |
a stats_outfun object
NHANES database (demographics and body measure data combined, from 2017-2018).
nhanesnhanes
data frame
Original identifier
Sex: 1 for males, 2 for females
Age in years
Body weight in kg
Body mass index
Height in cm
https://wwwn.cdc.gov/Nchs/Nhanes/2017-2018/DEMO_J.XPT
https://wwwn.cdc.gov/Nchs/Nhanes/2017-2018/BMX_J.XPT
Create NOCB settings.
NOCB(enable = NULL, variables = character(0))NOCB(enable = NULL, variables = character(0))
enable |
enable/disable next-observation carried backward mode (NOCB), default value is TRUE for mrgsolve, FALSE for RxODE |
variables |
variable names subject to NOCB behavior (see vignette for more info) |
NOCB settings
NOCB settings class.
enableenable/disable next-observation carried backward mode (NOCB), default value is TRUE for mrgsolve, FALSE for RxODE
variablesvariable names subject to NOCB behavior (see vignette for more info)
Create a normal distribution.
NormalDistribution(mean, sd)NormalDistribution(mean, sd)
mean |
mean value of distribution |
sd |
standard deviation of distribution |
a normal distribution
Filter Campsis output on observation rows.
obs_only(x)obs_only(x)
x |
data frame, Campsis output |
a data frame with the observation rows
Create an observations list. Please note that the provided 'times' will automatically be sorted. Duplicated times will be removed.
Observations(times, compartment = NA, rep = NULL)Observations(times, compartment = NA, rep = NULL)
times |
observation times, numeric vector |
compartment |
compartment index (integer) or name (character) |
rep |
repetition schedule |
an observations list
Observations class.
timesany object that implements
compartmentcompartment index (integer) or name (character)
dvobserved values, numeric vector (FOR EXTERNAL USE)
reprepetition schedule
Define a new occasion. Occasions are defined by mapping occasion values to dose numbers. A new column will automatically be created in the exported dataset.
Occasion(colname, values, dose_numbers)Occasion(colname, values, dose_numbers)
colname |
name of the column that will be output in dataset |
values |
the occasion numbers, any integer vector |
dose_numbers |
the related dose numbers, any integer vector of same length as 'values' |
occasion object
Occasion class.
colnamesingle character value representing the column name related to this occasion
valuesoccasion values, integer vector, same length as dose_numbers
dose_numbersassociated dose numbers, integer vector, same length as values
Create a new output function
Outfun( fun = function(x, ...) { x }, args = list(), packages = NULL, level = "replicate", name = "custom" )Outfun( fun = function(x, ...) { x }, args = list(), packages = NULL, level = "replicate", name = "custom" )
fun |
function or purrr-style lambda formula, first argument 'x' must be the results |
args |
extra arguments, named list |
packages |
packages that must be loaded to execute the given function, character vector |
level |
where to apply the output function, only 'replicate' is allowed since Campsis v1.9.0 |
name |
name of the output function. Default is 'custom'. |
an output function
Output function class.
funfunction or purrr-style lambda formula, first argument 'x' must be the results
namename of the output function
argsextra arguments, named list
packagespackages that must be loaded to execute the given function, character vector
leveleither 'scenario' or 'replicate'. Default is 'scenario'.
clsresulting S3 class(es) of the Campsis output
outfun_as_arglogical, whether to pass the outfun object as an argument to the function
Create a collection of output functions.
Outfuns()Outfuns()
an output_functions object
Output functions class (i.e. a collection of output functions).
Create a parameter distribution. The resulting distribution is a log-normal distribution, with meanlog=log(THETA) and sdlog=sqrt(OMEGA).
ParameterDistribution(model, theta, omega = NULL)ParameterDistribution(model, theta, omega = NULL)
model |
model |
theta |
corresponding THETA name, character |
omega |
corresponding OMEGA name, character, NULL if not defined |
a parameter distribution
Prediction Interval (PI) Campsis table class
Prediction interval output function class.
variablevariable(s) used to compute the prediction interval, character vector
stratanamed vector with the strata to use
pi_levelPI level, default is 0.9 (90% PI)
Create a prediction interval output function
PIOutfun( variable, strata = get_default_strata(), level = 0.9, name = sprintf("pi_%s_%i%%", paste0(variable, collapse = "_"), round(level * 100)) )PIOutfun( variable, strata = get_default_strata(), level = 0.9, name = sprintf("pi_%s_%i%%", paste0(variable, collapse = "_"), round(level * 100)) )
variable |
variable(s) used to compute the prediction interval, character vector |
strata |
named vector with the strata to use, default is c(SCENARIO="all", ARM="all") |
level |
PI level, default is 0.9 (90% PI) |
name |
name of the output function. Default is 'pi_<variable>_<level>pc'. |
a pi_outfun object
Create progress settings.
Progress(tick_slice = TRUE)Progress(tick_slice = TRUE)
tick_slice |
tick() is called after each simulated slice, default is TRUE. In some cases, when the number of subjects per slice is low, it may be useful disable this flag, to improve performance issues. |
progress settings
Progress settings class.
tick_slicetick() is called after each simulated slice, default is TRUE. In some cases, when the number of subjects per slice is low, it may be useful disable this flag, to improve performance issues.
'Repeat at' schedule class.
timestimes at which the event is repeated, numeric vector
Repeat schedule.
repeat_schedule(x, schedule) ## S4 method for signature 'numeric,cyclic_schedule' repeat_schedule(x, schedule) ## S4 method for signature 'numeric,repeat_at_schedule' repeat_schedule(x, schedule) ## S4 method for signature 'numeric,undefined_schedule' repeat_schedule(x, schedule)repeat_schedule(x, schedule) ## S4 method for signature 'numeric,cyclic_schedule' repeat_schedule(x, schedule) ## S4 method for signature 'numeric,repeat_at_schedule' repeat_schedule(x, schedule) ## S4 method for signature 'numeric,undefined_schedule' repeat_schedule(x, schedule)
x |
object to repeat the schedule |
schedule |
initial times vector |
resulting times vector
'Repeat at' schedule constructor. Note that the time 0 for the base pattern will be added by default if not provided.
RepeatAtSchedule(times)RepeatAtSchedule(times)
times |
times at which the original schedule must be repeated, numeric vector |
a 'repeat-at' schedule
Repeated schedule class. See this class as an interface.
Create a replace action.
ReplaceAction(object)ReplaceAction(object)
object |
replacement object |
a replace action
Retrieve the parameter value (standardized) for the specified parameter name.
retrieve_parameter_value(model, paramName, default = NULL, mandatory = FALSE)retrieve_parameter_value(model, paramName, default = NULL, mandatory = FALSE)
model |
model |
paramName |
parameter name |
default |
default value if not found |
mandatory |
must be in model or not |
the standardized parameter value or the given default value if not found
Sample generic object.
sample(object, n, ...) ## S4 method for signature 'constant_distribution,integer' sample(object, n) ## S4 method for signature 'fixed_distribution,integer' sample(object, n) ## S4 method for signature 'function_distribution,integer' sample(object, n) ## S4 method for signature 'bootstrap_distribution,integer' sample(object, n) ## S4 method for signature 'bolus,integer' sample(object, n, ...) ## S4 method for signature 'infusion,integer' sample(object, n, ...) ## S4 method for signature 'observations,integer' sample(object, n, ...) ## S4 method for signature 'covariate,integer' sample(object, n) ## S4 method for signature 'bootstrap,integer' sample(object, n)sample(object, n, ...) ## S4 method for signature 'constant_distribution,integer' sample(object, n) ## S4 method for signature 'fixed_distribution,integer' sample(object, n) ## S4 method for signature 'function_distribution,integer' sample(object, n) ## S4 method for signature 'bootstrap_distribution,integer' sample(object, n) ## S4 method for signature 'bolus,integer' sample(object, n, ...) ## S4 method for signature 'infusion,integer' sample(object, n, ...) ## S4 method for signature 'observations,integer' sample(object, n, ...) ## S4 method for signature 'covariate,integer' sample(object, n) ## S4 method for signature 'bootstrap,integer' sample(object, n)
object |
generic object |
n |
number of samples required |
... |
extra arguments |
sampling result
Scatter plot (S3 generic).
scatter_plot(x, ...)scatter_plot(x, ...)
x |
a Campsis output object |
... |
additional arguments passed to the method |
a ggplot object
Plots one or two variables against each other at a given time point, from a
std_campsis_tbl (the default output of simulate() when no
custom outfun is used).
## S3 method for class 'std_campsis_tbl' scatter_plot(x, variable = "CONC", colour = "auto", time = NULL, ...)## S3 method for class 'std_campsis_tbl' scatter_plot(x, variable = "CONC", colour = "auto", time = NULL, ...)
x |
a |
variable |
character vector of length 1 or 2 giving the column name(s)
to plot. Defaults to |
colour |
stratification for point colour. One of |
time |
numeric vector of time point(s) to filter to before plotting.
When |
... |
additional arguments (currently unused, reserved for future use) |
When a single variable is supplied it is plotted on the x-axis with y fixed to 0, producing a 1-D strip chart. When two variables are supplied the first is mapped to x and the second to y.
Colour stratification is resolved as follows:
"auto" (default): ARM is added when more than one
distinct arm is detected in the data; SCENARIO is added when
more than one distinct scenario is detected.
NULL: no colour mapping.
character vector: explicit column name(s) to colour by (forwarded
directly to scatterPlot).
a ggplot object
Create an scenario.
Scenario(name = NULL, model = NULL, dataset = NULL)Scenario(name = NULL, model = NULL, dataset = NULL)
name |
scenario name, single character string |
model |
either a Campsis model, a function or lambda-style formula |
dataset |
either a Campsis dataset, a function or lambda-style formula |
a new scenario
Scenario class.
namescenario name, single character string
modeleither a Campsis model, a function or lambda-style formula
dataseteither a Campsis dataset, a function or lambda-style formula
actionslist of actions to apply
enabledis the scenario enabled in the simulation, logical value
Create a list of scenarios.
Scenarios(json = NULL)Scenarios(json = NULL)
json |
path to JSON scenarios file or JSON content in string form |
a scenarios object
Convert seconds to hours.
seconds(x)seconds(x)
x |
numeric vector in seconds |
numeric vector in hours
Set the label.
set_label(object, x) ## S4 method for signature 'arm,character' set_label(object, x) ## S4 method for signature 'dataset,character' set_label(object, x)set_label(object, x) ## S4 method for signature 'arm,character' set_label(object, x) ## S4 method for signature 'dataset,character' set_label(object, x)
object |
any object that has a label |
x |
the new label |
the updated object
Set the number of subjects.
set_subjects(object, x) ## S4 method for signature 'arm,integer' set_subjects(object, x) ## S4 method for signature 'dataset,integer' set_subjects(object, x)set_subjects(object, x) ## S4 method for signature 'arm,integer' set_subjects(object, x) ## S4 method for signature 'dataset,integer' set_subjects(object, x)
object |
any object |
x |
the new number of subjects |
the updated object
Create advanced simulation settings.
Settings(..., json = NULL)Settings(..., json = NULL)
... |
any user-required settings: see ?Hardware, ?Solver, ?NOCB, ?Declare, ?Progress or ?AutoReplicationSettings |
json |
path to JSON settings file or JSON content in string form |
advanced simulation settings
Setup default plan for the given simulation or hardware settings. This plan will prioritise the distribution of workers in the following order: 1) Replicates (if 'replicate_parallel' is enabled) 2) Scenarios (if 'scenario_parallel' is enabled) 3) Dataset export / slices (if 'dataset_export' or 'slice_parallel' is enabled)
setup_plan_default(object)setup_plan_default(object)
object |
simulation or hardware settings |
nothing
Setup plan as sequential (i.e. no parallelisation).
setup_plan_sequential()setup_plan_sequential()
nothing
Shaded plot / prediction interval plot (S3 generic).
shaded_plot(x, ...)shaded_plot(x, ...)
x |
a Campsis output object |
... |
additional arguments passed to the method |
a ggplot object
Plots a median line with a prediction interval ribbon from a
std_campsis_tbl (the default output of simulate() when no
custom outfun is used).
## S3 method for class 'std_campsis_tbl' shaded_plot( x, variable = "CONC", colour = "auto", strat_extra = NULL, level = 0.9, alpha = 0.25, ... )## S3 method for class 'std_campsis_tbl' shaded_plot( x, variable = "CONC", colour = "auto", strat_extra = NULL, level = 0.9, alpha = 0.25, ... )
x |
a |
variable |
name of the column to summarise on the y-axis. Defaults to
|
colour |
stratification for line and ribbon colour. One of
|
strat_extra |
additional column name(s) used for stratification in the
prediction interval computation but not mapped to colour — useful
when combined with |
level |
prediction interval level. Default is |
alpha |
transparency of the ribbon. Default is |
... |
additional arguments (currently unused, reserved for future use) |
Colour stratification is resolved as follows:
"auto" (default): ARM is added when more than one
distinct arm is detected in the data; SCENARIO is added when
more than one distinct scenario is detected.
NULL: no colour mapping.
character vector: explicit column name(s) to colour/fill by
(forwarded directly to shadedPlot).
a ggplot object
Simulate function.
simulate( model, dataset, dest = NULL, events = NULL, scenarios = NULL, tablefun = NULL, outvars = NULL, outfun = NULL, seed = NULL, replicates = NULL, dosing = FALSE, settings = NULL ) ## S4 method for signature ## 'replicated_campsis_model, ## dataset, ## character, ## events, ## scenarios, ## function, ## character, ## outfuns, ## integer, ## integer, ## logical, ## simulation_settings' simulate( model, dataset, dest = NULL, events = NULL, scenarios = NULL, tablefun = NULL, outvars = NULL, outfun = NULL, seed = NULL, replicates = NULL, dosing = FALSE, settings = NULL ) ## S4 method for signature ## 'campsis_model, ## dataset, ## character, ## events, ## scenarios, ## function, ## character, ## outfuns, ## integer, ## integer, ## logical, ## simulation_settings' simulate( model, dataset, dest = NULL, events = NULL, scenarios = NULL, tablefun = NULL, outvars = NULL, outfun = NULL, seed = NULL, replicates = NULL, dosing = FALSE, settings = NULL ) ## S4 method for signature ## 'campsis_model, ## tbl_df, ## character, ## events, ## scenarios, ## function, ## character, ## outfuns, ## integer, ## integer, ## logical, ## simulation_settings' simulate( model, dataset, dest = NULL, events = NULL, scenarios = NULL, tablefun = NULL, outvars = NULL, outfun = NULL, seed = NULL, replicates = NULL, dosing = FALSE, settings = NULL ) ## S4 method for signature ## 'campsis_model, ## data.frame, ## character, ## events, ## scenarios, ## function, ## character, ## outfuns, ## integer, ## integer, ## logical, ## simulation_settings' simulate( model, dataset, dest = NULL, events = NULL, scenarios = NULL, tablefun = NULL, outvars = NULL, outfun = NULL, seed = NULL, replicates = NULL, dosing = FALSE, settings = NULL ) ## S4 method for signature ## 'campsis_model, ## tbl_df, ## rxode_engine, ## events, ## scenarios, ## function, ## character, ## outfuns, ## integer, ## integer, ## logical, ## simulation_settings' simulate( model, dataset, dest = NULL, events = NULL, scenarios = NULL, tablefun = NULL, outvars = NULL, outfun = NULL, seed = NULL, replicates = NULL, dosing = FALSE, settings = NULL ) ## S4 method for signature ## 'campsis_model, ## tbl_df, ## mrgsolve_engine, ## events, ## scenarios, ## function, ## character, ## outfuns, ## integer, ## integer, ## logical, ## simulation_settings' simulate( model, dataset, dest = NULL, events = NULL, scenarios = NULL, tablefun = NULL, outvars = NULL, outfun = NULL, seed = NULL, replicates = NULL, dosing = FALSE, settings = NULL )simulate( model, dataset, dest = NULL, events = NULL, scenarios = NULL, tablefun = NULL, outvars = NULL, outfun = NULL, seed = NULL, replicates = NULL, dosing = FALSE, settings = NULL ) ## S4 method for signature ## 'replicated_campsis_model, ## dataset, ## character, ## events, ## scenarios, ## function, ## character, ## outfuns, ## integer, ## integer, ## logical, ## simulation_settings' simulate( model, dataset, dest = NULL, events = NULL, scenarios = NULL, tablefun = NULL, outvars = NULL, outfun = NULL, seed = NULL, replicates = NULL, dosing = FALSE, settings = NULL ) ## S4 method for signature ## 'campsis_model, ## dataset, ## character, ## events, ## scenarios, ## function, ## character, ## outfuns, ## integer, ## integer, ## logical, ## simulation_settings' simulate( model, dataset, dest = NULL, events = NULL, scenarios = NULL, tablefun = NULL, outvars = NULL, outfun = NULL, seed = NULL, replicates = NULL, dosing = FALSE, settings = NULL ) ## S4 method for signature ## 'campsis_model, ## tbl_df, ## character, ## events, ## scenarios, ## function, ## character, ## outfuns, ## integer, ## integer, ## logical, ## simulation_settings' simulate( model, dataset, dest = NULL, events = NULL, scenarios = NULL, tablefun = NULL, outvars = NULL, outfun = NULL, seed = NULL, replicates = NULL, dosing = FALSE, settings = NULL ) ## S4 method for signature ## 'campsis_model, ## data.frame, ## character, ## events, ## scenarios, ## function, ## character, ## outfuns, ## integer, ## integer, ## logical, ## simulation_settings' simulate( model, dataset, dest = NULL, events = NULL, scenarios = NULL, tablefun = NULL, outvars = NULL, outfun = NULL, seed = NULL, replicates = NULL, dosing = FALSE, settings = NULL ) ## S4 method for signature ## 'campsis_model, ## tbl_df, ## rxode_engine, ## events, ## scenarios, ## function, ## character, ## outfuns, ## integer, ## integer, ## logical, ## simulation_settings' simulate( model, dataset, dest = NULL, events = NULL, scenarios = NULL, tablefun = NULL, outvars = NULL, outfun = NULL, seed = NULL, replicates = NULL, dosing = FALSE, settings = NULL ) ## S4 method for signature ## 'campsis_model, ## tbl_df, ## mrgsolve_engine, ## events, ## scenarios, ## function, ## character, ## outfuns, ## integer, ## integer, ## logical, ## simulation_settings' simulate( model, dataset, dest = NULL, events = NULL, scenarios = NULL, tablefun = NULL, outvars = NULL, outfun = NULL, seed = NULL, replicates = NULL, dosing = FALSE, settings = NULL )
model |
generic Campsis model |
dataset |
Campsis dataset or 2-dimensional table |
dest |
destination simulation engine, default is 'RxODE' |
events |
interruption events |
scenarios |
list of scenarios to be simulated |
tablefun |
function or lambda formula to apply on exported 2-dimensional dataset |
outvars |
variables to output in resulting dataframe |
outfun |
an output function to apply on the simulation results. Type ?Outfun for more info. |
seed |
seed value |
replicates |
number of replicates, default is 1 |
dosing |
output dosing information, default is FALSE |
settings |
advanced simulation settings |
dataframe with all results
Simulation progress class.
replicatestotal number of replicates to simulate
scenariostotal number of scenarios to simulate
iterationstotal number of iterations to simulate
slicestotal number of slices to simulate
replicatecurrent replicate number being simulated
scenariocurrent scenario number being simulated
iterationcurrent iteration number being simulated
slicecurrent slice number being simulated
progressorprogressr progressor
hardwarehardware settings
Simulation settings class.
defaultdefault settings of the simulate method
hardwarehardware settings object
solversolver settings object
nocbNOCB settings object
declaredeclare settings (mrgsolve only)
progressprogress settings
replicationreplication settings
internalinternal settings
Create a simulation progress object.
SimulationProgress( replicates = 1, scenarios = 1, progressor = NULL, hardware = NULL )SimulationProgress( replicates = 1, scenarios = 1, progressor = NULL, hardware = NULL )
replicates |
total number of replicates to simulate |
scenarios |
total number of scenarios to simulate |
progressor |
progressr progressor |
hardware |
hardware settings |
a progress bar
Create solver settings.
Solver( atol = 1e-08, rtol = 1e-08, hmax = NA, maxsteps = 70000L, method = "liblsoda" )Solver( atol = 1e-08, rtol = 1e-08, hmax = NA, maxsteps = 70000L, method = "liblsoda" )
atol |
absolute solver tolerance, default is 1e-08 |
rtol |
relative solver tolerance, default is 1e-08 |
hmax |
limit how big a solver step can be, default is NA |
maxsteps |
max steps between 2 integration times (e.g. when observations records are far apart), default is 70000 |
method |
solver method, for rxode2 only: 'liblsoda' (default), 'lsoda', 'dop853', 'indLin'. Mrgsolve's method is always 'lsoda'. |
solver settings
Solver settings class. See ?mrgsolve::update. See ?rxode2::rxSolve.
atolabsolute solver tolerance, default is 1e-08
rtolrelative solver tolerance, default is 1e-08
hmaxlimit how big a solver step can be, default is NA
maxstepsmax steps between 2 integration times (e.g. when observations records are far apart), default is 70000
methodsolver method, for rxode2 only: 'liblsoda' (default), 'lsoda', 'dop853', 'indLin'. Mrgsolve's method is always 'lsoda'.
Spaghetti plot (S3 generic).
spaghetti_plot(x, ...)spaghetti_plot(x, ...)
x |
a Campsis output object |
... |
additional arguments passed to the method |
a ggplot object
Plots individual-level time profiles from a std_campsis_tbl (the
default output of simulate() when no custom outfun is used).
## S3 method for class 'std_campsis_tbl' spaghetti_plot(x, variable = "CONC", colour = "auto", ...)## S3 method for class 'std_campsis_tbl' spaghetti_plot(x, variable = "CONC", colour = "auto", ...)
x |
a |
variable |
name of the column to plot on the y-axis. Defaults to
|
colour |
stratification for line colour. One of |
... |
additional arguments (currently unused, reserved for future use) |
Colour stratification is resolved as follows:
"auto" (default): ARM is added when more than one
distinct arm is detected in the data; SCENARIO is added when
more than one distinct scenario is detected.
NULL: no colour mapping.
character vector: explicit column name(s) to colour by (forwarded
directly to spaghettiPlot).
a ggplot object
Standardise time to hours.
standardise_time(x, unit)standardise_time(x, unit)
x |
numeric time vector |
unit |
unit of x, single character value |
numeric vector with the times converted to hours
Statistics output function class.
variablevariable(s) used to compute the statistics, character vector
stratanamed vector with the strata to use
statscharacter vector of statistics to compute
Create a statistics output function
StatsOutfun( variable, strata = get_default_strata(), stats = c("p5", "median", "p95"), name = sprintf("stats_%s", paste0(variable, collapse = "_")) )StatsOutfun( variable, strata = get_default_strata(), stats = c("p5", "median", "p95"), name = sprintf("stats_%s", paste0(variable, collapse = "_")) )
variable |
variable(s) used to compute the statistics, character vector |
strata |
named vector with the strata to use, default is c(SCENARIO="all", ARM="all") |
stats |
character vector of statistics to compute. Supported: "median", "mean", or percentiles like "p5", "p95", "p2.5", "p97.5". Default is c("p5", "median", "p95"). |
name |
name of the output function. Default is 'stats_<variable>'. |
a stats_outfun object
Instantiate a new time sequence.
TimeSequence(start, end, by)TimeSequence(start, end, by)
start |
starting value |
end |
maximal value |
by |
increment of the sequence |
a sequence
Create a time-varying covariate. This covariate will be implemented using EVID=2 rows in the exported dataset and will not use interruption events.
TimeVaryingCovariate(name, table)TimeVaryingCovariate(name, table)
name |
covariate name, character |
table |
data.frame, must contain the mandatory columns 'TIME' and 'VALUE'. An 'ID' column may also be specified. In that case, ID's between 1 and the max number of subjects in the dataset/arm can be used. All ID's must have a VALUE defined for TIME 0. |
a time-varying covariate
Instantiate a new time vector
TimeVector(x)TimeVector(x)
x |
time vector, numeric |
a time vector
Undefined distribution class. This type of object is automatically created in method to_explicit_distribution() when the user does not provide a concrete distribution. This is because S4 objects do not accept NULL values.
Create an uniform distribution.
UniformDistribution(min, max)UniformDistribution(min, max)
min |
min value |
max |
max value |
an uniform distribution
Unwrap treatment.
unwrap_treatment(object) ## S4 method for signature 'bolus' unwrap_treatment(object) ## S4 method for signature 'infusion' unwrap_treatment(object) ## S4 method for signature 'bolus_wrapper' unwrap_treatment(object) ## S4 method for signature 'infusion_wrapper' unwrap_treatment(object) ## S4 method for signature 'treatment' unwrap_treatment(object) ## S4 method for signature 'arm' unwrap_treatment(object) ## S4 method for signature 'arms' unwrap_treatment(object) ## S4 method for signature 'dataset' unwrap_treatment(object)unwrap_treatment(object) ## S4 method for signature 'bolus' unwrap_treatment(object) ## S4 method for signature 'infusion' unwrap_treatment(object) ## S4 method for signature 'bolus_wrapper' unwrap_treatment(object) ## S4 method for signature 'infusion_wrapper' unwrap_treatment(object) ## S4 method for signature 'treatment' unwrap_treatment(object) ## S4 method for signature 'arm' unwrap_treatment(object) ## S4 method for signature 'arms' unwrap_treatment(object) ## S4 method for signature 'dataset' unwrap_treatment(object)
object |
any object |
updated object
Update the number of additional doses (ADDL).
update_addl(object, addl, ref = NULL) ## S4 method for signature 'bolus_wrapper,integer,character' update_addl(object, addl, ref = NULL) ## S4 method for signature 'infusion_wrapper,integer,character' update_addl(object, addl, ref = NULL) ## S4 method for signature 'bolus,integer,character' update_addl(object, addl, ref = NULL) ## S4 method for signature 'infusion,integer,character' update_addl(object, addl, ref = NULL) ## S4 method for signature 'treatment,integer,character' update_addl(object, addl, ref = NULL) ## S4 method for signature 'arm,integer,character' update_addl(object, addl, ref = NULL) ## S4 method for signature 'arms,integer,character' update_addl(object, addl, ref = NULL) ## S4 method for signature 'dataset,integer,character' update_addl(object, addl, ref = NULL)update_addl(object, addl, ref = NULL) ## S4 method for signature 'bolus_wrapper,integer,character' update_addl(object, addl, ref = NULL) ## S4 method for signature 'infusion_wrapper,integer,character' update_addl(object, addl, ref = NULL) ## S4 method for signature 'bolus,integer,character' update_addl(object, addl, ref = NULL) ## S4 method for signature 'infusion,integer,character' update_addl(object, addl, ref = NULL) ## S4 method for signature 'treatment,integer,character' update_addl(object, addl, ref = NULL) ## S4 method for signature 'arm,integer,character' update_addl(object, addl, ref = NULL) ## S4 method for signature 'arms,integer,character' update_addl(object, addl, ref = NULL) ## S4 method for signature 'dataset,integer,character' update_addl(object, addl, ref = NULL)
object |
generic object |
addl |
new number of additional doses |
ref |
reference treatment name |
updated object
Update amount.
update_amount(object, amount, ref) ## S4 method for signature 'bolus,numeric,character' update_amount(object, amount, ref) ## S4 method for signature 'infusion,numeric,character' update_amount(object, amount, ref) ## S4 method for signature 'bolus_wrapper,numeric,character' update_amount(object, amount, ref) ## S4 method for signature 'infusion_wrapper,numeric,character' update_amount(object, amount, ref) ## S4 method for signature 'treatment,numeric,character' update_amount(object, amount, ref) ## S4 method for signature 'arm,numeric,character' update_amount(object, amount, ref) ## S4 method for signature 'arms,numeric,character' update_amount(object, amount, ref) ## S4 method for signature 'dataset,numeric,character' update_amount(object, amount, ref)update_amount(object, amount, ref) ## S4 method for signature 'bolus,numeric,character' update_amount(object, amount, ref) ## S4 method for signature 'infusion,numeric,character' update_amount(object, amount, ref) ## S4 method for signature 'bolus_wrapper,numeric,character' update_amount(object, amount, ref) ## S4 method for signature 'infusion_wrapper,numeric,character' update_amount(object, amount, ref) ## S4 method for signature 'treatment,numeric,character' update_amount(object, amount, ref) ## S4 method for signature 'arm,numeric,character' update_amount(object, amount, ref) ## S4 method for signature 'arms,numeric,character' update_amount(object, amount, ref) ## S4 method for signature 'dataset,numeric,character' update_amount(object, amount, ref)
object |
generic object |
amount |
new amount |
ref |
reference treatment name |
updated object
Update the inter-dose interval (II).
update_ii(object, ii, ref = NULL) ## S4 method for signature 'bolus_wrapper,numeric,character' update_ii(object, ii, ref = NULL) ## S4 method for signature 'infusion_wrapper,numeric,character' update_ii(object, ii, ref = NULL) ## S4 method for signature 'bolus,numeric,character' update_ii(object, ii, ref = NULL) ## S4 method for signature 'infusion,numeric,character' update_ii(object, ii, ref = NULL) ## S4 method for signature 'treatment,numeric,character' update_ii(object, ii, ref = NULL) ## S4 method for signature 'arm,numeric,character' update_ii(object, ii, ref = NULL) ## S4 method for signature 'arms,numeric,character' update_ii(object, ii, ref = NULL) ## S4 method for signature 'dataset,numeric,character' update_ii(object, ii, ref = NULL)update_ii(object, ii, ref = NULL) ## S4 method for signature 'bolus_wrapper,numeric,character' update_ii(object, ii, ref = NULL) ## S4 method for signature 'infusion_wrapper,numeric,character' update_ii(object, ii, ref = NULL) ## S4 method for signature 'bolus,numeric,character' update_ii(object, ii, ref = NULL) ## S4 method for signature 'infusion,numeric,character' update_ii(object, ii, ref = NULL) ## S4 method for signature 'treatment,numeric,character' update_ii(object, ii, ref = NULL) ## S4 method for signature 'arm,numeric,character' update_ii(object, ii, ref = NULL) ## S4 method for signature 'arms,numeric,character' update_ii(object, ii, ref = NULL) ## S4 method for signature 'dataset,numeric,character' update_ii(object, ii, ref = NULL)
object |
generic object |
ii |
new inter-dose interval |
ref |
reference treatment name |
updated object
Update the repeat field (argument 'rep' in Bolus and Infusion constructors).
update_repeat(object, rep, ref = NULL) ## S4 method for signature 'bolus_wrapper,repeated_schedule,character' update_repeat(object, rep, ref = NULL) ## S4 method for signature 'infusion_wrapper,repeated_schedule,character' update_repeat(object, rep, ref = NULL) ## S4 method for signature 'bolus,repeated_schedule,character' update_repeat(object, rep, ref = NULL) ## S4 method for signature 'infusion,repeated_schedule,character' update_repeat(object, rep, ref = NULL) ## S4 method for signature 'treatment,repeated_schedule,character' update_repeat(object, rep, ref = NULL) ## S4 method for signature 'arm,repeated_schedule,character' update_repeat(object, rep, ref = NULL) ## S4 method for signature 'arms,repeated_schedule,character' update_repeat(object, rep, ref = NULL) ## S4 method for signature 'dataset,repeated_schedule,character' update_repeat(object, rep, ref = NULL)update_repeat(object, rep, ref = NULL) ## S4 method for signature 'bolus_wrapper,repeated_schedule,character' update_repeat(object, rep, ref = NULL) ## S4 method for signature 'infusion_wrapper,repeated_schedule,character' update_repeat(object, rep, ref = NULL) ## S4 method for signature 'bolus,repeated_schedule,character' update_repeat(object, rep, ref = NULL) ## S4 method for signature 'infusion,repeated_schedule,character' update_repeat(object, rep, ref = NULL) ## S4 method for signature 'treatment,repeated_schedule,character' update_repeat(object, rep, ref = NULL) ## S4 method for signature 'arm,repeated_schedule,character' update_repeat(object, rep, ref = NULL) ## S4 method for signature 'arms,repeated_schedule,character' update_repeat(object, rep, ref = NULL) ## S4 method for signature 'dataset,repeated_schedule,character' update_repeat(object, rep, ref = NULL)
object |
generic object |
rep |
repeated dosing schedule (definition) object |
ref |
reference treatment name |
updated object
VPC plot (S3 generic).
vpc_plot(x, ...)vpc_plot(x, ...)
x |
a Campsis output object |
... |
additional arguments passed to the method |
a ggplot object
Plots VPC ribbons (a confidence interval around the median, lower and upper
percentiles) from a pi_campsis_tbl, i.e. the output of
simulate() with multiple replicates and a PIOutfun.
Such data already contains the per-replicate prediction interval in long
format (columns replicate, TIME, metric with values
"low" / "med" / "up" and value). This method
only needs to compute the confidence interval around each percentile across
replicates.
## S3 method for class 'pi_campsis_tbl' vpc_plot(x, strata = "auto", level = 0.9, alpha = 0.15, facet = TRUE, ...)## S3 method for class 'pi_campsis_tbl' vpc_plot(x, strata = "auto", level = 0.9, alpha = 0.15, facet = TRUE, ...)
x |
a |
strata |
stratification for the VPC. One of |
level |
confidence interval level for the ribbons around each
percentile. Default is |
alpha |
transparency of the ribbons. Default is |
facet |
how the stratification variable is displayed when present.
|
... |
additional arguments (currently unused, reserved for future use) |
Stratification is resolved as follows:
"auto" (default): ARM is used when more than one
distinct arm is detected; otherwise SCENARIO is used when
more than one distinct scenario is detected; otherwise NULL
(no stratification). Only one stratification variable is applied
because vpcPlot supports at most one.
NULL: no stratification.
named character vector: passed directly to vpcPlot
(e.g. c(ARM = "all") or c(SCENARIO = "all")).
a ggplot object
Plots VPC ribbons (a confidence interval around the median, lower and upper
percentiles) from a std_campsis_tbl, i.e. the default output of
simulate() with multiple replicates and no custom outfun
(DefaultOutfun). In this case the data contains all
unsummarised individual profiles, so the per-replicate prediction interval
is computed first (the lower/median/upper percentiles of variable
across individuals within each replicate), before the confidence interval
around each percentile is computed across replicates.
## S3 method for class 'std_campsis_tbl' vpc_plot( x, variable = "CONC", strata = "auto", pi_level = 0.9, ci_level = 0.9, alpha = 0.15, facet = TRUE, ... )## S3 method for class 'std_campsis_tbl' vpc_plot( x, variable = "CONC", strata = "auto", pi_level = 0.9, ci_level = 0.9, alpha = 0.15, facet = TRUE, ... )
x |
a |
variable |
name of the column to summarise on the y-axis. Defaults to
|
strata |
stratification for the VPC. One of |
pi_level |
prediction interval level, i.e. the percentiles of the data
computed within each replicate. Default is |
ci_level |
confidence interval level for the ribbons around each
percentile across replicates. Default is |
alpha |
transparency of the ribbons. Default is |
facet |
how the stratification variable is displayed when present.
|
... |
additional arguments (currently unused, reserved for future use) |
Stratification is resolved as follows:
"auto" (default): ARM is used when more than one
distinct arm is detected; otherwise SCENARIO is used when
more than one distinct scenario is detected; otherwise NULL
(no stratification). Only one stratification variable is applied
because vpcPlot supports at most one.
NULL: no stratification.
named character vector: passed directly to vpcPlot
(e.g. c(ARM = "all") or c(SCENARIO = "all")).
a ggplot object
vpcPlot, vpc_plot.pi_campsis_tbl
Convert weeks to hours.
weeks(x)weeks(x)
x |
numeric vector in weeks |
numeric vector in hours
Convert pharma years (1 year = 12*4 weeks) to hours.
years(x)years(x)
x |
numeric vector in years |
numeric vector in hours