Tutorials › Pharmacometric Workflows and Reproducible Modeling › A One-Compartment Model in Monolix

Software Landscape and Interoperability · Tutorial 198 of 399

A One-Compartment Model in Monolix

Learn to connect a Monolix model file and project data settings to the one-compartment intravenous-bolus model, then verify its parameters and error model with worked calculations.

Intermediate 11 min read

What You'll Learn

  • Map dose amount and time to an intravenous bolus in the central compartment.
  • Express concentration using clearance, volume, and the amount state.
  • Represent lognormal interindividual variability in Monolix model syntax.
  • Specify additive residual error and calculate an observation’s likelihood contribution.
  • Diagnose unit, event-mapping, and parameterization errors in a model implementation.
  • Compare the Monolix representation with the earlier NONMEM implementation without conflating syntax and model assumptions.

From a pharmacokinetic model to a Monolix implementation

A one-compartment intravenous-bolus model has a compact mathematical form, but implementing it correctly requires more than writing an elimination equation. The dose must be mapped to the correct compartment and event type; clearance and volume must determine both elimination and concentration; and the population, individual, and residual components must describe the intended sources of variation. A syntactically valid model can still encode the wrong pharmacokinetic model if one of these links is incorrect.

This tutorial develops a first-order elimination model for a single intravenous bolus. It uses the amount in the central compartment as the state variable, clearance and volume as the structural parameters, lognormal interindividual variability as an example population model, and additive normal residual error as an observation model. The values used below are hypothetical and are for illustrating the implementation, not results from a real study.

Definition: In a one-compartment intravenous-bolus model, a dose \(D\) enters the central compartment instantaneously at its recorded administration time. The amount \(A(t)\) then decreases by first-order elimination. Concentration \(C(t)\) is the amount divided by volume \(V\). Clearance is denoted \(CL\), and the elimination rate constant is \(k=CL/V\).

Structural model and event handling

For an individual \(i\), between dose events the amount obeys \(dA_i(t)/dt=-(CL_i/V_i)A_i(t)\), and the predicted concentration is \(C_i(t)=A_i(t)/V_i\). At a bolus time \(t_d\), the state changes by \(A_i(t_d^+)=A_i(t_d^-)+D\). For a first dose with no prior amount in the compartment, \(A_i(t_d^-)=0\). The plus and minus superscripts denote the states immediately after and immediately before the event.

$$ \frac{dA_i(t)}{dt}=-\frac{CL_i}{V_i}A_i(t), \qquad C_i(t)=\frac{A_i(t)}{V_i}, \qquad A_i(t_d^+)=A_i(t_d^-)+D $$

The solution after a single dose, with elapsed time \(t\) measured from the bolus, follows by solving the first-order differential equation:

$$ A_i(t)=D\exp\left(-\frac{CL_i}{V_i}t\right), \qquad C_i(t)=\frac{D}{V_i}\exp\left(-\frac{CL_i}{V_i}t\right), \quad t\geq 0 $$

This solution also gives a useful implementation check: immediately after a single dose, predicted concentration is \(D/V_i\), and after dosing it declines exponentially with rate \(CL_i/V_i\). With dose in milligrams, volume in litres, clearance in litres per hour, and time in hours, concentration is in milligrams per litre and the rate constant is in inverse hours.

In Monolix, the model file describes the equations and parameter relationships; the project settings map columns in the dataset to roles such as subject identifier, time, observation, and dose. The software uses the dose records and their configured administration type to apply the event to the selected compartment. Thus, the model should define the amount-state derivative, while the dataset and project configuration must identify each bolus and its destination. Do not manually add the dose to the state in the derivative equation as well as configuring it as an administration: that would count the dose twice.

Representing parameters and variability

A population model can describe each individual’s clearance and volume as positive, lognormally distributed parameters. One common specification is \(CL_i=CL_{\mathrm{pop}}\exp(\eta_{CL,i})\) and \(V_i=V_{\mathrm{pop}}\exp(\eta_{V,i})\), where each \(\eta\) has mean zero and a specified variance. For the simple example here, the two random effects are independent, with standard deviations \(\omega_{CL}\) and \(\omega_V\). Independence is an assumption of this example, not a requirement of the one-compartment structural model.

$$ \eta_{CL,i}\sim N(0,\omega_{CL}^2), \qquad \eta_{V,i}\sim N(0,\omega_V^2), \qquad CL_i=CL_{\mathrm{pop}}\exp(\eta_{CL,i}), \qquad V_i=V_{\mathrm{pop}}\exp(\eta_{V,i}) $$

In a Monolix model file, the individual parameter definitions can be represented with entries of the form CL = {distribution=logNormal, typical=CL_pop, sd=omega_CL} and V = {distribution=logNormal, typical=V_pop, sd=omega_V} in the individual-effects section. The longitudinal section takes \(CL\) and \(V\) as inputs, defines the amount equation, and calculates concentration. The parameter names in the file and the names used in project settings must agree.

