| Type: | Package |
| Title: | Generic PK/PD Simulation Platform Campsis |
| Version: | 1.9.0 |
| 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). |
| License: | GPL (≥ 3) |
| URL: | https://github.com/Calvagone/campsis, https://calvagone.github.io/, https://calvagone.github.io/campsis.doc/ |
| BugReports: | https://github.com/Calvagone/campsis/issues |
| Depends: | campsismod, R (≥ 4.1.0) |
| Imports: | assertthat, digest, dplyr, furrr, future, ggplot2, jsonlite, jsonvalidate, lifecycle, MASS, methods, progressr, purrr, rlang, stats, tibble, tidyr, vctrs |
| Suggests: | bookdown, devtools, gridExtra, knitr, mrgsolve, pkgdown, rmarkdown, roxygen2, rxode2, stringr, testthat, tictoc, vdiffr, xfun |
| VignetteBuilder: | knitr |
| Encoding: | UTF-8 |
| Language: | en-US |
| LazyData: | true |
| Collate: | 'all_classes.R' 'global.R' 'utilities.R' 'time_utilities.R' 'check.R' 'generic.R' 'data.R' 'seed.R' 'distribution.R' 'dataset_config.R' 'time_vector.R' 'time_entry.R' 'repeated_schedule.R' 'occasion.R' 'occasions.R' 'treatment_iov.R' 'treatment_iovs.R' 'dose_adaptation.R' 'dose_adaptations.R' 'treatment_entry.R' 'treatment.R' 'observations.R' 'observations_set.R' 'covariate.R' 'covariates.R' 'bootstrap.R' 'protocol.R' 'arm.R' 'arms.R' 'event.R' 'events.R' 'simulation_engine.R' 'dataset.R' 'scenario_action.R' 'scenario_actions.R' 'scenario.R' 'scenarios.R' 'event_logic.R' 'dataset_summary.R' 'outfun_core.R' 'outfun.R' 'outfuns.R' 'default_settings.R' 'hardware_settings.R' 'simulation_progress.R' 'solver_settings.R' 'nocb_settings.R' 'declare_settings.R' 'progress_settings.R' 'internal_settings.R' 'simulation_settings.R' 'campsis_metadata.R' 'plan_setup.R' 'json_interface.R' 'simulate_preprocess.R' 'simulate.R' 'default_plot.R' 'campsis_plot_helpers.R' 'spaghetti_plot.R' 'shaded_plot.R' 'scatter_plot.R' 'vpc_plot.R' 'deprecated_methods.R' |
| Config/roxygen2/version: | 8.0.0 |
| NeedsCompilation: | no |
| Packaged: | 2026-08-05 07:27:18 UTC; nicolas |
| Author: | Nicolas Luyckx [aut, cre] |
| Maintainer: | Nicolas Luyckx <nicolas.luyckx@calvagone.com> |
| Repository: | CRAN |
| Date/Publication: | 2026-08-05 07:50:02 UTC |
Assert that one or more variable columns are present in the data.
Description
Raises an informative error listing all absent column names.
Usage
.assert_variable_present(x, variable)
Arguments
x |
a data frame |
variable |
character vector of column name(s) to check |
Value
invisibly NULL; called for its side-effect
Detect colour stratification columns automatically.
Description
Adds "ARM" when the column exists and contains more than one distinct
value. Same logic for "SCENARIO".
Usage
.auto_colour_columns(x)
Arguments
x |
a data frame (typically |
Value
a character vector of column names to colour by, or NULL
Detect VPC stratification variable automatically.
Description
Returns a named character vector suitable for vpcPlot's
strata argument (length 0 or 1), or NULL when no
stratification is warranted. ARM is preferred over SCENARIO
when both are multi-valued.
Usage
.auto_strata(x)
Arguments
x |
a data frame (typically |
Value
a named character vector or NULL
Does the data contain more than one replicate?
Description
Does the data contain more than one replicate?
Usage
.is_replicated(x)
Arguments
x |
a data frame (typically |
Value
TRUE if the data contains a replicate column with more than one distinct value, FALSE otherwise
Create a treatment arm.
Description
Create a treatment arm.
Usage
Arm(id = as.integer(NA), subjects = 1, label = as.character(NA))
Arguments
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. |
Value
an arm
Binomial distribution.
Description
Binomial distribution.
Usage
BinomialDistribution(trials, prob)
Arguments
trials |
number of Bernoulli trials per observation (=subject), integer |
prob |
probability of success for each trial |
Value
a binomial distribution
Create one or several bolus(es).
Description
Create one or several bolus(es).
Usage
Bolus(
time,
amount,
compartment = NULL,
f = NULL,
lag = NULL,
ii = NULL,
addl = NULL,
wrap = TRUE,
ref = NULL,
rep = NULL
)
Arguments
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). |
Value
a single bolus or a list of boluses
Create a bootstrap object.
Description
Create a bootstrap object.
Usage
Bootstrap(
data,
id = "BS_ID",
replacement = FALSE,
random = FALSE,
export_id = FALSE
)
Arguments
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 |
Value
a bootstrap object
Create a bootstrap distribution. During function sampling, Campsis will generate values depending on the given data and arguments.
Description
Create a bootstrap distribution. During function sampling, Campsis will generate values depending on the given data and arguments.
Usage
BootstrapDistribution(data, replacement = FALSE, random = FALSE)
Arguments
data |
values to draw, numeric vector |
replacement |
values can be reused or not, logical |
random |
values are drawn randomly, logical |
Value
a bootstrap distribution
Create a constant distribution. Its value will be constant across all generated samples.
Description
Create a constant distribution. Its value will be constant across all generated samples.
Usage
ConstantDistribution(value)
Arguments
value |
covariate value, single numeric value |
Value
a constant distribution (same value for all samples)
Create a non time-varying (fixed) covariate.
Description
Create a non time-varying (fixed) covariate.
Usage
Covariate(name, distribution)
Arguments
name |
covariate name, single character value |
distribution |
covariate distribution |
Value
a fixed covariate
Cyclic schedule constructor.
Description
Cyclic schedule constructor.
Usage
CyclicSchedule(duration, repetitions)
Arguments
duration |
duration of the cycle, numeric value |
repetitions |
number of additional repetitions to the base pattern, integer value |
Value
a cyclic schedule
Create a dataset.
Description
Create a dataset.
Usage
Dataset(subjects = NULL, label = as.character(NA), json = NULL)
Arguments
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 |
Value
a dataset
Create a dataset configuration. This configuration allows Campsis to know which are the default depot and observed compartments.
Description
Create a dataset configuration. This configuration allows Campsis to know which are the default depot and observed compartments.
Usage
DatasetConfig(
defDepotCmt = 1,
defObsCmt = 1,
exportTSLD = FALSE,
exportTDOS = FALSE,
timeUnitDataset = "hour",
timeUnitExport = "hour"
)
Arguments
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) |
Value
a dataset configuration
Create a dataset summary (internal method).
Description
Create a dataset summary (internal method).
Usage
DatasetSummary()
Value
a dataset summary
Create declare settings.
Description
Create declare settings.
Usage
Declare(variables = character(0))
Arguments
variables |
uninitialized variables to be declared, only needed with mrgsolve |
Value
Declare settings
Default output function (identity function).
Description
Default output function (identity function).
Usage
DefaultOutfun()
Value
an output function that returns the Campsis results as is.
Create default settings.
Description
Create default settings.
Usage
DefaultSettings(
engine = NULL,
seed = NULL,
replicates = 1L,
outvars = character(),
outfuns = Outfuns(),
disabled_variabilities = character(),
dosing = FALSE
)
Arguments
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 |
Value
default settings
Discrete distribution.
Description
Discrete distribution.
Usage
DiscreteDistribution(x, prob, replace = TRUE)
Arguments
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 |
Value
a discrete distribution
Create a dose adaptation.
Description
Create a dose adaptation.
Usage
DoseAdaptation(formula, compartments = NULL)
Arguments
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) |
Value
a fixed covariate
Dosing schedule constructor.
Description
Dosing schedule constructor.
Usage
DosingSchedule()
Value
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).
Description
Create an ETA distribution. The resulting distribution is a normal distribution, with mean=0 and sd=sqrt(OMEGA).
Usage
EtaDistribution(model, omega)
Arguments
model |
model |
omega |
corresponding THETA name, character |
Value
an ETA distribution
Create an interruption event.
Description
Create an interruption event.
Usage
Event(name = NULL, times, fun, debug = FALSE)
Arguments
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 |
Value
an event definition
Create an event covariate. These covariates can be modified further in interruption events.
Description
Create an event covariate. These covariates can be modified further in interruption events.
Usage
EventCovariate(name, distribution)
Arguments
name |
covariate name, character |
distribution |
covariate distribution at time 0 |
Value
a time-varying covariate
Create an event iteration object.
Description
Create an event iteration object.
Usage
EventIteration(index, start, end, inits = data.frame(), maxIndex)
Arguments
index |
iteration index, starts at 1 |
start |
iteration start time |
end |
iteration end time |
inits |
initial values for all subjects, data frame |
maxIndex |
the last iteration index |
Value
an event iteration object
Create an event-related observations list. Please note that the provided 'times' will automatically be sorted. Duplicated times will be removed.
Description
Create an event-related observations list. Please note that the provided 'times' will automatically be sorted. Duplicated times will be removed.
Usage
EventRelatedObservations(times, compartment = NA)
Arguments
times |
observation times, numeric vector |
compartment |
compartment index, integer |
Value
observations
Create a list of interruption events.
Description
Create a list of interruption events.
Usage
Events()
Value
a events object
Create a fixed distribution. Each sample will be assigned a fixed value coming from vector 'values'.
Description
Create a fixed distribution. Each sample will be assigned a fixed value coming from vector 'values'.
Usage
FixedDistribution(values)
Arguments
values |
covariate values, numeric vector (1 value per sample) |
Value
a fixed distribution (1 value per sample)
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")).
Description
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")).
Usage
FunctionDistribution(fun, args)
Arguments
fun |
function name, character (e.g. 'rnorm') |
args |
list of arguments (e.g list(mean=70, sd=10)) |
Value
a function distribution
Create hardware settings.
Description
Create hardware settings.
Usage
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
)
Arguments
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. |
Value
hardware settings
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.
Description
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.
Usage
IOV(colname, distribution, doseNumbers = NULL)
Arguments
colname |
name of the column that will be output in dataset |
distribution |
distribution |
doseNumbers |
dose numbers, if provided, IOV is generated at these doses only. By default, IOV is generated for all doses. |
Value
an IOV object
Create one or several infusion(s).
Description
Create one or several infusion(s).
Usage
Infusion(
time,
amount,
compartment = NULL,
f = NULL,
lag = NULL,
duration = NULL,
rate = NULL,
ii = NULL,
addl = NULL,
wrap = TRUE,
ref = NULL,
rep = NULL
)
Arguments
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). |
Value
a single infusion or a list of infusions.
Create a log normal distribution.
Description
Create a log normal distribution.
Usage
LogNormalDistribution(meanlog, sdlog)
Arguments
meanlog |
mean value of distribution in log domain |
sdlog |
standard deviation of distribution in log domain |
Value
a log normal distribution
Create a NCA table output function
Description
Create a NCA table output function
Usage
NCATableOutfun(table, export_type = "summary", name = "default_nca_table")
Arguments
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'. |
Value
a stats_outfun object
Create NOCB settings.
Description
Create NOCB settings.
Usage
NOCB(enable = NULL, variables = character(0))
Arguments
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) |
Value
NOCB settings
Create a normal distribution.
Description
Create a normal distribution.
Usage
NormalDistribution(mean, sd)
Arguments
mean |
mean value of distribution |
sd |
standard deviation of distribution |
Value
a normal distribution
Create an observations list. Please note that the provided 'times' will automatically be sorted. Duplicated times will be removed.
Description
Create an observations list. Please note that the provided 'times' will automatically be sorted. Duplicated times will be removed.
Usage
Observations(times, compartment = NA, rep = NULL)
Arguments
times |
observation times, numeric vector |
compartment |
compartment index (integer) or name (character) |
rep |
repetition schedule |
Value
an observations list
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.
Description
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.
Usage
Occasion(colname, values, doseNumbers)
Arguments
colname |
name of the column that will be output in dataset |
values |
the occasion numbers, any integer vector |
doseNumbers |
the related dose numbers, any integer vector of same length as 'values' |
Value
occasion object
Create a new output function
Description
Create a new output function
Usage
Outfun(
fun = function(x, ...) {
x
},
args = list(),
packages = NULL,
level = "replicate",
name = "custom"
)
Arguments
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'. |
Value
an output function
Create a collection of output functions.
Description
Create a collection of output functions.
Usage
Outfuns()
Value
an output_functions object
Compute the prediction interval summary over time (deprecated).
Description
Compute the prediction interval summary over time (deprecated).
Usage
PI(x, variable, strata = get_default_strata(), level = 0.9)
Arguments
x |
data frame |
variable |
variable(s) used to compute the prediction interval, character vector.
When more than one variable is supplied, a |
strata |
named vector with the strata to use, default is c(SCENARIO="all", ARM="all").
Only columns that are actually present in |
level |
PI level, default is 0.9 (90% PI) |
Value
a summary table
Create a prediction interval output function
Description
Create a prediction interval output function
Usage
PIOutfun(
variable,
strata = get_default_strata(),
level = 0.9,
name = sprintf("pi_%s_%i%%", paste0(variable, collapse = "_"), round(level * 100))
)
Arguments
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'. |
Value
a pi_outfun object
Create a parameter distribution. The resulting distribution is a log-normal distribution, with meanlog=log(THETA) and sdlog=sqrt(OMEGA).
Description
Create a parameter distribution. The resulting distribution is a log-normal distribution, with meanlog=log(THETA) and sdlog=sqrt(OMEGA).
Usage
ParameterDistribution(model, theta, omega = NULL)
Arguments
model |
model |
theta |
corresponding THETA name, character |
omega |
corresponding OMEGA name, character, NULL if not defined |
Value
a parameter distribution
Create progress settings.
Description
Create progress settings.
Usage
Progress(tick_slice = TRUE)
Arguments
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. |
Value
progress settings
'Repeat at' schedule constructor. Note that the time 0 for the base pattern will be added by default if not provided.
Description
'Repeat at' schedule constructor. Note that the time 0 for the base pattern will be added by default if not provided.
Usage
RepeatAtSchedule(times)
Arguments
times |
times at which the original schedule must be repeated, numeric vector |
Value
a 'repeat-at' schedule
Create a replace action.
Description
Create a replace action.
Usage
ReplaceAction(object)
Arguments
object |
replacement object |
Value
a replace action
Create an scenario.
Description
Create an scenario.
Usage
Scenario(name = NULL, model = NULL, dataset = NULL)
Arguments
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 |
Value
a new scenario
Create a list of scenarios.
Description
Create a list of scenarios.
Usage
Scenarios(json = NULL)
Arguments
json |
path to JSON scenarios file or JSON content in string form |
Value
a scenarios object
Create advanced simulation settings.
Description
Create advanced simulation settings.
Usage
Settings(..., json = NULL)
Arguments
... |
any user-required settings: see ?Hardware, ?Solver, ?NOCB, ?Declare, ?Progress or ?AutoReplicationSettings |
json |
path to JSON settings file or JSON content in string form |
Value
advanced simulation settings
Create a simulation progress object.
Description
Create a simulation progress object.
Usage
SimulationProgress(
replicates = 1,
scenarios = 1,
progressor = NULL,
hardware = NULL
)
Arguments
replicates |
total number of replicates to simulate |
scenarios |
total number of scenarios to simulate |
progressor |
progressr progressor |
hardware |
hardware settings |
Value
a progress bar
Create solver settings.
Description
Create solver settings.
Usage
Solver(
atol = 1e-08,
rtol = 1e-08,
hmax = NA,
maxsteps = 70000L,
method = "liblsoda"
)
Arguments
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'. |
Value
solver settings
Create a statistics output function
Description
Create a statistics output function
Usage
StatsOutfun(
variable,
strata = get_default_strata(),
stats = c("p5", "median", "p95"),
name = sprintf("stats_%s", paste0(variable, collapse = "_"))
)
Arguments
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>'. |
Value
a stats_outfun object
Instantiate a new time sequence.
Description
Instantiate a new time sequence.
Usage
TimeSequence(start, end, by)
Arguments
start |
starting value |
end |
maximal value |
by |
increment of the sequence |
Value
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.
Description
Create a time-varying covariate. This covariate will be implemented using EVID=2 rows in the exported dataset and will not use interruption events.
Usage
TimeVaryingCovariate(name, table)
Arguments
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. |
Value
a time-varying covariate
Instantiate a new time vector
Description
Instantiate a new time vector
Usage
TimeVector(x)
Arguments
x |
time vector, numeric |
Value
a time vector
Create an uniform distribution.
Description
Create an uniform distribution.
Usage
UniformDistribution(min, max)
Arguments
min |
min value |
max |
max value |
Value
an uniform distribution
Apply some action on the given object.
Description
Apply some action on the given object.
Usage
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)
Arguments
object |
any object |
action |
action to apply |
Value
updated object
Apply compartment characteristics from model. In practice, only compartment infusion duration needs to be applied.
Description
Apply compartment characteristics from model. In practice, only compartment infusion duration needs to be applied.
Usage
apply_compartment_characteristics(table, properties)
Arguments
table |
current dataset |
properties |
compartment properties from model |
Value
updated dataset
Apply output function(s) on the given Campsis results.
Description
Apply output function(s) on the given Campsis results.
Usage
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, ...)
Arguments
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) |
Value
the updated Campsis results
Apply scenario to the given model or dataset.
Description
Apply scenario to the given model or dataset.
Usage
apply_scenario(x, scenario)
Arguments
x |
the given model or dataset |
scenario |
the scenario to be applied |
Value
an updated model or dataset
Arm class.
Description
Arm class.
Slots
idarm unique ID, integer
subjectsnumber of subjects in arm, integer
labelarm label, single character string
protocolprotocol
covariatescovariates
bootstrapcovariates to be bootstrapped
Arms class.
Description
Arms class.
Time sequence to numeric vector.
Description
Time sequence to numeric vector.
Usage
## S4 method for signature 'time_sequence'
as.numeric(x)
Arguments
x |
time sequence object |
Value
a numeric vector
Time vector to numeric vector.
Description
Time vector to numeric vector.
Usage
## S4 method for signature 'time_vector'
as.numeric(x)
Arguments
x |
time vector object |
Value
a numeric vector
Assign dose number to each treatment entry.
Description
Assign dose number to each treatment entry.
Usage
assign_dose_number(object)
Arguments
object |
treatment |
Value
updated treatment object
Binomial distribution class.
Description
Binomial distribution class.
Bolus class.
Description
Bolus class.
Bolus wrapper class.
Description
Bolus wrapper class.
Bootstrap class.
Description
Bootstrap class.
Slots
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
Bootstrap distribution class.
Description
Bootstrap distribution class.
Slots
datavalues to draw, numeric vector
replacementvalues can be reused or not, logical
randomvalues are drawn randomly, logical
Suggested Campsis handler for showing the progress bar.
Description
Suggested Campsis handler for showing the progress bar.
Usage
campsis_handler()
Value
a progressr handler list
Campsis metadata class.
Description
Campsis metadata class.
Slots
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)
Description
Campsis table class (see this class as an interface)
Check ii and addl arguments in addition to time.
Description
Check ii and addl arguments in addition to time.
Usage
check_ii_and_addl(time, ii, addl)
Arguments
time |
treatment time(s) |
ii |
interdose interval |
addl |
number of additional doses |
Value
no return value
Compute incremental progress.
Description
Compute incremental progress.
Usage
compute_incremental_progress(object, tick_slice)
Arguments
object |
simulation progress object |
tick_slice |
tick progress on slices |
Value
incremental progress, in percentage
Compute the prediction interval summary over time.
Description
Compute the prediction interval summary over time.
Usage
compute_pi(x, variable, strata = get_default_strata(), level = 0.9)
Arguments
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) |
Value
a summary table
Compute generic statistics over time.
Description
Compute generic statistics over time.
Usage
compute_stats(
x,
variable,
strata = get_default_strata(),
stats = c("p5", "median", "p95")
)
Arguments
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". |
Value
a summary table in long format
Constant distribution class.
Description
Constant distribution class.
Slots
valuecovariate value, single numeric value
Convert numeric time vector based on the provided units.
Description
'r lifecycle::badge("deprecated")'
Usage
convertTime(x, from, to)
Arguments
x |
numeric time vector |
from |
unit of x, single character value |
to |
destination unit, single character value |
Details
'convertTime()' is deprecated in favor of 'convert_time()'.
Value
numeric vector with the converted times
Convert numeric time vector based on the provided units.
Description
Convert numeric time vector based on the provided units.
Usage
convert_time(x, from, to)
Arguments
x |
numeric time vector |
from |
unit of x, single character value |
to |
destination unit, single character value |
Value
numeric vector with the converted times
Counter-balance LOCF mode for occasions & IOV. This function will simply shift all the related occasion & IOV columns to the left (by one).
Description
Counter-balance LOCF mode for occasions & IOV. This function will simply shift all the related occasion & IOV columns to the left (by one).
Usage
counterBalanceLocfMode(table, columnNames)
Arguments
table |
current table |
columnNames |
columns to be counter-balanced |
Value
2-dimensional dataset
Counter-balance NOCB mode for occasions & IOV. This function will simply shift all the related occasion & IOV columns to the right (by one).
Description
Counter-balance NOCB mode for occasions & IOV. This function will simply shift all the related occasion & IOV columns to the right (by one).
Usage
counterBalanceNocbMode(table, columnNames)
Arguments
table |
current table |
columnNames |
columns to be counter-balanced |
Value
2-dimensional dataset
Covariate class.
Description
Covariate class.
Slots
namecovariate name, single character value
distributioncovariate distribution
Covariates class.
Description
Covariates class.
Cut table according to given iteration.
Description
Cut table according to given iteration.
Usage
cutTableForEvent(table, iteration, summary)
Arguments
table |
whole table, data frame |
iteration |
current iteration being processed |
summary |
dataset summary |
Value
a data frame
Cyclic schedule class.
Description
Cyclic schedule class.
Slots
durationduration of the cycle, numeric value
repetitionsnumber of additional repetitions to the base pattern, integer value
Dataset class.
Description
Dataset class.
Slots
armsa list of treatment arms
configdataset configuration for export
iivdata frame containing the inter-individual variability (all ETAS) for the export
Dataset configuration class.
Description
Dataset configuration class.
Slots
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)
Convert days to hours.
Description
Convert days to hours.
Usage
days(x)
Arguments
x |
numeric vector in days |
Value
numeric vector in hours
Declare settings class.
Description
Declare settings class.
Slots
variablesuninitialized variables to be declared, only needed with mrgsolve
Default output function class.
Description
Default output function class.
Default settings class.
Description
Default settings class.
Slots
engineSimulation engine:
'rxode2'or'mrgsolve'. Default isNULL(unspecified). IfNULL,'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
Discrete distribution class.
Description
Discrete distribution class.
Distribution class. See this class as an interface.
Description
Distribution class. See this class as an interface.
Dose adaptation class.
Description
Dose adaptation class.
Slots
formulaformula to apply, single character string, e.g. "AMT*WT"
compartmentscompartment numbers where the formula needs to be applied
Dose adaptations class.
Description
Dose adaptations class.
Filter Campsis output on dosing rows.
Description
Filter Campsis output on dosing rows.
Usage
dosing_only(x)
Arguments
x |
data frame, Campsis output |
Value
a data frame with the dosing rows
Dosing schedule class.
Description
Dosing schedule class.
Return the 'DROP_OTHERS' string that may be used in the 'outvars' vector for RxODE/mrgsolve to drop all others variables that are usually output in the resulting data frame.
Description
Return the 'DROP_OTHERS' string that may be used in the 'outvars' vector for RxODE/mrgsolve to drop all others variables that are usually output in the resulting data frame.
Usage
drop_others()
Value
a character value
Event class.
Description
Event class.
Slots
nameevent name, character value
timesinterruption times, numeric vector
funevent function to apply at each interruption
debugoutput the variables that were changed through this event
Event covariate class.
Description
Event covariate class.
Events class.
Description
Events class.
Export delegate method. This method is common to RxODE and mrgsolve.
Description
Export delegate method. This method is common to RxODE and mrgsolve.
Usage
export_delegate(object, dest, model, arm_offset = NULL, offset_within_arm = 0)
Arguments
object |
current dataset |
dest |
destination engine |
model |
Campsis model, if provided, ETA's will be added to the dataset |
arm_offset |
arm offset (on ID's) to apply when parallelisation is used. Default value is NULL, meaning parallelisation is disabled. Otherwise, it corresponds to the offset to apply for the current arm being exported (in parallel). |
offset_within_arm |
offset (on ID's) to apply within the current arm being exported (only used when parallelisation is enabled), default is 0 |
Value
2-dimensional dataset, same for RxODE and mrgsolve
Export table delegate.
Description
Export table delegate.
Usage
export_table_delegate(model, dataset, dest, events, seed, tablefun, settings)
Arguments
model |
generic Campsis model |
dataset |
Campsis dataset or 2-dimensional table |
dest |
destination simulation engine, default is 'RxODE' |
events |
interruption events |
seed |
seed value |
tablefun |
function or lambda formula to apply on exported 2-dimensional dataset |
settings |
advanced simulation settings |
Value
a data frame
Fill IOV/Occasion columns.
Description
Problem in RxODE (LOCF mode) / mrgsolve (LOCF mode), if 2 rows have the same time (often: OBS then DOSE), first row covariate value is taken! Workaround: identify these rows (group by ID and TIME) and apply a fill in the UP direction.
Usage
fillIOVOccColumns(table, columnNames, downDirectionFirst)
Arguments
table |
current table |
columnNames |
the column names to fill |
downDirectionFirst |
TRUE: first fill down then fill up (by ID & TIME). FALSE: First fill up (by ID & TIME), then fill down |
Value
2-dimensional dataset
Fixed covariate class.
Description
Fixed covariate class.
Fixed distribution class.
Description
Fixed distribution class.
Slots
valuescovariate values, numeric vector (1 value per sample)
Function distribution class.
Description
Function distribution class.
Slots
funfunction name, character (e.g. 'rnorm')
argslist of arguments (e.g list(mean=70, sd=10))
Generate IIV matrix for the given Campsis model.
Description
Generate IIV matrix for the given Campsis model.
Usage
generate_iiv(model, n, offset = 0)
Arguments
model |
Campsis model |
n |
number of subjects |
offset |
if specified, resulting ID will be ID + offset |
Value
IIV data frame with ID column
Generate IIV matrix for the given OMEGA matrix.
Description
Generate IIV matrix for the given OMEGA matrix.
Usage
generate_iiv_(omega, n)
Arguments
omega |
omega matrix |
n |
number of subjects |
Value
IIV data frame
Get dataset max time.
Description
Get dataset max time.
Usage
getDatasetMaxTime(dataset)
Arguments
dataset |
dataset |
Value
max time of dataset, whatever its form, 2-dimensional or structured
Get list of event iterations.
Description
Get list of event iterations.
Usage
getEventIterations(events, dataset)
Arguments
events |
events |
dataset |
dataset, Campsis dataset or data frame |
Value
a list of event iterations. Note: start and end slots have the same unit as the 'exported' dataset time.
Get all time-varying variables. These variables are likely to be influenced by the NOCB mode chosen and by the 'nocbvars' vector.
Description
Get all time-varying variables. These variables are likely to be influenced by the NOCB mode chosen and by the 'nocbvars' vector.
Usage
getTimeVaryingVariables(object)
Arguments
object |
dataset |
Value
character vector with all time-varying variables of the dataset
Return the list of available time units.
Description
Return the list of available time units.
Usage
get_available_time_units()
Value
character vector
Get Campsis option logic.
Description
Get Campsis option logic.
Usage
get_campsis_option(name, default)
Arguments
name |
option to search |
default |
default value if option not found |
Value
option value
Get the Campsis options (R options).
Description
Get the Campsis options (R options).
Usage
get_campsis_options()
Value
global options for Campsis
Get data of given column unless if does not exist (return NULL in that case).
Description
Get data of given column unless if does not exist (return NULL in that case).
Usage
get_column(.data, colname)
Arguments
.data |
data frame |
colname |
column name |
Value
a vector
Get a mapping table with all possibilities of compartment names and their indexes knowing that compartment names can be provided as character or as integer.
Description
Get a mapping table with all possibilities of compartment names and their indexes knowing that compartment names can be provided as character or as integer.
Usage
get_compartment_mapping(compartments)
Arguments
compartments |
list of compartments |
Value
a tibble with two columns: INDEX and NAME
Get all covariates (fixed / time-varying / event covariates).
Description
Get all covariates (fixed / time-varying / event covariates).
Usage
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)
Arguments
object |
any object |
Value
all covariates from object
Get all event-related covariates.
Description
Get all event-related covariates.
Usage
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)
Arguments
object |
any object |
Value
all event-related covariates from object
Get all fixed covariates.
Description
Get all fixed covariates.
Usage
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)
Arguments
object |
any object |
Value
all fixed covariates from object
Get initial conditions at simulation start-up.
Description
Get initial conditions at simulation start-up.
Usage
get_initial_conditions(subdataset, iteration, cmtNames)
Arguments
subdataset |
subset of the dataset to simulate |
iteration |
current iteration |
cmtNames |
compartment names |
Value
named numeric vector with the new initial conditions
Get all IOV objects.
Description
Get all IOV objects.
Usage
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)
Arguments
object |
any object |
Value
all IOV's from object
Get all occasions.
Description
Get all occasions.
Usage
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)
Arguments
object |
any object |
Value
all occasions from object
Get random seed value.
Description
Get random seed value.
Usage
get_random_seed_value()
Value
random seed value generated based on time
Get seed value.
Description
Get seed value.
Usage
get_seed(seed = NULL)
Arguments
seed |
user-input seed. If NULL or NA, seed number will be random. |
Value
a seed value, integer
Get seed for dataset export.
Description
Get seed for dataset export.
Usage
get_seed_for_dataset_export(seed, progress)
Arguments
seed |
original seed |
progress |
simulation progress |
Value
the seed value used to export the dataset
Get seed for iteration.
Description
Get seed for iteration.
Usage
get_seed_for_iteration(seed, progress)
Arguments
seed |
original seed |
progress |
simulation progress |
Value
the seed value to be used for the given replicate number and iteration
Get seed for parameter uncertainty sampling.
Description
Get seed for parameter uncertainty sampling.
Usage
get_seed_for_parameters_sampling(seed)
Arguments
seed |
original seed |
Value
the seed value used to sample parameter uncertainty
Get simulation engine type.
Description
Get simulation engine type.
Usage
get_simulation_engine_type(dest)
Arguments
dest |
destination engine, string form |
Value
simulation engine type
Get splitting configuration for parallel export.
Description
Get splitting configuration for parallel export.
Usage
get_splitting_configuration(dataset, hardware)
Arguments
dataset |
Campsis dataset to export |
hardware |
hardware configuration |
Value
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.
Description
Get all time-varying covariates.
Usage
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)
Arguments
object |
any object |
Value
all time-varying covariates from object
Get all distinct times for the specified object.
Description
Get all distinct times for the specified object.
Usage
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)
Arguments
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 |
Value
numeric vector with all unique times, sorted
Hardware settings class.
Description
Hardware settings class.
Slots
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).
Description
Convert hours to hours (do nothing).
Usage
hours(x)
Arguments
x |
numeric vector in hours |
Value
numeric vector in hours
Import the whole campsismod package into NAMESPACE when parsed by 'roxygen'.
Description
Import the whole campsismod package into NAMESPACE when parsed by 'roxygen'.
Usage
import_campsismod_to_namespace()
Value
always TRUE
Infusion class.
Description
Infusion class.
Slots
durationinfusion duration, distribution list
rateinfusion rate, distribution list
Infusion wrapper class.
Description
Infusion wrapper class.
Internal settings class (transient object from the simulation settings).
Description
Internal settings class (transient object from the simulation settings).
Slots
dataset_summarydataset summary
progresssimulation progress
iterationslist of event iterations
Is the given bootstrap empty.
Description
Is the given bootstrap empty.
Usage
is_empty_bootstrap(object)
Arguments
object |
bootstrap object |
Value
logical value TRUE/FALSE
JSON to Campsis dataset.
Description
JSON to Campsis dataset.
Usage
json_to_campsis_dataset(object, json)
Arguments
object |
empty dataset |
json |
json element |
Value
Campsis dataset
JSON to Campsis dataset.
Description
JSON to Campsis dataset.
Usage
json_to_campsis_settings(object, json)
Arguments
object |
empty dataset |
json |
json element |
Value
Campsis dataset
Left-join IIV matrix.
Description
Left-join IIV matrix.
Usage
left_join_iiv(table, iiv)
Arguments
table |
dataset, tabular form |
iiv |
IIV matrix |
Value
updated table with IIV matrix
Return the number of subjects contained in this arm.
Description
Return the number of subjects contained in this arm.
Usage
## S4 method for signature 'arm'
length(x)
Arguments
x |
arm |
Value
a number
Return the number of repetition cycles.
Description
Return the number of repetition cycles.
Usage
## S4 method for signature 'cyclic_schedule'
length(x)
Arguments
x |
schedule object |
Value
a number
Return the number of subjects contained in this dataset.
Description
Return the number of subjects contained in this dataset.
Usage
## S4 method for signature 'dataset'
length(x)
Arguments
x |
dataset |
Value
a number
Return the number of repetition cycles.
Description
Return the number of repetition cycles.
Usage
## S4 method for signature 'repeat_at_schedule'
length(x)
Arguments
x |
schedule object |
Value
a number
Log normal distribution class.
Description
Log normal distribution class.
Make the VPC summary. Input data frame must contain the following columns: - replicate: replicate number - low: low percentile value in replicate (and in scenario if present) - med: median value in replicate (and in scenario if present) - up: up percentile value in replicate (and in scenario if present) - any scenario column
Description
Make the VPC summary. Input data frame must contain the following columns: - replicate: replicate number - low: low percentile value in replicate (and in scenario if present) - med: median value in replicate (and in scenario if present) - up: up percentile value in replicate (and in scenario if present) - any scenario column
Usage
make_vpc_summary(x, strata = NULL, level = 0.9)
Arguments
x |
data frame, with metric |
strata |
named vector with the strata to use, default is c(SCENARIO="all", ARM="all").
Only columns that are actually present in |
level |
PI level, default is 0.9 (90% PI) |
Value
VPC summary with columns TIME, stratification variables and all combinations of low, med, up (i.e. low_low, low_med, low_up, etc.)
Merge time-varying covariates into a single data frame. This last data frame will be merged afterwards with all treatment and observation rows.
Description
Merge time-varying covariates into a single data frame. This last data frame will be merged afterwards with all treatment and observation rows.
Usage
mergeTimeVaryingCovariates(covariates, ids_within_arm, arm_offset)
Arguments
covariates |
covariates, only time-varying covariates will be extracted |
ids_within_arm |
ids within the current arm being sampled |
arm_offset |
arm offset (in term of ID's) |
Value
a data.frame
Convert minutes to hours.
Description
Convert minutes to hours.
Usage
minutes(x)
Arguments
x |
numeric vector in minutes |
Value
numeric vector in hours
Convert pharma months (1 month = 4 weeks) to hours.
Description
Convert pharma months (1 month = 4 weeks) to hours.
Usage
months(x)
Arguments
x |
numeric vector in months |
Value
numeric vector in hours
mrgsolve engine class.
Description
mrgsolve engine class.
NCA table output function class.
Description
NCA table output function class.
Slots
tableCampsisnca table object
export_typetype of export, 'summary', 'summary_wide', 'summary_pretty', 'individual' or 'individual_wide'
NHANES database (demographics and body measure data combined, from 2017-2018).
Description
NHANES database (demographics and body measure data combined, from 2017-2018).
Usage
nhanes
Format
data frame
- BS_ID
Original identifier
- SEX
Sex: 1 for males, 2 for females
- AGE
Age in years
- BW
Body weight in kg
- BMI
Body mass index
- HT
Height in cm
Source
https://wwwn.cdc.gov/Nchs/Nhanes/2017-2018/DEMO_J.XPT
https://wwwn.cdc.gov/Nchs/Nhanes/2017-2018/BMX_J.XPT
NOCB settings class.
Description
NOCB settings class.
Slots
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)
Normal distribution class.
Description
Normal distribution class.
Filter Campsis output on observation rows.
Description
Filter Campsis output on observation rows.
Usage
obs_only(x)
Arguments
x |
data frame, Campsis output |
Value
a data frame with the observation rows
Observations class.
Description
Observations class.
Slots
timesany object that implements
compartmentcompartment index (integer) or name (character)
dvobserved values, numeric vector (FOR EXTERNAL USE)
reprepetition schedule
Observations set class.
Description
Observations set class.
Occasion class.
Description
Occasion class.
Slots
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
Occasions class.
Description
Occasions class.
Check if the current session is on CI (e.g. GitHub actions).
Description
Check if the current session is on CI (e.g. GitHub actions).
Usage
on_ci()
Value
logical value TRUE/FALSE
Check if the current session is on CRAN. The objective is to potentially suppress long tasks to be run on CRAN (long tests or vignettes).
Description
Check if the current session is on CRAN. The objective is to potentially suppress long tasks to be run on CRAN (long tests or vignettes).
Usage
on_cran()
Value
logical value TRUE/FALSE
Open JSON file.
Description
Open JSON file.
Usage
open_json(json, schema = NULL)
Arguments
json |
JSON in its string form or path to JSON file |
schema |
JSON schema |
Value
parsed JSON object
Output function class.
Description
Output function class.
Slots
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
Output functions class (i.e. a collection of output functions).
Description
Output functions class (i.e. a collection of output functions).
Prediction Interval (PI) Campsis table class
Description
Prediction Interval (PI) Campsis table class
Prediction interval output function class.
Description
Prediction interval output function class.
Slots
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)
Preprocess 'nocbvars' argument.
Description
Preprocess 'nocbvars' argument.
Usage
preprocessNocbvars(nocbvars)
Arguments
nocbvars |
nocbvars argument, character vector |
Preprocess TSLD and TDOS columns according to given dataset configuration.
Description
Preprocess TSLD and TDOS columns according to given dataset configuration.
Usage
preprocessTSLDAndTDOSColumn(table, config)
Arguments
table |
current table |
config |
dataset config |
Value
updated table
Preprocess ARM column. Add ARM equation in model automatically.
Description
Preprocess ARM column. Add ARM equation in model automatically.
Usage
preprocess_arm_column(dataset, model)
Arguments
dataset |
current dataset, data frame form |
model |
model |
Value
updated model
Pre-process destination engine. Throw an error message if the destination engine is not installed.
Description
Pre-process destination engine. Throw an error message if the destination engine is not installed.
Usage
preprocess_dest(dest)
Arguments
dest |
destination engine (from simulate argument, default settings or S4 simulation engine) |
Value
'rxode2' or 'mrgsolve'
Preprocess 'dosing' argument.
Description
Preprocess 'dosing' argument.
Usage
preprocess_dosing(dosing)
Arguments
dosing |
dosing argument, logical value |
Value
user value, if not specified, return FALSE (observations only)
Pre-process events.
Description
Pre-process events.
Usage
preprocess_events(events)
Arguments
events |
interruption events |
Preprocess subjects ID's.
Description
Preprocess subjects ID's.
Usage
preprocess_ids(dataset)
Arguments
dataset |
current dataset, data frame form |
Value
list of consecutive ID's
Pre-process outfun argument.
Description
Pre-process outfun argument.
Usage
preprocess_outfun(outfun)
Arguments
outfun |
function, lambda formula, 'outfun' or 'outfuns' object |
Value
an 'outfuns' object in any case
Preprocess 'outvars' argument. 'Outvars' is a character vector which tells Campsis the mandatory columns to keep in the output dataframe.
Description
Preprocess 'outvars' argument. 'Outvars' is a character vector which tells Campsis the mandatory columns to keep in the output dataframe.
Usage
preprocess_outvars(outvars)
Arguments
outvars |
character vector or function |
Value
outvars
Preprocess 'replicates' argument.
Description
Preprocess 'replicates' argument.
Usage
preprocess_replicates(replicates, model)
Arguments
replicates |
number of replicates |
model |
Campsis model (class 'campsis_model' or 'replicated_campsis_model') |
Value
number of replicates to simulate
Pre-process scenarios.
Description
Pre-process scenarios.
Usage
preprocess_scenarios(scenarios)
Arguments
scenarios |
scenarios |
Preprocess the simulation settings.
Description
Preprocess the simulation settings.
Usage
preprocess_settings(settings, dest)
Arguments
settings |
simulation settings |
dest |
destination engine |
Value
updated simulation settings
Preprocess 'slices' argument.
Description
Preprocess 'slices' argument.
Usage
preprocess_slices(slices, maxID)
Arguments
slices |
slices argument corresponding to the number of subjects simulated at once |
Value
slices if not NULL, otherwise total number of subjects
Pre-process tablefun argument.
Description
Pre-process tablefun argument.
Usage
preprocess_tablefun(fun)
Arguments
fun |
function or lambda formula |
Value
a function in any case
Process time-related columns according to given dataset configuration.
Description
Process time-related columns according to given dataset configuration.
Usage
processAllTimeColumns(table, config)
Arguments
table |
current table |
config |
dataset config |
Value
updated table
Process arm labels. Arm identifiers in ARM column are replaced by arm labels as soon as one arm label is provided.
Description
Process arm labels. Arm identifiers in ARM column are replaced by arm labels as soon as one arm label is provided.
Usage
process_arm_labels(campsis, arms)
Arguments
campsis |
Campsis output |
arms |
all treatment arms |
Value
updated Campsis output with arm labels instead of arm identifiers
Process 'DROP_OTHERS'.
Description
Process 'DROP_OTHERS'.
Usage
process_drop_others(x, outvars = character(0), drop_others)
Arguments
x |
the current data frame |
outvars |
variables to keep |
drop_others |
logical value |
Value
processed data frame
Preprocess arguments of the simulate method.
Description
Preprocess arguments of the simulate method.
Usage
process_simulate_arguments(model, dataset, dest, outvars, dosing, settings)
Arguments
model |
Campsis model |
dataset |
dataset, data.frame form |
dest |
destination engine |
outvars |
outvars |
dosing |
add dosing information, logical value |
settings |
simulation settings |
Value
a simulation configuration
Progress settings class.
Description
Progress settings class.
Slots
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.
Protocol class.
Description
Protocol class.
Remove initial conditions.
Description
Remove initial conditions.
Usage
remove_initial_conditions(model)
Arguments
model |
Campsis model |
Value
same model without initial conditions
Reorder output columns.
Description
Reorder output columns.
Usage
reorder_columns(results, dosing)
Arguments
results |
RxODE/mrgsolve output |
dosing |
dosing information, logical value |
Value
reordered dataframe
'Repeat at' schedule class.
Description
'Repeat at' schedule class.
Slots
timestimes at which the event is repeated, numeric vector
Repeat schedule.
Description
Repeat schedule.
Usage
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)
Arguments
x |
object to repeat the schedule |
schedule |
initial times vector |
Value
resulting times vector
Repeated schedule class. See this class as an interface.
Description
Repeated schedule class. See this class as an interface.
Replace action class.
Description
Replace action class.
Retrieve the parameter value (standardized) for the specified parameter name.
Description
Retrieve the parameter value (standardized) for the specified parameter name.
Usage
retrieve_parameter_value(model, paramName, default = NULL, mandatory = FALSE)
Arguments
model |
model |
paramName |
parameter name |
default |
default value if not found |
mandatory |
must be in model or not |
Value
the standardized parameter value or the given default value if not found
rxode2 engine class.
Description
rxode2 engine class.
Sample generic object.
Description
Sample generic object.
Usage
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)
Arguments
object |
generic object |
n |
number of samples required |
... |
extra arguments |
Value
sampling result
Sample time-varying covariates.
Description
Sample time-varying covariates.
Usage
sampleTimeVaryingCovariates(object, armID, needsDV)
Arguments
object |
time-varying covariates, data.frame form |
armID |
treatment arm ID |
needsDV |
append extra column DV, logical value |
Value
a data.frame
Sample covariates list.
Description
Sample covariates list.
Usage
sample_covariates_list(covariates, ids_within_arm, subset)
Arguments
covariates |
list of covariates to sample |
ids_within_arm |
ids within the current arm being sampled |
subset |
take subset of original values because export is parallelised |
Value
a dataframe of n rows, 1 column per covariate
Sample a distribution and return a tibble.
Description
Sample a distribution and return a tibble.
Usage
sample_distribution_as_tibble(distribution, n, colname)
Arguments
distribution |
any distribution |
n |
number of desired samples |
colname |
name of the unique column in tibble |
Value
a tibble of n rows and 1 column
Scatter plot (or X vs Y plot).
Description
Scatter plot (or X vs Y plot).
Usage
scatterPlot(x, variable, colour = NULL, time = NULL)
Arguments
x |
data frame |
variable |
the 2 variables to show, character vector |
colour |
variable(s) to colour |
time |
the time to look at those 2 variables, if NULL, min time is used (usually 0) |
Value
a ggplot object
Scatter plot (S3 generic).
Description
Scatter plot (S3 generic).
Usage
scatter_plot(x, ...)
Arguments
x |
a Campsis output object |
... |
additional arguments passed to the method |
Value
a ggplot object
Scatter plot for standard Campsis simulation output.
Description
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).
Usage
## S3 method for class 'std_campsis_tbl'
scatter_plot(x, variable = "CONC", colour = "auto", time = NULL, ...)
Arguments
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) |
Details
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):ARMis added when more than one distinct arm is detected in the data;SCENARIOis 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).
Value
a ggplot object
See Also
Scenario class.
Description
Scenario class.
Slots
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
Scenario action class.
Description
Scenario action class.
Scenario actions class.
Description
Scenario actions class.
Scenarios class.
Description
Scenarios class.
Convert seconds to hours.
Description
Convert seconds to hours.
Usage
seconds(x)
Arguments
x |
numeric vector in seconds |
Value
numeric vector in hours
Set the label.
Description
'r lifecycle::badge("deprecated")'
Usage
setLabel(object, x)
Arguments
object |
any object that has a label |
x |
the new label |
Details
'setLabel()' is deprecated in favor of 'set_label()'.
Value
the updated object
Set the number of subjects.
Description
'r lifecycle::badge("deprecated")'
Usage
setSubjects(object, x)
Arguments
object |
any object |
x |
the new number of subjects |
Details
'setSubjects()' is deprecated in favor of 'set_subjects()'.
Value
the updated object
Set the label.
Description
Set the label.
Usage
set_label(object, x)
## S4 method for signature 'arm,character'
set_label(object, x)
## S4 method for signature 'dataset,character'
set_label(object, x)
Arguments
object |
any object that has a label |
x |
the new label |
Value
the updated object
Set the seed. The goal of this method is to centralize all calls to the R method 'set.seed'.
Description
Set the seed. The goal of this method is to centralize all calls to the R method 'set.seed'.
Usage
set_seed(seed)
Arguments
seed |
seed value, not NULL |
Set the number of subjects.
Description
Set the number of subjects.
Usage
set_subjects(object, x)
## S4 method for signature 'arm,integer'
set_subjects(object, x)
## S4 method for signature 'dataset,integer'
set_subjects(object, x)
Arguments
object |
any object |
x |
the new number of subjects |
Value
the updated object
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)
Description
'r lifecycle::badge("deprecated")'
Usage
setupPlanDefault(object)
Arguments
object |
simulation or hardware settings |
Details
'setupPlanDefault()' is deprecated in favor of 'setup_plan_default()'.
Value
nothing
Setup plan as sequential (i.e. no parallelisation).
Description
'r lifecycle::badge("deprecated")'
Usage
setupPlanSequential()
Details
'setupPlanSequential()' is deprecated in favor of 'setup_plan_sequential()'.
Value
nothing
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)
Description
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)
Usage
setup_plan_default(object)
Arguments
object |
simulation or hardware settings |
Value
nothing
Setup plan as sequential (i.e. no parallelisation).
Description
Setup plan as sequential (i.e. no parallelisation).
Usage
setup_plan_sequential()
Value
nothing
Shaded plot (or prediction interval plot).
Description
Shaded plot (or prediction interval plot).
Usage
shadedPlot(
x,
variable,
colour = NULL,
strat_extra = NULL,
level = 0.9,
alpha = 0.25
)
Arguments
x |
data frame |
variable |
variable to show |
colour |
variable(s) to colour |
strat_extra |
variable(s) to stratify, but not to colour (useful for use with facet_wrap) |
level |
PI level, default is 0.9 (90% PI) |
alpha |
alpha parameter (transparency) given to geom_ribbon |
Value
a ggplot object
Shaded plot / prediction interval plot (S3 generic).
Description
Shaded plot / prediction interval plot (S3 generic).
Usage
shaded_plot(x, ...)
Arguments
x |
a Campsis output object |
... |
additional arguments passed to the method |
Value
a ggplot object
Shaded plot for standard Campsis simulation output.
Description
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).
Usage
## S3 method for class 'std_campsis_tbl'
shaded_plot(
x,
variable = "CONC",
colour = "auto",
strat_extra = NULL,
level = 0.9,
alpha = 0.25,
...
)
Arguments
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) |
Details
Colour stratification is resolved as follows:
-
"auto"(default):ARMis added when more than one distinct arm is detected in the data;SCENARIOis 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).
Value
a ggplot object
See Also
Simulate function.
Description
Simulate function.
Usage
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
)
Arguments
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 |
Value
dataframe with all results
Simulation delegate (several replicates).
Description
Simulation delegate (several replicates).
Usage
simulate_delegate(
model,
dataset,
dest,
events,
scenarios,
tablefun,
outvars,
outfun,
seed,
replicates,
dosing,
settings
)
Arguments
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 |
Value
a data frame with the results
Simulation delegate core (single replicate).
Description
Simulation delegate core (single replicate).
Usage
simulate_delegate_core(
model,
dataset,
dest,
events,
tablefun,
outvars,
outfun,
seed,
replicates,
dosing,
settings
)
Arguments
model |
generic Campsis model |
dataset |
Campsis dataset or 2-dimensional table |
dest |
destination simulation engine, default is 'RxODE' |
events |
interruption events |
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 |
Value
a data frame with the results
Simulation scenarios.
Description
Simulation scenarios.
Usage
simulate_scenarios(
scenarios,
model,
dataset,
dest,
events,
tablefun,
outvars,
outfun,
seed,
replicates,
dosing,
settings
)
Arguments
scenarios |
list of scenarios to be simulated |
model |
generic Campsis model |
dataset |
Campsis dataset or 2-dimensional table |
dest |
destination simulation engine, default is 'RxODE' |
events |
interruption events |
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 |
Value
a data frame with the results
Simulation engine class.
Description
Simulation engine class.
Simulation progress class.
Description
Simulation progress class.
Slots
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.
Description
Simulation settings class.
Slots
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
Solver settings class. See ?mrgsolve::update. See ?rxode2::rxSolve.
Description
Solver settings class. See ?mrgsolve::update. See ?rxode2::rxSolve.
Slots
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.
Description
Spaghetti plot.
Usage
spaghettiPlot(x, variable, colour = NULL)
Arguments
x |
data frame |
variable |
variable to show |
colour |
variable(s) to colour |
Value
plot
Spaghetti plot (S3 generic).
Description
Spaghetti plot (S3 generic).
Usage
spaghetti_plot(x, ...)
Arguments
x |
a Campsis output object |
... |
additional arguments passed to the method |
Value
a ggplot object
Spaghetti plot for standard Campsis simulation output.
Description
Plots individual-level time profiles from a std_campsis_tbl (the
default output of simulate() when no custom outfun is used).
Usage
## S3 method for class 'std_campsis_tbl'
spaghetti_plot(x, variable = "CONC", colour = "auto", ...)
Arguments
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) |
Details
Colour stratification is resolved as follows:
-
"auto"(default):ARMis added when more than one distinct arm is detected in the data;SCENARIOis 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).
Value
a ggplot object
See Also
Split dataset according to config.
Description
Split dataset according to config.
Usage
splitDataset(dataset, config)
Arguments
dataset |
Campsis dataset to export |
config |
current iteration in future_map_dfr |
Value
a subset of the given dataset
Standardise time to hours.
Description
Standardise time to hours.
Usage
standardise_time(x, unit)
Arguments
x |
numeric time vector |
unit |
unit of x, single character value |
Value
numeric vector with the times converted to hours
Statistics Campsis table class
Description
Statistics Campsis table class
Statistics output function class.
Description
Statistics output function class.
Slots
variablevariable(s) used to compute the statistics, character vector
stratanamed vector with the strata to use
statscharacter vector of statistics to compute
Standard Campsis table class
Description
Standard Campsis table class
Time sequence class.
Description
Time sequence class.
Time-varying covariate class.
Description
Time-varying covariate class.
Time vector class.
Description
Time vector class.
Convert dataset to dataset summary (internal method).
Description
Convert dataset to dataset summary (internal method).
Usage
toDatasetSummary(dataset)
Value
a dataset summary
Convert user-given distribution to an explicit Campsis distribution. Passed distribution can be: - a NULL value. In that case, it will be converted into an 'UndefinedDistribution'. - a single numeric value. In that case, it will be converted into a 'ConstantDistribution'. - a numeric vector. In that case, it will be converted into a 'FixedDistribution'. - all available types of distribution. In this case, no conversion is applied.
Description
Convert user-given distribution to an explicit Campsis distribution. Passed distribution can be: - a NULL value. In that case, it will be converted into an 'UndefinedDistribution'. - a single numeric value. In that case, it will be converted into a 'ConstantDistribution'. - a numeric vector. In that case, it will be converted into a 'FixedDistribution'. - all available types of distribution. In this case, no conversion is applied.
Usage
to_explicit_distribution(distribution)
Arguments
distribution |
user-given distribution |
Value
a distribution object
Treatment class.
Description
Treatment class.
Treatment IOV class.
Description
Treatment IOV class.
Slots
colnamename of the column that will be output in dataset
distributiondistribution
dose_numbersassociated dose numbers, integer vector, same length as values
Treatment IOV's class.
Description
Treatment IOV's class.
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.
Description
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.
Undefined schedule class.
Description
Undefined schedule class.
Uniform distribution class.
Description
Uniform distribution class.
Unite the given column names.
Description
Unite the given column names.
Usage
unite_columns(x, columns, colname, factor = TRUE)
Arguments
x |
data frame, Campsis output |
columns |
columns to unify |
colname |
destination column name |
factor |
factor the destination column |
Value
a data frame
Unwrap treatment.
Description
Unwrap treatment.
Usage
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)
Arguments
object |
any object |
Value
updated object
Update the number of additional doses (ADDL).
Description
Update the number of additional doses (ADDL).
Usage
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)
Arguments
object |
generic object |
addl |
new number of additional doses |
ref |
reference treatment name |
Value
updated object
Update amount.
Description
Update amount.
Usage
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)
Arguments
object |
generic object |
amount |
new amount |
ref |
reference treatment name |
Value
updated object
Update the inter-dose interval (II).
Description
Update the inter-dose interval (II).
Usage
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)
Arguments
object |
generic object |
ii |
new inter-dose interval |
ref |
reference treatment name |
Value
updated object
Update the repeat field (argument 'rep' in Bolus and Infusion constructors).
Description
Update the repeat field (argument 'rep' in Bolus and Infusion constructors).
Usage
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)
Arguments
object |
generic object |
rep |
repeated dosing schedule (definition) object |
ref |
reference treatment name |
Value
updated object
Restore a campsis_tbl object
Description
Internal vctrs method to restore the custom 'campsis_tbl' class attributes, specifically copying over the S4 metadata object, after a vector operation.
Usage
## S3 method for class 'campsis_tbl'
vec_restore(x, to, ...)
Arguments
x |
A tibble or vector to restore. |
to |
The original 'campsis_tbl' object to restore to. |
... |
Additional arguments passed to methods. |
Value
A restored 'campsis_tbl' object with appropriate metadata and classes.
VPC plot.
Description
VPC plot.
Usage
vpcPlot(x, strata = NULL, level = 0.9, alpha = 0.15, facet = TRUE)
Arguments
x |
data frame, output of Campsis with replicates |
strata |
named vector with the strata to use, default is c(SCENARIO="all", ARM="all").
Only columns that are actually present in |
level |
PI level, default is 0.9 (90% PI) |
alpha |
alpha parameter (transparency) given to geom_ribbon |
facet |
how the stratification variable is displayed. |
Value
a ggplot object
VPC plot (S3 generic).
Description
VPC plot (S3 generic).
Usage
vpc_plot(x, ...)
Arguments
x |
a Campsis output object |
... |
additional arguments passed to the method |
Value
a ggplot object
VPC plot for prediction-interval Campsis output.
Description
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.
Usage
## S3 method for class 'pi_campsis_tbl'
vpc_plot(x, strata = "auto", level = 0.9, alpha = 0.15, facet = TRUE, ...)
Arguments
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) |
Details
Stratification is resolved as follows:
-
"auto"(default):ARMis used when more than one distinct arm is detected; otherwiseSCENARIOis used when more than one distinct scenario is detected; otherwiseNULL(no stratification). Only one stratification variable is applied becausevpcPlotsupports at most one. -
NULL: no stratification. named character vector: passed directly to
vpcPlot(e.g.c(ARM = "all")orc(SCENARIO = "all")).
Value
a ggplot object
See Also
VPC plot for standard Campsis simulation output.
Description
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.
Usage
## 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,
...
)
Arguments
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) |
Details
Stratification is resolved as follows:
-
"auto"(default):ARMis used when more than one distinct arm is detected; otherwiseSCENARIOis used when more than one distinct scenario is detected; otherwiseNULL(no stratification). Only one stratification variable is applied becausevpcPlotsupports at most one. -
NULL: no stratification. named character vector: passed directly to
vpcPlot(e.g.c(ARM = "all")orc(SCENARIO = "all")).
Value
a ggplot object
See Also
vpcPlot, vpc_plot.pi_campsis_tbl
Convert weeks to hours.
Description
Convert weeks to hours.
Usage
weeks(x)
Arguments
x |
numeric vector in weeks |
Value
numeric vector in hours
Convert pharma years (1 year = 12*4 weeks) to hours.
Description
Convert pharma years (1 year = 12*4 weeks) to hours.
Usage
years(x)
Arguments
x |
numeric vector in years |
Value
numeric vector in hours