Why Individual Timelines Need Covariate Intervals
A dose history and a concentration record can both be placed on a subject’s time axis. A covariate such as body weight or renal function also changes over time, but its data are often recorded in a separate table. Before an NLME model can use those records, the analyst needs an unambiguous way to represent which covariate record applies to which individual, and during what time interval.
A date attached to a measurement is not automatically the date range during which that value is valid for analysis. The measurement time tells us when a value was recorded. A validity interval is a separate data definition that says when that record is assigned to the individual’s timeline. The interval must come from the data specification or analysis plan; a timestamp alone does not determine its start or end.
This tutorial is about that representation and its alignment with events. It does not determine how a covariate should change between measurement times or how it enters a pharmacokinetic parameter. Those are separate modeling decisions. Here, the goal is to build an event table in which every dose and observation can be matched to the appropriate, explicitly defined covariate interval.
Build the Timeline Before Joining Events
Use one time origin and one time unit consistently for all records belonging to an individual. For example, time may be measured in hours since the first dose, with calendar dates converted to hours using the documented dosing time zone. Keep the original measurement timestamp as a separate field when it differs from the assigned validity start. Store the covariate’s unit as well as its numeric value: a weight of 62 could mean 62 kg or 62 lb, and those values are not interchangeable.
A convenient event table has one row per event and fields such as individual identifier, event time, event type, dose or observation information, and the matched covariate record. The covariate table has one row per validity interval. To join the tables, compare both the individual identifier and the event time with the interval endpoints. Matching on time alone can attach one person’s covariate to another person’s event.
With half-open intervals, adjacent records can meet without either overlapping or leaving a boundary unassigned: \([0,24)\) followed by \([24,48)\) assigns time 24 only to the second interval. If the records are intended to be contiguous, their endpoints satisfy \(b_{ik}=a_{i,k+1}\). A gap means there is a period for which no record applies; an overlap means more than one record may apply. Neither should be silently resolved by an arbitrary join.
Worked Example: Aligning Renal-Function Records With Events
Consider a hypothetical individual, P01, whose renal-function covariate is recorded in mL/min. The analysis data specification assigns 52 mL/min to \([0,24)\) hours and 46 mL/min to \([24,60)\) hours. Dose events occur at hours 0, 24, and 48; observations occur at hours 12, 24, 36, and 60. Determine the covariate match at each event.
For any event time \(t\), test the interval inequalities. At hour 12, \(0 \leq 12 < 24\), so the assigned value is 52 mL/min. At hour 24, the first interval fails because \(24 < 24\) is false; the second interval passes because \(24 \leq 24 < 60\). Thus the value at the shared boundary is 46 mL/min.
At hour 36 and hour 48, \(24 \leq t < 60\), so both events match 46 mL/min. At hour 60, neither interval applies: the first ended at 24 and the second excludes its endpoint 60. The correct result for that event is “no assigned interval,” not 46 mL/min.
The complete matches are therefore: dose at 0, 52 mL/min; observation at 12, 52 mL/min; dose at 24, 46 mL/min; observation at 24, 46 mL/min; observation at 36, 46 mL/min; dose at 48, 46 mL/min; and observation at 60, no assigned value. The interval definitions, rather than the event type, govern the matching. This example assumes the supplied intervals are the specified analysis representation; it does not infer how renal function changed between measurements.
Why the Boundary Convention Works
The half-open convention is useful because it gives a precise answer at every shared boundary. Suppose one record ends at \(b\) and the next begins at \(b\). The first is valid only for \(t < b\); the second is valid for \(t \geq b\). Thus exactly one record applies at \(b\), provided the intervals are otherwise nonoverlapping.
More generally, if the intervals for one individual and one covariate are ordered and satisfy \(b_{ik}=a_{i,k+1}\), with \(a_{ik}<b_{ik}\), then any time in the covered range belongs to exactly one interval. To see this, take a time \(t\) between the first start and last end. It lies in at least one consecutive interval because there are no gaps. It cannot lie in two: if it were in interval \(k\) and \(k+1\), it would have to satisfy both \(t < b_{ik}\) and \(t \geq a_{i,k+1}=b_{ik}\), which is impossible. This is why explicit boundaries and a consistent convention prevent ambiguous event matches.
A half-open interval is a data convention, not a biological claim that the covariate changes discontinuously at the endpoint. It simply establishes which record is attached to an event exactly at that time. When the underlying data specification uses another boundary rule, document that rule and apply it consistently rather than mixing conventions.
Worked Example: Mapping Changing Weight to Doses
For a hypothetical individual, the covariate table lists weight as 70.0 kg on the interval \([0,168)\) hours and 68.5 kg on \([168,336)\) hours. The data specification provides those validity intervals, and the listed weights use the same unit. Doses occur at hours 0, 72, 168, and 240; observations occur at hours 96 and 192. Assign a weight to each event.
At hours 0, 72, and 96, the inequality \(0 \leq t < 168\) holds, so each event matches 70.0 kg. At hour 168, the first interval excludes the endpoint and the second includes its start, so the dose matches 68.5 kg. The events at hours 192 and 240 also satisfy \(168 \leq t < 336\), so both match 68.5 kg.
The timeline therefore assigns 70.0 kg to the doses at 0 and 72 hours and the observation at 96 hours; it assigns 68.5 kg to the dose at 168 hours, the observation at 192 hours, and the dose at 240 hours. The weight used here is not calculated from the dose or concentration, and no weight is assigned outside the intervals. The conclusion depends on the provided validity intervals, not simply on the fact that a weight measurement was taken at some date.
Data Checks and Common Failure Modes
Before fitting a model, check the interval table on its own and then inspect the joined event table. Useful checks include whether every interval has \(a_{ik}<b_{ik}\), whether the individual and covariate identifiers are present, whether units are consistent, and whether the event times and interval endpoints use the same time origin and precision. For each individual and covariate, sort intervals by start time and identify gaps or overlaps. Then count how many intervals match each dose and observation.
- No matching interval: the event may lie before the first validity start, after the last validity end, or inside a gap. Flag it for review; do not automatically fill it with a nearby value.
- More than one matching interval: the intervals may overlap or the join may have omitted the individual or covariate key. Investigate the records instead of choosing one match arbitrarily.
- Boundary mismatch: if adjoining intervals use inconsistent endpoint rules, events at their shared time may be omitted or duplicated. Test events exactly at every shared boundary.
- Time or unit mismatch: a calendar date, elapsed hours, and nominal visit number are not interchangeable. Likewise, a value without its unit is not safely interpretable.
- Unexpected row multiplication: a join that returns multiple covariate matches for one event can duplicate event rows and may change the analysis data. Check the number of matches before and after joining.
A frequent mistake is to treat the measurement timestamp as if it automatically defines the validity start, then to extend that value until the next measurement without checking the data specification. That reasoning silently imposes a rule for the unmeasured period. The correction is to keep measurement time and validity endpoints distinct, and to encode an interval only when the intended assignment is defined. If there is no such definition, report that the event lacks an assigned covariate record rather than inventing one.
Worked Example: Detecting an Ambiguous Join
A hypothetical subject’s weight records are entered as 70 kg on \([0,100)\) hours and 69 kg on \([90,160)\) hours. A dose occurs at hour 95. Both intervals use the same time unit, subject, and covariate, so the ambiguity is not a unit or identifier issue.
For the first interval, \(0 \leq 95 < 100\), which is true. For the second, \(90 \leq 95 < 160\), which is also true. The event therefore has two matches: 70 kg and 69 kg. A join returning two rows for this dose is revealing a data problem, not providing two valid alternatives.
The intervals overlap on \([90,100)\). The appropriate action is to check the source records or the documented interval assignment and correct the endpoints if warranted. If the intended records were \([0,90)\) and \([90,160)\), then hour 95 would match only 69 kg; that correction must be supported by the data specification, not assumed merely to make the join unique.
Choosing a Representation and Knowing Its Limits
A single baseline covariate column is compact and can be appropriate when the analysis explicitly uses a baseline value. It cannot, by itself, represent which of several dated covariate records is assigned at later events. A table of timestamped measurements preserves when values were recorded, but does not by itself specify the periods during which those values apply. An interval table makes that assignment explicit and can be joined to irregularly timed doses and observations.
The interval table also has limits. Correct matching does not establish that the assigned value is biologically constant throughout its interval, nor does it decide whether a different time-varying representation would be appropriate. It only represents a specified assignment. It cannot repair inaccurate timestamps, resolve ambiguous source data, or determine a scientifically appropriate update rule. Those questions require separate decisions and documentation.
When dates include clock times, use the same time zone and precision for events and interval endpoints. When records are recorded only to a calendar date, do not silently treat that date as a precise instant if dosing occurred at an unknown time that day. Document the time origin and any date-conversion convention so another analyst can reproduce the event matching.
Check Your Understanding
Answer each question, then compare your reasoning with the solutions below.
- A covariate is assigned to \([10,20)\) hours and \([20,30)\) hours. Which record matches an observation at hour 20?
- A dose at hour 40 has no matching interval, and the last interval ended at hour 36. What can be concluded from the interval table?
- For one subject, records are \([0,25)\) and \([24,50)\). How many records match an event at hour 24.5?
- Why should a measurement timestamp be stored separately from validity start and end times?
Solutions. (1) The second record matches: \(20 \leq 20 < 30\), while the first excludes hour 20. (2) The event is outside the supplied intervals; the table provides no assigned covariate value for hour 40. A value should not be extended past hour 36 without an explicit assignment rule. (3) Both records match, because \(0 \leq 24.5 < 25\) and \(24 \leq 24.5 < 50\). This is an overlap that needs investigation. (4) The timestamp records when a measurement was taken, whereas validity endpoints define when the record is assigned to the timeline; one does not determine the other automatically.