Tutorials › Population Pharmacokinetics › Clean a Sparse-Dosing Dataset From Source to Analysis

Dataset Construction and Quality Control · Tutorial 55 of 599

Clean a Sparse-Dosing Dataset From Source to Analysis

Learn how to turn sparse dose, sample, and covariate records into an auditable analysis dataset while preserving the evidence behind every correction.

Intermediate 13 min read

What You'll Learn

  • Distinguish planned sparse sampling from an absent or unrecorded sample.
  • Derive study time and time since the most recent dose from verified timestamps.
  • Convert concentration units while preserving the original value and unit.
  • Represent below-quantification results as censored observations, not ordinary numeric values.
  • Retain missing covariates with explicit status rather than imputing by default.
  • Build event and observation records with source references and correction flags.

From Source Records to a Sparse-Dosing Analysis Dataset

In a sparse-sampling pharmacokinetic study, each participant may contribute only a small number of concentration measurements, often at different times. That makes each record valuable: a wrong timestamp, an unmarked unit conversion, or a concentration recorded as zero when it was below quantification can change what the data appear to say. The goal of cleaning is not to make every field look complete. It is to create a consistent analysis dataset that preserves what was observed, distinguishes observation from interpretation, and lets another analyst trace each value back to its source.

A sparse dataset typically brings together several kinds of records: administered doses, collected PK samples, and participant covariates. These records have different meanings and should not be collapsed into a single undifferentiated row. A dose is an event that supplies information about the input to the body; a PK record represents a concentration measurement at a sampling time; a covariate describes a participant or a participant at a specified time. A missing scheduled sample is not a concentration of zero, and a planned sample time is not necessarily the actual collection time.

Definition: A source record is a value or event as recorded in an authoritative study source, such as a dosing record, sample log, or laboratory result. An analysis record is the corresponding standardized record prepared for analysis. A documented correction changes the analysis value only when the available source evidence supports that change; the original source value and the reason for the correction remain traceable.

Before assembling records, establish the study’s time origin, time zone convention, concentration reporting unit, and rules for identifying the authoritative source for each field. The example below assumes that all date-times are local study time, that the first administered dose defines time zero for this participant, and that dose administration and sample collection timestamps have been verified against the relevant source records. If these assumptions are not supported, the appropriate response is to resolve or flag the uncertainty, not silently choose a convenient value.

Work the Records in a Defined Sequence

A reliable workflow separates source preservation, evidence-based corrections, derivation of time variables, handling of censoring, and covariate attachment. Keeping these steps distinct helps prevent a correction in one field from silently changing another.

1
Preserve and identify source records.
Retain the original value, unit, timestamp, source identifier, and record type. Identify participant and event or sample identifiers before combining files.
2
Resolve supported discrepancies.
Compare inconsistent records with the designated source evidence. Record the original value, corrected value, source used, reason, and correction status.
3
Standardize and derive.
Convert verified units to the analysis convention, then derive study time and time since the relevant dose from the corrected timestamps.
4
Represent observations and covariates honestly.
Keep below-quantification results identified as censored, and retain genuinely missing covariates as missing unless a justified, documented rule applies.
5
Validate and retain traceability.
Check chronology, units, record structure, and joins. Preserve source references and flags in the delivered dataset or its linked audit trail.

Worked Sparse-Sampling Example

Consider a hypothetical participant, 017, in a study with a planned 100 mg dose every 24 hours. The verified administration log records doses on March 2 at 08:00 and March 3 at 08:00. The study defines the first administered dose as \(TIME=0\). A laboratory source records samples at the following actual collection times. The participant’s baseline weight is 68 kg, but baseline eGFR is not present in the source covariate file.

RecordSource informationInitial issue or status
Dose 1March 2, 08:00; 100 mgVerified administration
Sample AMarch 2, 12:00; 1.800 ng/mL in laboratory resultCRF transcription lists 10:00
Sample BMarch 3, 06:00; reported “<500 pg/mL”Below the laboratory quantification limit
Dose 2March 3, 08:00; 100 mgVerified administration
Sample CMarch 3, 08:30; 850 pg/mLConcentration unit differs from analysis unit
Baseline covariatesWeight 68 kg; eGFR blankeGFR is not reported

For Sample A, the designated laboratory collection record supports 12:00, while 10:00 is a transcription discrepancy in the CRF. The analysis timestamp can therefore use 12:00, with the discrepancy and its source documented. This is not permission to choose whichever time seems more plausible: if the source records did not establish which value was correct, the time would remain unresolved and be flagged.

