Defines name and volume of a compartment.

compartment(name, volume = 1)

cmp(name, volume = 1)

Arguments

name

Name of the compartment

volume

Volume as a number, formula or parameter name

Value

A building block of type 'compartment'

Details

In most applications, compartments contain kinetically homogeneous amount of drug (applications where the compartment content represents other quantities are also possible). In assemblerr, a compartment is defined by providing a a name and the compartment volume.

Compartment names

Every compartment must have a valid name. A compartment name can contain letters, numbers as well as the underscore character, and needs to start with a letter. Adding a compartment with an already existing name will replace the definition of the compartment.

Compartment volumes

The compartment volume can be provided as a number, R formula, or a parameter name. It will be used by assemblerr to replace references to the compartment concentration (e.g., ~C["central"]) with the corresponding amount divided by volume (e.g., ~A["central]/vc).

See also

flow for how to describe compartment kinetics

Examples

# model with depot and central compartment m <- model() + compartment("depot", volume = 1) + compartment("central", volume = "vc") + flow(~ka*A, from = "depot", to = "central") + flow(~cl*C, from = "central") + prm_log_normal("ka") + prm_log_normal("cl") + prm_log_normal("vc") + obs_additive(conc~C["central"]) render( model = m, options = assemblerr_options( ode.use_special_advans = FALSE, ode.use_general_linear_advans = FALSE ) )
#> $PROBLEM #> $INPUT ID TIME DV AMT #> $DATA data.csv IGNORE=@ #> $SUBROUTINES ADVAN13 TOL=6 #> $MODEL COMP=(DEPOT) COMP=(CENTRAL) #> $PK #> KA = THETA(1) * EXP(ETA(1)) #> CL = THETA(2) * EXP(ETA(2)) #> VC = THETA(3) * EXP(ETA(3)) #> $DES #> DADT(1) = -(KA * A(1)) #> DADT(2) = KA * A(1) - CL * (A(2)/VC) #> $ERROR #> CONC = A(2)/VC #> Y = CONC + EPS(1) #> $ESTIMATION METHOD=COND MAXEVAL=999999 #> $THETA (0, 1, Inf) ; POP_KA #> $THETA (0, 1, Inf) ; POP_CL #> $THETA (0, 1, Inf) ; POP_VC #> $OMEGA 0.1 ; IIV_KA #> $OMEGA 0.1 ; IIV_CL #> $OMEGA 0.1 ; IIV_VC #> $SIGMA 1; RUV_ADD