With this lognormal specification, the typical value is the median of the individual parameter distribution; it is not its arithmetic mean. The standard deviation parameter for the lognormal distribution describes spread on the log scale. Since exponentiation is used, the individual clearance and volume remain positive. A model that instead uses normally distributed individual parameters could imply negative values and would require a deliberate justification or a different parameterization.

Worked Example: Checking the bolus prediction

Suppose a hypothetical individual receives \(D=500\) mg intravenously. Let \(V=25\) L and \(CL=5\) L/h. Calculate the predicted concentration 2 hours after the dose.

First calculate the elimination rate constant: \(k=CL/V=(5\ \mathrm{L/h})/(25\ \mathrm{L})=0.2000\ \mathrm{h}^{-1}\). The initial concentration is \(D/V=(500\ \mathrm{mg})/(25\ \mathrm{L})=20.00\ \mathrm{mg/L}\).

The prediction at 2 hours is \(C(2)=(D/V)\exp(-k\times2\ \mathrm{h})\). Substituting gives \(C(2)=20.00\exp[-(0.2000\ \mathrm{h}^{-1})(2\ \mathrm{h})]\ \mathrm{mg/L}=20.00\exp(-0.4000)\ \mathrm{mg/L}=13.41\ \mathrm{mg/L}\).

This value is consistent with the model: it is below the immediate post-dose concentration of \(20.00\ \mathrm{mg/L}\), and the exponent is dimensionless because the rate is in inverse hours and time is in hours.

Worked Example: Applying individual random effects

Consider hypothetical population typical values \(CL_{\mathrm{pop}}=5.00\) L/h and \(V_{\mathrm{pop}}=25.0\) L. For one individual, suppose \(\eta_{CL}=0.200\) and \(\eta_V=-0.100\). Calculate that individual’s parameters and elimination rate constant.

The individual clearance is \(CL_i=5.00\exp(0.200)=6.107\) L/h. The individual volume is \(V_i=25.0\exp(-0.100)=22.62\) L. Therefore, \(k_i=CL_i/V_i=(6.107\ \mathrm{L/h})/(22.62\ \mathrm{L})=0.2700\ \mathrm{h}^{-1}\).

For a 500 mg bolus, this individual’s immediate post-dose concentration is \(500\ \mathrm{mg}/22.62\ \mathrm{L}=22.10\ \mathrm{mg/L}\). The random effects change both the initial concentration through volume and the rate of decline through the ratio of clearance to volume.

Observation model and residual error

The structural prediction is not generally identical to a measured concentration. Under an additive normal residual-error model, the observation \(Y_{ij}\) for individual \(i\) at observation time \(j\) is normally distributed around the predicted concentration \(C_{ij}\), with standard deviation \(\sigma\). This model assumes conditionally independent residual errors given the model parameters and predictions, and a constant residual standard deviation across predictions. Those assumptions should be considered against the assay and the scale of the observations.

$$ Y_{ij}\mid C_{ij}\sim N(C_{ij},\sigma^2), \qquad Y_{ij}=C_{ij}+\epsilon_{ij}, \qquad \epsilon_{ij}\sim N(0,\sigma^2) $$

In the longitudinal section, the observation definition can be written in Monolix syntax as y = {distribution=normal, prediction=C, sd=sigma}, with the appropriate observation variable and parameter names for the model and data. The standard deviation has the same units as concentration. For example, if concentrations are in mg/L, \(\sigma\) is in mg/L. The project must map the observation column to the model’s observation definition; a correct formula connected to the wrong data column does not produce the intended likelihood.

Worked Example: Evaluating one observation under additive error

Suppose the model predicts \(C_{ij}=13.41\) mg/L, the hypothetical observed concentration is \(Y_{ij}=12.40\) mg/L, and the additive residual standard deviation is \(\sigma=1.50\) mg/L. Calculate the standardized residual and the normal density contribution at these fixed parameter values.

The standardized residual is \((Y_{ij}-C_{ij})/\sigma=(12.40-13.41)\ \mathrm{mg/L}/(1.50\ \mathrm{mg/L})=-0.6733\). It is dimensionless and indicates that the observation is about 0.67 residual standard deviations below the prediction.

The density is \(f(Y_{ij}\mid C_{ij})=[1/(\sqrt{2\pi}\sigma)]\exp[-(Y_{ij}-C_{ij})^2/(2\sigma^2)]\). Substitution gives \(f=[1/(\sqrt{2\pi}\times1.50\ \mathrm{mg/L})]\exp[-(1.01\ \mathrm{mg/L})^2/(2(1.50\ \mathrm{mg/L})^2)]\), approximately \(0.212\ (\mathrm{mg/L})^{-1}\). This is a density, not the probability of observing exactly 12.40 mg/L; for a continuous outcome, probability is assigned to an interval of values.

A model-file outline and implementation checks

A compact implementation has two conceptual parts: definitions for individual parameters and variability, and longitudinal equations and the observation distribution. The following outline describes their roles rather than prescribing every line of a version-specific file. A Monolix project also needs the data-column mapping, dose-event configuration, observation definition, and parameter-estimation settings.