Worked Example: Derive Study Time and Time After Dose

For Sample B, calculate elapsed study time and elapsed time since the most recent administered dose. The first dose at March 2, 08:00 is \(TIME=0\). The second dose occurs at March 3, 08:00.

From March 2, 08:00 to March 3, 06:00 is 22 hours, so Sample B has \(TIME=22\) hours. The most recent dose before that sample is the first dose, also 22 hours earlier; therefore its time after the most recent dose is 22 hours. The sample precedes the second dose by 2 hours.

For Sample C, the timestamp is 24.5 hours after the first dose: 24 hours to March 3, 08:00, then another 0.5 hour to 08:30. The most recent dose is the second dose at 24 hours, so Sample C is 0.5 hour after that dose. These quantities answer different questions: \(TIME\) is measured from the study origin, while time after dose is measured from a particular administered dose.

In general, if the time origin is \(t_0\), and a verified sample timestamp is \(t_s\), then elapsed study time is computed from the difference between those timestamps. If \(t_d\) is the timestamp of the most recent administered dose at or before the sample, the time after that dose is calculated separately.

$$ TIME = t_s - t_0 \qquad TAD = t_s - t_d $$

The subtraction is valid only when the timestamps use a compatible time basis and units. Here the dates and times are on the same local study clock, so the elapsed durations can be expressed in hours. If one source used a different time zone or an unclear date convention, first resolve that discrepancy; arithmetic on inconsistent timestamps would produce precise but invalid elapsed times.

Repair Units and Preserve Censoring

Sample C is reported as 850 pg/mL, while the analysis convention is ng/mL. Since \(1\) ng equals \(1000\) pg, the reported concentration is converted by dividing by \(1000\). The original value and unit remain available in the source fields or audit trail; the converted value must not erase the evidence of what the laboratory reported.

Worked Example: Convert a Concentration Without Losing Its Provenance

Convert Sample C and its laboratory quantification limit to the analysis unit. The source result is 850 pg/mL, and the source qualifier for Sample B is “<500 pg/mL.” The analysis unit is ng/mL.

For Sample C, \(850 \div 1000 = 0.850\), so the analysis concentration is 0.850 ng/mL. For Sample B, the limit converts as \(500 \div 1000 = 0.500\), so the result is below 0.500 ng/mL. The standardized record retains the numeric value and unit as reported, the converted limit, and the below-limit qualifier. It does not assign Sample B a measured value of 0.500 ng/mL.

A below-quantification result is a censored observation: the concentration is known to be below a stated limit, but its precise value is not quantified by the assay. Preserve the censoring indicator and the applicable limit in the analysis data. A numerical placeholder such as zero, half the limit, or the limit itself is not equivalent to the reported result. If a later analysis method requires a particular representation, that choice must be made explicitly for that method; it should not replace the canonical cleaned record.

Key distinction: A blank concentration, a quantified concentration, and a concentration reported below a quantification limit represent different states. Store them so the state can be identified without guessing: for example, a quantified value with its unit, a censored status with its limit, or a missing-result status with a reason when known.

A planned sparse schedule can also contain occasions at which no sample was collected. Do not create a concentration row with a guessed value or imply that the sample was below the limit. If the analysis specification requires a record of missed sampling, represent that as a distinct, documented status. It is not an observed PK concentration.

Handle Missing Covariates and Assemble the Records

The baseline weight is available and can be attached to this participant’s records in the standardized unit, kilograms. The eGFR field is blank. That absence does not, by itself, establish whether the value was never measured, omitted in transcription, or unavailable for another reason. Preserve it as missing and, where source information supports it, record the reason or missingness status. Do not replace it with a typical value or derive it from other fields unless the required inputs and a prespecified, suitable derivation rule are available.

Worked Example: Build Traceable Analysis Records

Create a compact event-style analysis structure for the verified records. Include participant, record type, \(TIME\), dose amount when applicable, concentration status when applicable, standardized units, baseline covariates, and source traceability.

The dose records are participant 017 at \(TIME=0\), amount 100 mg, and at \(TIME=24\) hours, amount 100 mg. Sample A is at \(TIME=4\) hours with a quantified value of 1.800 ng/mL. Sample B is at \(TIME=22\) hours and is marked below 0.500 ng/mL, not as a quantified concentration. Sample C is at \(TIME=24.5\) hours with a quantified value of 0.850 ng/mL. Its time after the latest dose is 0.5 hour. The baseline weight of 68 kg is linked to participant 017; eGFR remains missing.

