Why Event Order Matters When Times Match
A dose record and a sample record can have the same recorded time without representing events that occurred simultaneously. The times may have been rounded, truncated, or stored only to a coarse resolution. Conversely, records may share a genuinely exact timestamp, while the data still do not establish which event occurred first. These are different situations, and a reliable dataset should not treat them as if they were interchangeable.
Order matters because a pharmacometric model uses event records to represent the history that generated each observation. For an instantaneous bolus, the modeled concentration changes at the dose time. A sample interpreted immediately before the dose can therefore have a different model prediction from one interpreted immediately after it. The key task is not to impose a universal ordering rule: none applies in every dataset. It is to use documented event details where available and to define a transparent, reproducible convention for any unresolved tie.
Start With the Source Records
Before assigning a sequence to tied events, check what the time fields mean and how they were produced. A time recorded to the nearest minute is not equivalent to an exact time recorded to the second. Nor is a planned collection time necessarily the same as the actual collection time, or a scheduled dose time the same as actual administration. Use the source details that describe when the sample was collected and when the dose was administered, including the relevant administration time for an infusion.
When source records provide finer timing than the analysis dataset, retain or recover that precision if it is reliable and permitted by the data specification. Compare the underlying times before deciding whether a tie exists. Do not infer an order simply from the order of rows in a source export: that order may reflect entry, transfer, or sorting rather than event chronology. Also check whether the relevant dates and time zones are consistent, since a time-of-day comparison alone can misorder events across date boundaries.
If reliable documentation establishes the order, carry that order into the analysis dataset, even when the stored timestamps match. If the sources do not resolve the order, apply a declared fallback convention consistently. A convention might specify that a sample record precedes a dose record when their times tie, or specify the reverse. Neither is universally correct. The choice should be compatible with the study documentation and model-data requirements, and the unresolved tie should remain identifiable for review.
Worked Example: Checking Times Before Concluding There Is a Tie
Hypothetical data. An administration log records a bolus at 11:20:15, and the sample worksheet records collection at 11:20:35. Both source times are available to the second, but the analysis export reports time to the nearest minute. Determine the order and the displayed times.
The source times differ by \(11{:}20{:}35 - 11{:}20{:}15 = 20\) seconds, so the dose preceded the sample by 20 seconds. Rounding each source time to the nearest minute gives 11:20:15 as 11:20 and 11:20:35 as 11:21. The dose preceded the sample by 20 seconds. Rounded to the nearest minute, the times display as 11:20 and 11:21, respectively.
These records are not a timestamp tie in the rounded export. Sorting them by their displayed times preserves their order. Replacing both times with 11:20 would not be ordinary nearest-minute rounding; it would erase a distinction that the source data support.
Worked Example: Ordering Records That Round to the Same Minute
Hypothetical data. A sample was collected at 09:14:42 and a bolus was administered at 09:14:55. The analysis export rounds times to the nearest minute. Determine the appropriate record order.
The events are 13 seconds apart, with collection first. Both source times round to 09:15: 09:14:42 is 42 seconds past 09:14, and 09:14:55 is 55 seconds past 09:14. Because each is at least 30 seconds past the minute, both round up. The analysis records therefore tie at 09:15 even though the source chronology is known.
Preserve the 09:15 timestamp for each record if that is the specified precision, but include an ordering field that places the sample before the dose. For example, within-time ranks 1 for the sample and 2 for the dose encode the documented chronology. The rank does not claim greater timestamp precision; it records which event came first.
Define a Reproducible Ordering Rule
A sound ordering procedure separates the recorded time from the sequence used to resolve ties. One practical specification is: sort first by the analysis time; within a tied time, use verified source chronology; if chronology is unavailable, apply the documented fallback priority; and use a stable final tie-breaker for otherwise indistinguishable records. The final tie-breaker might be a retained source-record identifier. It should make processing reproducible without pretending to reveal an unknown physical order.
Determine whether each time is exact to the recorded unit, rounded, truncated, or otherwise transformed. Check the source and data specification.
Use documented collection and administration times, rather than planned times or row order, when those details reliably establish chronology.
Preserve known chronology. For unresolved ties, apply the declared fallback convention and retain a way to identify those records.
Check that sorting is stable, that no documented order was reversed, and that the analysis software uses the intended sequence for tied records.
For example, a data specification can define a priority for sample and dose records when their analysis times match. The priority should be stated in words, implemented explicitly, and checked after every sort or merge that might change row order. If two events of the same type also tie, use a stable identifier or source sequence rather than allowing software-specific sort behavior to decide their order.
Why the Order Can Change a Model Prediction
The consequence is clearest for an idealized instantaneous bolus in a one-compartment model. Assume a known volume of distribution \(V\), an instantaneous dose \(D\), and no simultaneous process that changes concentration discontinuously. Concentration immediately after the bolus exceeds concentration immediately before it by the dose divided by volume:
This follows from the model’s bolus rule: the dose adds an amount \(D\) to the amount in the compartment at time \(t\). Dividing that amount by the compartment volume gives the concentration increment \(D/V\). Thus, if an observation at the same represented time is ordered after the dose, its prediction uses the post-dose state; if ordered before, its prediction uses the pre-dose state. This distinction does not by itself say which sequence is correct for a particular sample. That must come from the documented event chronology or the declared convention.
Worked Example: The Prediction Difference at a Bolus Tie
Hypothetical model values. A 100 mg bolus is given when the modeled pre-dose concentration is 2 mg/L. The one-compartment volume is 20 L. A sample record has the same analysis time as the bolus, and no finer timing is available. Calculate the predictions under each possible order.
The predicted concentration increment is
If the sample is ordered before the dose, the prediction is the pre-dose value, 2 mg/L. If it is ordered after the dose, the prediction is
The two orderings differ by 5 mg/L in this simplified example. They do not represent two estimates of the same specified event history: they represent different interpretations of the tied records. The data manager should not select whichever order produces a preferred model fit. Use the study documentation; if it cannot resolve the order, apply the prespecified convention and report the unresolved tie as a limitation.
Diagnostics, Alternatives, and Limitations
A useful review checks both the raw time information and the final event sequence. Flag dose–sample ties, ties involving multiple dose or sample records, unexpectedly reversed chronology, and records whose source precision exceeds the precision retained for analysis. Check that a sort by time and within-time rank gives the same sequence each time. After data joins or exports, verify that the rank and source identifiers remain attached to the correct records.
Also compare the ordering rule with study documentation: does it match actual collection and administration details where available? If a protocol describes a predose collection but actual timing is missing, treat that as evidence about the planned procedure, not automatic proof of what happened for every participant. Where source times disagree, or clocks are known to be unreliable, flag the conflict rather than silently choosing one source. A missing or inconsistent time cannot be repaired merely by imposing a deterministic sort.
There are two common ways to represent tied events. One is to keep the same time and provide an explicit within-time ordering field, if the modeling workflow supports and respects it. Another is to preserve source times at finer precision when they are reliable. Altering a time by adding a small artificial offset can force an order in software that otherwise cannot represent ties, but it changes the event time. Such an adjustment is not a neutral substitute for an ordering field: it should be used only when required, documented, and shown to be small enough not to distort relevant time intervals.
The limitation is fundamental: a fallback rule makes the dataset deterministic, but it does not recover chronology that was never recorded. If the modeled outcome is sensitive to alternative plausible orders, the unresolved tie may warrant a sensitivity check using each defensible sequence. This is a data-interpretation check, not a way to infer which chronology actually occurred.
Check Your Understanding
Answer each question, then compare your reasoning with the solutions.
- A dose is recorded at 07:30:40 and a sample at 07:30:10. Both are rounded to the nearest minute. What are the displayed times, and which event occurred first?
- Two records share an analysis time, and source documents do not establish their order. What should the dataset specification do?
- In the bolus example, what post-dose concentration follows from a pre-dose concentration of 3 mg/L, a 60 mg dose, and a volume of 12 L?
- Why is adding an arbitrary small time offset not generally equivalent to retaining a tied time with an ordering field?
Solutions. (1) 07:30:40 rounds to 07:31 and 07:30:10 rounds to 07:30, so the sample occurred first and the displayed times are 07:31 for the dose and 07:30 for the sample. (2) It should state a deterministic fallback priority, retain an indicator or other means of identifying the unresolved tie, and apply the rule consistently; it should not claim the rule proves physical chronology. (3) The increment is \(60\ \mathrm{mg}/12\ \mathrm{L}=5\ \mathrm{mg/L}\), so the post-dose concentration is \(3+5=8\ \mathrm{mg/L}\). (4) An offset changes the event time and may change elapsed-time calculations, whereas an ordering field specifies sequence without changing the recorded time.