1
Define population parameters and distributions.
Provide typical clearance and volume values and, when estimating interindividual variability, the lognormal distributions and their spread parameters.
2
Define the longitudinal model.
Use the individual clearance and volume in the amount-state equation, and compute concentration as amount divided by volume.
3
Define the observation distribution.
Link the predicted concentration to the observed variable using the selected residual-error model and a standard deviation with compatible units.
4
Map data and dose events.
Check that subject, time, observation, dose amount, and administration information are assigned to their intended roles, and that the dose is configured as an intravenous bolus into the modeled compartment.
5
Verify predictions before interpreting estimates.
Test the model with a known dose and parameter values, check the initial concentration and decline, then inspect whether fitted predictions and residuals are plausible.

For a single dose, the principal checks are direct: \(C(0^+)=D/V\), concentrations decline after the bolus when \(CL>0\) and \(V>0\), and the time constant is governed by \(CL/V\). In a dataset with multiple doses, inspect whether each dose occurs at its recorded time and whether the model carries the remaining amount forward. Check the units and the time origin as well: a mismatch between hours in the dataset and a rate expressed per day changes the predicted decline substantially.

Comparison, diagnostics, and limitations

The model components have distinct roles. Dose records determine when and how much enters the compartment; the structural model translates amount into concentration and elimination; interindividual random effects describe variation in parameters among individuals; and residual error describes observation-level departures from the model prediction. A change in one component should not be used to compensate silently for a mistake in another. For example, a dose-unit error may produce poor predictions that cannot be interpreted as evidence for unusually high clearance.

The earlier material on NONMEM used the same underlying pharmacokinetic concepts, but software syntax and project configuration are not interchangeable. In this Monolix implementation, the model file expresses the differential equation, individual distributions, and observation distribution, while project settings connect the file to the data and dose-event semantics. Compare models by their encoded assumptions and parameter definitions, not by whether their lines of code look similar. A model-file translation is equivalent only when event handling, units, parameterization, and error assumptions agree.

Useful warning signs include an implausible predicted concentration immediately after dosing, no visible change in amount after a dose, predictions that rise after a single bolus despite positive clearance, or residuals that grow in magnitude with concentration under an assumed constant additive error. Investigate event mapping, dose and concentration units, parameter constraints, and the residual-error form before interpreting an optimizer’s estimates. Also check that the selected data records are observations rather than dose rows when assessing residuals.

A single-compartment model assumes that one well-mixed compartment adequately represents the concentration-time behavior over the modeled period, that elimination is first order, and that clearance and volume are constant for an individual in the model. The additive normal residual model adds assumptions about error scale and conditional distribution. These assumptions may be inadequate for distribution phases, concentration-dependent error, censoring, or time-varying pharmacokinetics. The implementation is a starting model, not a guarantee that the biology or observation process is adequately represented.

A common mistake is to use a clearance value directly as the coefficient in the amount equation, writing \(dA/dt=-CL\,A\). This is dimensionally wrong: clearance has units of volume per time, so \(CL\times A\) does not have units of amount per time. The correct elimination coefficient is \(CL/V\), which has units of inverse time. Another mistake is to treat the typical lognormal value as the arithmetic mean; under the specified lognormal model it is the median, so the interpretation of a population estimate must match the chosen parameterization.

Key takeaway: A correct Monolix implementation keeps the model’s roles connected but distinct: dose events change the amount state, \(CL/V\) governs its elimination, \(A/V\) gives concentration, random effects describe individual parameter variation, and the residual distribution links predictions to observations.

Check Your Understanding

Answer the questions, then compare your reasoning with the solutions below.

  1. A hypothetical 300 mg bolus is given to an individual with \(V=15\) L and \(CL=3\) L/h. What are the immediate post-dose concentration and elimination rate constant?
  2. For a lognormal parameter \(V_i=V_{\mathrm{pop}}\exp(\eta_{V,i})\), what does \(V_{\mathrm{pop}}\) represent, and why does this specification ensure positive volume?
  3. Why should a bolus not be added manually in the differential equation if the dose is already mapped as a dose event in the project?
  4. An additive residual model has \(\sigma=2\) mg/L. Does that standard deviation change with the predicted concentration under this model?
  5. Suppose a model uses \(CL\) rather than \(CL/V\) as the coefficient multiplying amount in the elimination equation. Identify the problem.

Solutions. (1) \(C(0^+)=D/V=300/15=20.00\) mg/L, and \(k=CL/V=3/15=0.2000\ \mathrm{h}^{-1}\). (2) \(V_{\mathrm{pop}}\) is the typical, median volume under this lognormal parameterization. The exponential of any finite real \(\eta_{V,i}\) is positive, and a positive typical value therefore gives positive individual volume. (3) The event handler already applies the dose jump to the state; adding it manually as well counts the dose twice. (4) No. The additive model specifies a constant residual standard deviation of 2 mg/L across predictions. (5) The units do not match: \(CL\) has units of volume per time, whereas the coefficient multiplying amount in a first-order elimination equation must have units of inverse time. Use \(CL/V\).

Clinical Biostats