Why Event Equivalence Needs Its Own Check
Two simulation engines can return similar concentrations for a particular set of observation times while representing the administered events differently. That agreement does not establish that the engines received or interpreted the same dose history. A discrepancy may be hidden between observation times, or two errors may happen to offset at the sampled times. Conversely, event records may look different in their software-specific syntax while encoding the same doses and resets.
The purpose of an event-equivalence check is to determine whether two implementations represent the same interventions at the same times, with the same amounts, routes, durations, and state-reset behavior. Concentration calculations provide a separate check that the equivalent events drive the intended model dynamics. This complements testing cross-software prediction equivalence: predictions are useful evidence, but event records identify what was actually simulated.
The qualifier matters. Event equivalence is about the instructions to the simulator; concentration equivalence is about the resulting model output. For example, a bolus and a finite-duration infusion can deliver the same total amount but are not the same event history. They will generally produce different concentrations during and after administration.
What to Compare in a Common Event Representation
Before comparing engines, translate each input into a canonical event table. Each record should contain at least the event time and time unit, event type, amount and amount unit for a bolus, or rate and duration for an infusion, target compartment or route, and any relevant bioavailability or lag-time information. Include reset operations, and retain an event-order indicator when more than one operation occurs at the same time. For repeated-dose instructions, include the complete sequence of actual dose times, not just the compact instruction that generated it.
The comparison should not depend on a particular engine's column names. A record encoded as an amount plus an infusion flag in one tool may be encoded as a rate and duration in another. Normalize the records into comparable quantities. For an infusion with constant rate \(R\) over duration \(T\), the administered amount is \(RT\); this arithmetic is a useful consistency check, but it does not make that infusion equivalent to a bolus with the same total amount.
State the assumptions used for any concentration check. The examples below use a hypothetical one-compartment model with instantaneous mixing, first-order elimination, constant volume \(V\), and elimination rate constant \(k\). They assume linear drug disposition, no absorption delay or bioavailability adjustment, and no other doses unless stated. Concentration is in mg/L when dose is in mg and volume is in L; \(k\) is in inverse hours and time is in hours.
Worked Event Checks
Worked Example: A Single Bolus
Hypothetical setup. Engine A records a 100 mg IV bolus at time 0 h. Engine B records an instantaneous IV dose of 100 mg at the same time, directed to the same central compartment. Both use \(V=20\) L and \(k=0.10\) h\(^{-1}\). First compare the normalized records: event type, amount, time, route, and target compartment agree, so the event histories match for this dose.
Under the stated model, concentration \(t\) hours after the bolus is \(C(t)=(D/V)e^{-kt}\). At 2 h, substituting the values gives:
Both engines should therefore report approximately 4.094 mg/L at 2 h, subject to numerical tolerance and the convention for reporting the value exactly at the dose time. This output check supports the event comparison; it does not replace it.
Worked Example: Repeated Doses in Compact and Expanded Forms
Hypothetical setup. One engine receives a 100 mg bolus every 12 h, beginning at 0 h, for three total doses. The other receives explicit 100 mg bolus records at 0, 12, and 24 h. Both use the same one-compartment model as above. Expanding the compact schedule gives the same ordered dose times and amounts as the explicit records, so the schedules are event-equivalent.
To check concentration at 30 h, add the contributions from all three doses. Their elapsed times are 30, 18, and 6 h. The model is linear, so superposition applies: the total concentration is the sum of the concentrations from each dose.
The values in the final sum are rounded for display; the result is calculated from the unrounded exponential terms. If one engine instead generates four doses, uses a 10 h interval, or starts the schedule at a different time, its event history is not equivalent even if a concentration at one selected time happens to be close.
Worked Example: An Infusion Is Not a Bolus
Hypothetical setup. Engine A administers a constant infusion at 20 mg/h from 0 to 2 h, for a total of \(20\ \text{mg/h}\times2\ \text{h}=40\) mg. Engine B records a 40 mg bolus at 0 h. Both use \(V=20\) L and \(k=0.10\) h\(^{-1}\). The total administered amounts agree, but the event histories do not: one supplies drug gradually, while the other supplies it instantaneously.
For the infusion, the concentration at the end of the infusion is \(R/(Vk)\) times \(1-e^{-kT}\). Here \(R/(Vk)=(20\ \text{mg/h})/(20\ \text{L}\times0.10\ \text{h}^{-1})=10\ \text{mg/L}\). Thus:
After the infusion stops, concentration declines with the same elimination rate. At 5 h:
For the 40 mg bolus at 0 h, the concentration at 5 h is instead:
The different concentrations follow from the different input histories, not from a rounding discrepancy. A check that compares only total amount would miss this important distinction.
Worked Example: A Reset at a Dose Time
Hypothetical setup. A 100 mg bolus occurs at 0 h. At 12 h, the central-compartment state is reset to zero, and a second 100 mg bolus is administered at 12 h. Both engines use \(V=20\) L and \(k=0.10\) h\(^{-1}\). They agree that the reset occurs before the second dose. At 13 h, only the second dose contributes because the reset removed the pre-reset state.
If the reset is omitted, both doses contribute at 13 h:
A reset and a dose at the same nominal time must have a defined ordering. If the dose is applied and then the state is reset, the post-event state is zero; if the reset is applied first and then the dose, the new dose remains. Therefore, matching timestamps alone is not enough: compare operation order and verify that both implementations use the intended convention.
A Reproducible Comparison Procedure
The following sequence separates input discrepancies from differences in the model response. It is most useful when applied to a small, deliberately designed test case before a large regimen or population simulation.
Specify the subject, time origin, time units, model, parameters, and time interval being checked. State which event fields can affect this model.
Convert both engine inputs into a shared event table. Convert units explicitly, expand repeated schedules into individual events, and keep reset operations and same-time ordering.
Sort by time and defined event order, then compare event types and their relevant fields. Investigate missing, additional, shifted, or differently parameterized records rather than treating them as harmless formatting differences.
Choose times just before, at, and after important events, as well as times between them. Use analytical calculations where available, and compare each engine's output with the intended trajectory.
Define an absolute or relative numerical tolerance before evaluating outputs. Report event-field differences separately from concentration differences, and retain enough digits during calculations to avoid false discrepancies from intermediate rounding.
Justification: Why Event Agreement Is the First Check
Under the stated linear one-compartment assumptions, a bolus at time \(t_i\) contributes \((D_i/V)e^{-k(t-t_i)}\) to concentration at any later time \(t\). For several boluses, add the contributions. This follows because each dose adds its own initial concentration increment and the linear elimination equation carries each increment forward independently. Thus, if the dose amounts and times match, the model and parameters match, and no reset or other input intervenes, the two engines have the same mathematical concentration trajectory.
This result explains why an event-level mismatch is decisive even when a few sampled concentrations agree: the mismatched input is not the same mathematical regimen, and sparse output checks may not reveal the difference. The converse also needs care. Matching events does not guarantee matching numerical outputs if the engines implement different model equations, parameter mappings, or numerical tolerances. Event equivalence is a necessary input check for a fair comparison, not a guarantee that every downstream implementation detail is identical.
Diagnostics, Alternatives, and Limitations
| Approach | What it can establish | Main limitation |
|---|---|---|
| Compare normalized event records | Whether the specified dose and reset operations match field by field | Requires correct normalization and knowledge of each field's meaning |
| Compare concentrations at selected times | Whether outputs agree at those times under the selected model and parameters | Can miss event differences between samples or offsetting errors |
| Compare a dense concentration trajectory | Whether outputs agree over a broader time grid | Does not by itself identify which event or implementation detail caused a difference |
Common diagnostic clues include a concentration jump at the wrong time, a gradual rise where an instantaneous jump is expected, accumulation that differs after repeated dosing, and a post-reset value that retains pre-reset drug. Check time units and time origin first: 12 minutes mistakenly treated as 12 hours, or a schedule shifted by one interval, changes the event history. Then inspect amount units, infusion rate-duration consistency, compartment or route, lag and bioavailability fields, and event order at ties.
A tolerance should reflect the comparison being made. Event times and amounts usually have an intended exact representation after unit conversion; do not use a broad numerical tolerance to excuse a dose shifted by a meaningful interval. Floating-point concentrations may differ slightly, so set a numerical tolerance appropriate to the computation and report it. Keep the unrounded values in calculations and round only displayed results.
The main alternative is to compare model outputs alone, as in a prediction-equivalence check. That can be valuable, particularly for integrated models without simple analytical solutions, but it answers a different question. Event comparison is more direct for diagnosing regimen translation; output comparison tests the combined effect of inputs, model implementation, and numerical solution. Neither substitutes fully for the other.
These checks have limits. A canonical table is only as reliable as the semantics used to create it; software fields with similar names may have different meanings. For complex models, a concentration difference can arise from model translation or solver behavior even when events match. The analytical equations here apply only to the assumptions stated above, and a small set of sampled outputs cannot establish equality at every time. Treat the event table, targeted calculations, and output comparison as complementary evidence.
Common Mistakes
- Equating total dose with equivalent events. A 40 mg bolus and a 20 mg/h infusion for 2 h deliver the same total amount but have different time courses of input.
- Comparing compact schedule syntax literally. Different syntax can encode the same repeated doses. Expand each schedule and compare actual event times, counts, and amounts.
- Ignoring reset order. A reset before a same-time dose can produce a different state from a dose followed by a reset.
- Using a few matching concentrations as proof. Selected outputs may conceal event differences. Compare normalized records directly, then use concentrations as a complementary check.
- Rounding too early. Intermediate rounding can make a correct calculation appear inconsistent. Retain precision through the calculation and round the final result.
Check Your Understanding
Answer each question, then compare with the brief solutions.
- One engine records a 60 mg bolus at 0 h; another records a 30 mg/h infusion from 0 to 2 h. Are these event-equivalent? What single feature distinguishes them?
- A compact regimen specifies 80 mg every 8 h, beginning at 0 h, for three doses. What explicit dose times should be compared with another engine's schedule?
- Under the one-compartment assumptions, calculate the concentration 4 h after a 50 mg bolus when \(V=10\) L and \(k=0.20\) h\(^{-1}\).
- A reset and bolus share a timestamp, but the engines produce different post-event concentrations. Name a key event-level detail to inspect.
Solutions. (1) No. The bolus is instantaneous, while the infusion administers drug over 2 h, although each delivers 60 mg in total. (2) Compare doses at 0, 8, and 16 h, each for 80 mg, in the same route or compartment. (3) \(C(4)=(50/10)e^{-0.20(4)}=5e^{-0.8}\approx2.247\) mg/L. (4) Inspect the ordering of reset and dose at the shared time, as well as whether both resets act on the same model state.