Each row should retain an identifier for the source dose or sample. Sample A also needs a correction flag or audit entry showing that the analysis collection time came from the verified laboratory record rather than the discrepant CRF entry. Sample C needs a unit-conversion record showing 850 pg/mL converted to 0.850 ng/mL. Sample B needs its censoring status and converted limit. These annotations make the rows reproducible rather than merely tidy.

An event-style dataset normally keeps dose events distinct from observation events, even when a dose and a sample occur close together. The exact column names and event codes depend on the analysis specification. At minimum, the structure must make clear which rows represent doses and which represent samples, and must not interpret a dose amount as a concentration or a missing observation as a zero. Covariates should be attached at the appropriate time: a baseline value may be constant for the participant, while a longitudinal value must correspond to the time it describes.

This is a cleaned input, not an interpretation of the participant’s concentration profile. It should not silently remove records because they look unusual or because a sample was collected at an inconvenient time. The focus here is on verified records, consistent fields, and explicit status—not on deciding what the concentrations imply.

Checks, Alternatives, and Failure Modes

Before release, run checks that target the relationships most likely to be broken during assembly. A report should expose discrepancies for review rather than automatically “fix” every flagged value.

  • Chronology: confirm that each sample timestamp and derived study time agree, and identify samples that precede all recorded doses or conflict with the verified dose history.
  • Units and limits: check that quantified values and censoring limits use the agreed analysis unit, and that conversions preserve their source values.
  • Record roles: verify that dose rows have dose information and sample rows have observation status, without confusing one event type for another.
  • Covariate joins: check that each participant is linked to the intended covariate record and that missing fields remain distinguishable from values absent because a join failed.
  • Traceability: confirm that each corrected or converted value has a source reference, reason, and reproducible transformation.

A scripted transformation with a retained audit trail is generally preferable to untracked manual edits: the script can repeat unit conversions and derived-time calculations consistently, while a review report can expose unresolved exceptions. Manual review is still important for evidence-dependent decisions, such as deciding which conflicting timestamp is authoritative. Conversely, a completely automated rule that chooses the earlier timestamp, replaces every BLQ result with a constant, or fills every covariate blank may be reproducible but scientifically unjustified.

A wide table with one row per participant can be convenient for baseline covariates, but it is a poor sole representation of irregular dose and sample events: repeated records may be forced into arbitrary columns or lost. A long event-oriented table represents repeated events more directly, while a separate covariate table can preserve participant-level or time-varying information before a controlled join. The choice of physical layout is less important than retaining event identity, timing, units, status, and provenance.

Common failures include treating a scheduled sample time as an actual sample time, converting a value but not its quantification limit, computing time after dose from the planned rather than administered dose, and replacing a missing covariate with an undocumented default. Another mistake is to assume that a plausible-looking value is correct. Plausibility can prompt investigation, but evidence is needed to justify a correction. Unresolved discrepancies should remain visible, with a clear status, rather than being hidden by a forced complete dataset.

Key takeaway: A reliable sparse-dosing dataset preserves source values, distinguishes doses from observations, derives time from verified timestamps, represents censoring explicitly, and leaves unsupported values missing. Every correction or transformation should be traceable to its source and rule.

Check Your Understanding

Use the definitions and example workflow above. Answers are included so you can check both the calculation and the data-handling decision.

  1. A verified dose occurs at 09:00 and a sample at 15:30 on the same day. What is the elapsed time after that dose, assuming both timestamps use the same time basis?
  2. A laboratory reports “<200 pg/mL,” and the analysis unit is ng/mL. What should be retained about the result after unit standardization?
  3. A CRF gives a collection time of 11:00, while an authoritative sample log gives 13:00. What supports using 13:00, and what should be documented?
  4. A baseline covariate is blank and no source explains why. Should it be replaced by the sample mean or a typical value during cleaning?
  5. A sample was scheduled but no result or collection record can be found. Is it a BLQ observation, a zero concentration, or a missing/unrecorded sample?

Solutions. (1) The elapsed time is \(15{:}30-09{:}00=6.5\) hours. (2) Preserve the below-limit status and convert the limit: \(200 \div 1000=0.200\) ng/mL. Do not turn it into a quantified value of 0.200 ng/mL. (3) Use 13:00 only if the sample log is the designated, reliable source for actual collection time; retain the original CRF value, the selected value, the source reference, and the reason for the correction. (4) No. Retain the value as missing, record a reason if one can be established, and apply an imputation or derivation only under a justified rule. (5) Treat it as a missing or unrecorded sample status, not BLQ or zero, unless source evidence establishes that a sample was collected and reported below the limit.

Clinical Biostats