Tutorials › Pharmacometric Workflows and Reproducible Modeling › Dose Records and Event Semantics Across Tools

Software Landscape and Interoperability · Tutorial 207 of 399

Dose Records and Event Semantics Across Tools

Learn to map dose and observation records consistently across four pharmacometric tools, including how event timing, compartment assignment, and initial amounts affect predictions.

Intermediate 12 min read

What You'll Learn

  • Identify the event information needed to represent a dose or observation consistently across tools.
  • Distinguish a bolus amount in a compartment from the concentration predicted from that amount.
  • Calculate post-dose concentrations while accounting for prior doses and a nonzero initial amount.
  • Compare the event-record concepts used by NONMEM, Monolix, nlmixr2, and mrgsolve.
  • Diagnose mismatches caused by event ordering, compartment codes, or inconsistent units.

Why Dose Records Need Explicit Semantics

A dose record is more than a number and a time. It specifies how much drug enters a model, when the event occurs, and which compartment receives the amount. An observation record, by contrast, identifies a time at which a model prediction is compared with data. Confusing these records can create different predictions even when the parameter values and model equations appear identical.

This matters when translating a dataset or model between NONMEM, Monolix, nlmixr2, and mrgsolve. The software interfaces and file formats differ, and Monolix projects in particular can map user-selected dataset columns to event meanings. The reliable comparison is therefore semantic: identify each event's meaning, then verify that each tool receives an equivalent event. Earlier material on state variables, amounts, and concentrations established that an amount is not itself a concentration; here that distinction is applied to dose records and event timing.

Definition: A dose event specifies an amount, an event time, and a destination compartment (as well as an administration type when relevant). For an instantaneous bolus of amount \(D\) into a compartment whose amount is \(A\), the event changes the state according to \(A(t^+)=A(t^-)+D\). An observation event requests or records a model prediction at a time; it does not add drug. The notation \(t^-\) and \(t^+\) means immediately before and after the event, respectively.

In a one-compartment IV bolus model, the central amount \(A\) is eliminated with clearance \(CL\) and volume \(V\). Between doses, \(dA/dt=-(CL/V)A\), and concentration is \(C=A/V\). The dose amount may be recorded in mg, whereas concentration may be in mg/L. The time unit must also agree with the units used for clearance and volume: if \(CL\) is in L/h and \(V\) in L, time is in hours and \(CL/V\) is in h\(^{-1}\).

Bolus Events and the Contribution of Earlier Doses

Let \(k=CL/V\), and suppose bolus doses \(D_j\) occur at times \(t_j\). Between events, the amount decays exponentially. At each bolus, the amount jumps by the dose amount. If the amount at time zero is \(A(0)\), then for \(t\geq 0\) the concentration after any events at or before \(t\) is

$$ C(t)=\frac{A(0)e^{-kt}+\displaystyle\sum_{j:t_j\leq t}D_j e^{-k(t-t_j)}}{V}. $$

This expression assumes linear one-compartment elimination, instantaneous boluses into the central compartment, constant \(CL\) and \(V\), and that the listed doses include all doses contributing to the prediction. The initial amount is the amount present at time zero, before any listed dose at time zero. If the initial amount is zero, its term vanishes. If a dose is given at the prediction time, the displayed sum includes it and therefore gives the post-dose value; the pre-dose value excludes that event.

Justification: Between dose times, solving \(dA/dt=-kA\) over an interval of length \(u\) gives \(A(t+u)=A(t)e^{-ku}\). Thus the initial amount contributes \(A(0)e^{-kt}\). A dose \(D_j\) contributes \(D_j\) immediately after \(t_j\), then \(D_j e^{-k(t-t_j)}\) at a later time \(t\). The model is linear, so these surviving contributions add. Dividing the total amount by \(V\) gives concentration.

Worked Example: A Dose with a Nonzero Initial Amount

Suppose a hypothetical one-compartment model has \(A(0)=10\) mg, \(V=20\) L, and \(CL=2.31\) L/h. A 100 mg bolus is given at \(t=1\) h. Find the concentration immediately after the dose and at \(t=2\) h. Assume no other doses.

First, \(k=CL/V=2.31/20=0.1155\) h\(^{-1}\). Immediately before the dose at 1 h, the initial amount has decayed to \(10e^{-0.1155(1)}=8.909\) mg. The bolus raises the amount to \(8.909+100=108.909\) mg, so

$$ C(1^+)=\frac{10e^{-0.1155(1)}+100}{20} =\frac{108.909}{20} =5.445\ {\rm mg/L}. $$

