Why Small Time Differences Can Matter
A timestamp can look precise enough for a data table yet be too coarse for the model evaluation it controls. If a sample and a dose occur at distinct times but are rounded to the same stored time, the model no longer receives their original separation. A prediction may then be evaluated at a different effective time, or the software may have to apply an explicit tie-breaking rule to decide which event happens first.
This is a targeted numerical-debugging problem: identify whether timestamp rounding has changed the event records or the model calculation, and determine whether that change matters for the likelihood. The earlier material on Rounding-Induced Changes in Likelihood Evaluation provides the broader context for checking how altered numerical inputs can affect a likelihood. Here the focus is specifically on time values and event ordering.
The basic distinction is between rounding within a smooth part of a trajectory and rounding at or across an event. In the first case, the prediction often changes gradually with time. In the second, a dose, infusion change, or other state-changing event can create a discontinuity. Two nearly coincident times can therefore produce a small numerical change, a tie with altered event handling, or both.
What Rounding Can—and Cannot—Do to Order
Suppose all times use the same units and origin and are rounded using the same monotone rule. If \(t_1<t_2\), rounding cannot make the rounded value of \(t_1\) greater than the rounded value of \(t_2\). It can, however, make the values equal. Thus ordinary rounding does not by itself reverse a strict chronological order; it can erase the separation that expressed that order. If the model then resolves the tie using a priority rule, input-row order, or another convention, its processing order may not preserve the intended order of the original records.
This distinction is important when diagnosing a claimed “event reversal.” Check whether the stored times are truly reversed, or whether they became equal and a tie-breaking rule determined which event was processed first. A reversal can also arise from other data-handling problems, such as inconsistent time conversions or sorting, but it should not be attributed to monotone rounding alone.
The rounding rule itself matters. For example, under ordinary nearest-hundredth rounding, \(2.012\) h and \(2.014\) h both become \(2.01\) h. But \(2.013\) h rounds to \(2.01\) h while \(2.017\) h rounds to \(2.02\) h: their stored separation is \(0.01\) h, not zero. Always apply the actual precision and rounding convention to each value rather than inferring the result from how close the pair seems.
Worked Example: Two Distinct Records Collapse to a Tie
Hypothetical data. A model input contains a dose record at \(2.012\) h and a concentration observation at \(2.014\) h. Suppose the time field is stored to the nearest \(0.01\) h. Determine whether the records remain distinct and what information is lost.
Apply the stated rounding rule. The dose time rounds to \(2.01\) h because \(2.012\) is closer to \(2.01\) than to \(2.02\). The observation time also rounds to \(2.01\) h because \(2.014\) is closer to \(2.01\).
The original records are distinct and the dose precedes the observation by \(0.002\) h, or \(7.2\) s. The rounded records are tied. They have not been mathematically reversed, but their stored timestamps no longer encode the original gap. If the model processes a dose before a tied observation, the prediction may represent a post-dose rather than a pre-dose concentration. The timestamp column alone cannot establish which interpretation the software used; inspect the event-processing convention and evaluation record.
Rounding Error Away from Events
Within a smooth, event-free interval, a time perturbation can often be assessed using the model prediction’s rate of change. Let \(f(t)\) be a scalar prediction, and let the rounded time be \(t+r\). If \(f\) is differentiable throughout the interval between \(t\) and \(t+r\), the mean value theorem gives \(f(t+r)-f(t)=f'(\xi)r\) for some \(\xi\) between those times. If \(|f'(u)|\leq M\) throughout that interval and rounding to a grid with spacing \(\Delta\) ensures \(|r|\leq \Delta/2\), then the prediction change is bounded by \(M\Delta/2\). This is a local smoothness bound, not a universal guarantee: it requires the interval to stay within a region where the prediction is differentiable and the derivative is bounded.
For a vector of predictions, the same reasoning can be applied component by component if each component is differentiable and has a suitable derivative bound. In practice, the sensitivity may not be known in advance, so comparing predictions at the original and rounded times can be a useful diagnostic. That comparison is meaningful only if both evaluations use the same model state, parameters, event history, and prediction definition.
Worked Example: Quantifying a Smooth Prediction Change
Hypothetical model. In an event-free interval, a concentration prediction is \(C(t)=10\exp(-0.5t)\) mg/L, with time in hours. Two observation times, \(2.013\) h and \(2.017\) h, are rounded to the nearest \(0.01\) h. Calculate the rounded times and compare each original prediction with the prediction at its rounded time.
The first time rounds to \(2.01\) h; the second rounds to \(2.02\) h. They do not collapse to a tie. Substitution into the model gives:
The rounded-time prediction is higher by approximately \(3.660-3.655=0.005\) mg/L (about \(0.00549\) mg/L before rounding the reported concentrations). For the second observation:
Here rounding lowers the prediction by approximately \(3.642-3.648=-0.006\) mg/L (about \(-0.00547\) mg/L using unrounded evaluations). The exact changes are small for this example, but whether they matter depends on the observation scale, residual variability, and the number and pattern of affected records. The calculation also assumes that both times lie in the same smooth interval and use the same underlying trajectory.
Why a Tie Near a State-Changing Event Is Different
The smooth bound above does not apply across a discontinuity. For example, an instantaneous dose can change the concentration state immediately, so the prediction just before the dose and just after it need not be close. If rounding makes a sample time tie with that dose, a tie-breaking rule can determine which state is used for the observation. The resulting difference can be on the scale of the dose-related jump, rather than on the scale of a small time perturbation.
Worked Example: A Rounded Tie Changes Which State Is Observed
Hypothetical model. A one-compartment model has a previous dose at time zero that contributes \(10\) mg/L at time zero, with elimination rate \(k=0.2\ \mathrm{h}^{-1}\). An additional instantaneous dose contributes \(10\) mg/L. A sample is scheduled at \(1.003\) h and the additional dose at \(1.004\) h. Both times are rounded to the nearest \(0.01\) h. The original schedule places the sample before the additional dose.
The sample rounds to \(1.00\) h, and the additional dose also rounds to \(1.00\) h. Before that additional dose, the model predicts at the original sample time:
If the tied records are processed with the dose before the sample, the concentration at the rounded time after the dose is:
Thus a tie policy that puts the dose first can produce a prediction about \(10.00\) mg/L higher than the original pre-dose prediction. This is not an error bound for a small time shift: it reflects a different event state. If the software instead applies the sample before the dose when times tie, the result may differ. The event priority and the meaning of predictions at an event time must therefore be verified rather than assumed.
A Practical Diagnostic Workflow
A reliable investigation follows the time values from source to prediction. In addition to checking the displayed data, inspect the values actually passed to the model and the event ordering used at evaluation. The following sequence helps separate a precision issue from a model or optimizer problem.
Inspect the highest-precision source values, their units, time origin, and whether they represent scheduled or observed times. Confirm that a conversion or export did not introduce a separate change.
Record the stored precision and the rounding rule. Identify pairs whose distinct times became equal, and check whether any records’ units or origins differ.
Determine how the model orders a dose, observation, infusion change, or other event at the same stored time. Check whether that priority matches the intended event semantics.
With parameters and all other inputs held fixed, evaluate the model using the original times and the rounded times. If a tie is involved, also test the documented event order where appropriate.
Check affected predictions, residuals, and individual likelihood contributions. Determine whether the discrepancy is limited to a few records or changes the fitted objective materially.
Warning signs include unexpected duplicate timestamps, a dose and sample sharing a stored time when they were distinct in the source, abrupt prediction changes under a tiny timestamp perturbation, and different results after an input file is exported and re-read. A stable optimizer does not rule out these problems: an optimizer can consistently fit the likelihood it was given even when its event times differ from the intended ones. Conversely, a small difference in one prediction does not by itself establish that rounding caused a consequential failure; compare the affected likelihood and the overall analysis at fixed settings.
Choosing a Remedy and Recognizing Its Limits
The preferred remedy is usually to preserve sufficient timestamp precision throughout the data pipeline and model evaluation. If operational data are inherently recorded only to a given resolution, do not invent finer event times. Instead, document what the recorded time represents and define how truly tied events are handled. For simulation or data processing, integer time units such as milliseconds can sometimes make comparisons and sorting more reproducible, provided the chosen unit still represents the source precision and conversions are checked.
A second option is intentional event grouping: treat records within a prespecified time window as simultaneous. That is a modeling and data-definition decision, not a harmless numerical fix. It requires a defensible window, an explicit within-tie priority, and a clear account of which events are grouped. Automatically merging nearby events can conceal a real distinction, especially if observations occur around a dose or another discontinuity.
| Approach | Strength | Limitation to check |
|---|---|---|
| Retain source timestamp precision | Preserves measured or scheduled distinctions. | Cannot recover precision that was never recorded; conversions and storage formats still need checking. |
| Use an explicitly defined tie rule | Makes same-time event processing reproducible. | Does not restore the original separation when distinct events have already collapsed. |
| Group events within a stated tolerance | Can represent an intentional simultaneity convention. | May merge events that have different model consequences; the tolerance and event priority need justification. |
There is no universal number of decimal places that is safe for every pharmacometric model. The relevant time resolution depends on the time scale of the dynamics, the distance to state-changing events, the observation schedule, and the required accuracy of predictions and likelihoods. Assessing those features is more informative than increasing decimal places without checking how the model consumes the values.
Common Mistake
Wrong reasoning: “The two times differ by only a few seconds, so rounding them together cannot matter.” This treats the prediction as smooth across the interval and ignores the possibility that one time is just before a dose while the other is just after it. Another incorrect claim is that ordinary monotone rounding reversed the original order when it actually mapped both times to a tie.
Correction: First calculate the rounded value of each time under the actual rule. Then distinguish a surviving gap, a tie, and any genuine order change introduced elsewhere in processing. For a tie, inspect the software’s event priority and the model state used for the observation. Only when the interval remains within a smooth segment is a small-perturbation argument, such as the derivative bound above, appropriate.
Check Your Understanding
Answer each question, then compare your reasoning with the solutions.
- Under nearest-\(0.01\)-hour rounding, what happens to records at \(3.021\) h and \(3.024\) h? Do they collapse?
- Can a single monotone rounding rule reverse two strictly ordered times? Explain what it can do instead.
- Why is a derivative-based prediction bound not sufficient when an observation ties with an instantaneous dose?
- A sample at \(1.006\) h is rounded to \(1.01\) h, and a dose at \(1.014\) h is also rounded to \(1.01\) h. Name two checks needed before deciding that the resulting likelihood change is negligible.
Solutions. (1) \(3.021\) rounds to \(3.02\) h and \(3.024\) also rounds to \(3.02\) h, so they collapse to a tie. (2) No. A monotone rounding rule preserves nondecreasing order, but can map distinct times to the same value and thereby erase their separation. A later tie-breaking rule can then process them in an order that differs from the original chronology. (3) The prediction may be discontinuous at the dose, so the differentiability assumption used for the bound fails across the event; the post-dose and pre-dose states can differ substantially. (4) Check the model’s tie-breaking and prediction-at-event conventions, and compare controlled model evaluations and affected likelihood contributions using the original and rounded times. Also verify the source units and time origin before attributing the change to rounding alone.