At 2 h, the initial amount has survived for 2 h, and the dose has survived for 1 h:

$$ C(2)=\frac{10e^{-0.1155(2)}+100e^{-0.1155(1)}}{20} =\frac{7.938+89.09}{20} =4.851\ {\rm mg/L}. $$

The calculation assumes the initial amount and listed dose are the complete set of contributors. Omitting the initial amount would understate both predictions.

Repeated Doses and the Meaning of Event Time

For repeated boluses, the same contribution rule applies to every dose. Each dose is added at its event time, and each earlier dose continues to contribute after that time. A dose at time \(t\) has no elimination time yet in the post-dose value at \(t^+\); a pre-dose sample at \(t\) must exclude it. An observation at exactly the dose time therefore needs an explicit pre-dose or post-dose interpretation.

Worked Example: Repeated Boluses and a Same-Time Observation

Consider a hypothetical model with \(V=20\) L and \(CL=2.00\) L/h, so \(k=0.1000\) h\(^{-1}\). Give 100 mg boluses at 0 h and 12 h. Calculate the concentration immediately before and immediately after the 12 h dose.

Just before 12 h, only the dose at 0 h contributes. Its amount is \(100e^{-0.1000(12)}=30.12\) mg, giving

$$ C(12^-)=\frac{100e^{-1.2}}{20} =\frac{30.12}{20} =1.506\ {\rm mg/L}. $$

The second bolus adds 100 mg at 12 h. Immediately after it, the total amount is \(30.12+100=130.12\) mg:

$$ C(12^+)=\frac{100e^{-1.2}+100}{20} =\frac{130.12}{20} =6.506\ {\rm mg/L}. $$

The difference is the instantaneous increment \(100/20=5.000\) mg/L. If the observation at 12 h is intended to be pre-dose, it corresponds to 1.506 mg/L; if post-dose, it corresponds to 6.506 mg/L. A dataset that simply places both records at 12 h without a clear ordering or convention can leave this distinction unclear.

Mapping Event Semantics Across Tools

The following table gives the conceptual mapping, not a universal recipe for column names or a guarantee that every project uses the same defaults. In each tool, confirm the dataset mapping, compartment definitions, and event-processing convention for the model and version in use.

ToolDose event representationObservation representationImportant check
NONMEMTypically a record with a dose event indicator such as EVID=1, an amount in AMT, and a destination specified by CMT.Typically an observation record, often EVID=0, with the measured value in the configured dependent-variable column; MDV can indicate a missing observation.Check EVID, AMT, CMT, MDV, record order, and the model's compartment definitions.
MonolixA dose event is represented through the project’s mapped event-data columns, including the amount and intended compartment or administration information.An observation record contains the measured response and its time, as mapped in the project.Check the project’s column mapping and event-type definitions rather than assuming column names alone determine meaning.
nlmixr2Event data commonly use fields such as time, amt, cmt, and evid; dosing schedules can also be constructed with event-table tools.Observation records carry the response at the specified time, alongside the event data as required by the input structure.Check that event-table and data-frame inputs encode the same dose times, amounts, and compartment targets.
mrgsolveEvent data commonly use fields such as time, amt, cmt, and evid to describe dosing records.Output or observation times request predictions; observation data supplied for comparison must be aligned with those times.Check the model’s compartment numbering and how dose and output records at the same time are handled.

Across the tools, the concepts to align are the amount and its units, the time origin and units, the target compartment, and whether a record is a dose or an observation. In NONMEM, EVID and AMT are central parts of conventional event-record coding; CMT identifies the compartment involved. In nlmixr2 and mrgsolve, event data or event-table inputs commonly carry analogous information. Monolix relies on project-level mappings of the dataset columns to event and observation roles. These differences in representation do not change the underlying scientific meaning, but they make it unsafe to copy a dataset and assume the same column is interpreted identically in every project.

Compartment Assignment Is Part of the Dose

An amount is added to the compartment specified by the event, not automatically to whichever state variable is easiest to observe. For an extravascular dose, the destination may be an absorption or depot compartment. The amount in that compartment is not the central amount and should not be divided by the central volume to report a concentration. A wrong compartment code can produce a plausible-looking but incorrect profile.

Worked Example: Depot Dose Versus Central Bolus

Suppose a hypothetical model has a depot amount \(A_g\), a central amount \(A_c\), first-order absorption rate constant \(k_a=1.00\) h\(^{-1}\), elimination rate constant \(k=0.1000\) h\(^{-1}\), and central volume \(V=20\) L. A 100 mg dose is intended for the depot at time zero. The model is \(dA_g/dt=-k_aA_g\), \(dA_c/dt=k_aA_g-kA_c\), with both amounts initially zero.

The depot amount is \(A_g(t)=100e^{-k_at}\). Substituting this into the central-compartment equation and integrating gives

$$ A_c(t)=\frac{k_aD}{k_a-k}\left(e^{-kt}-e^{-k_at}\right). $$

At 1 h, \(A_c(1)=(1.00\times100/(1.00-0.1000))(e^{-0.1000}-e^{-1.00})=59.66\) mg. Therefore \(C(1)=59.66/20=2.983\) mg/L. If the same 100 mg were mistakenly assigned as a central bolus, the central amount at 1 h would instead be \(100e^{-0.1000}=90.48\) mg and the concentration would be \(90.48/20=4.524\) mg/L. The discrepancy is not a small formatting difference: it represents a different administration route in the model.

Diagnostics, Alternatives, and Common Failure Modes

A useful cross-tool check is to compare event ledgers before comparing fitted results. For each subject, list event time, event type, amount, destination compartment, and any observation value. Then check that units, time origin, and event order agree. For a simple bolus model, manually calculate at least one post-dose prediction using the dose-contribution formula and compare it with each tool’s prediction. This isolates event-data mismatches from differences in estimation algorithms or model code.

When the intended meaning of a same-time observation is uncertain, two alternatives are safer than relying on an implicit convention: document whether the sample is pre-dose or post-dose, or represent the sample and dose with a clearly specified record ordering consistent with the tool. If the actual sampling time is slightly before the recorded dosing time, use the actual times rather than forcing both events to an identical timestamp. A simulation output grid and an observed data record are also distinct: requesting an output at a time does not itself create an observed response.

Common diagnostics include an unexpected jump at an observation time, predictions that differ by approximately dose divided by volume, a delayed appearance of drug when a central bolus was intended, and mismatches that begin only after a repeat dose. These patterns can suggest, respectively, an incorrectly coded observation event, pre/post-dose disagreement, a wrong compartment assignment, or a missing/repeated dose. They are clues, not proof; inspect the event records and state definitions directly.

  • Wrong reasoning: “Both records have the same time and amount, so they are the same dose.” Correction: Confirm the event type and destination compartment; an observation row with an amount-like value does not necessarily dose the model.
  • Wrong reasoning: “The dose amount is the predicted concentration.” Correction: A dose changes an amount state. Concentration follows from the model state and the applicable volume or observation equation.
  • Wrong reasoning: “All bolus predictions are just the latest dose’s contribution.” Correction: Include every prior dose that contributes, and include a nonzero initial amount when specified.
  • Wrong reasoning: “Same-time dose and sample records always mean a post-dose sample.” Correction: Specify the intended timing and check the tool’s record-processing convention.

No event representation removes the need to validate a translation. Exact syntax and defaults can depend on the tool, project setup, or input route. This tutorial focuses on instantaneous boluses and event/observation distinctions; infusion duration, bioavailability, and lag-time handling require additional event information and should not be inferred from a bolus record alone.

Key takeaway: A portable dose record must preserve the event’s time, amount and units, destination compartment, and event type. A portable observation must preserve its sampling time and its pre-dose or post-dose meaning when it coincides with a dose.

Check Your Understanding

Answer each question, then compare your reasoning with the brief solutions below.

  1. A 50 mg bolus is given into a central compartment with \(V=10\) L. What is the instantaneous concentration increment, assuming concentration is amount divided by volume?
  2. For the repeated-dose example above, why does the 12 h post-dose concentration exceed the pre-dose concentration by 5.000 mg/L?
  3. A model has \(A(0)=20\) mg and receives a 50 mg bolus at \(t=0\). Which terms contribute to the post-dose amount at \(t=0\)?
  4. Why can identical dose times and amounts still produce different predictions in two tools?
  5. A 100 mg dose intended for a depot compartment is accidentally assigned to the central compartment. What model consequence should you expect?

Solutions. (1) The increment is \(50/10=5.000\) mg/L. (2) The new bolus adds 50 mg instantly to a 10 L-per-? No: in the stated repeated-dose example, the dose is 100 mg and \(V=20\) L, so the increment is \(100/20=5.000\) mg/L. (3) Both the initial amount and the time-zero dose contribute, so the post-dose amount is \(20+50=70\) mg. (4) The tools may differ in event classification, compartment mapping, time units or origin, or handling of same-time records; those meanings must be aligned and checked. (5) Drug enters the central state immediately rather than being absorbed from the depot, producing a different time course and typically an immediate central concentration jump.

Clinical Biostats