Tutorials › Pharmacometric Workflows and Reproducible Modeling › Range and Distribution Checks

Data Specification and Dataset Preparation · Tutorial 39 of 399

Range and Distribution Checks

Use range limits and distribution summaries to identify values that deserve review while preserving plausible extremes and the distinction between a flag and a confirmed error.

Intermediate 10 min read

What You'll Learn

  • Apply documented, unit-specific plausibility limits to times, doses, concentrations, and covariates.
  • Use summaries and plots to examine a variable’s range, shape, and unusual values.
  • Calculate and interpret the interquartile range and its exploratory fences.
  • Distinguish a suspicious value from a confirmed data error.
  • Record flags and review decisions without silently deleting or changing observations.

Why Range and Distribution Checks Matter

A value can pass required-field validation and still warrant scrutiny. A recorded sample time of 240 hours, a dose of 100 mg/kg, or a concentration far above the rest of a dataset may reflect a unit mismatch, a transcription problem, an unusual but real observation, or a value that needs context. Range and distribution checks help identify such records for review; they do not establish which explanation is correct.

In pharmacometric data, what counts as plausible depends on the variable, its units, and the study context. A time measured from first dose is not interchangeable with a calendar date, and a dose expressed in milligrams is not numerically comparable with one expressed in milligrams per kilogram. A useful check therefore starts by confirming the variable definition and units, then compares values with relevant limits and with the pattern of the data.

Definition: A range check compares a recorded value with specified lower and upper limits for that variable. A distribution check examines a variable’s observed values, summaries, or plots to identify unusual patterns or observations. A value flagged by either check is a review flag, not a finding that the value is erroneous.

Limits, Summaries, and Plots

A range limit should be justified before it is applied. Limits may come from the variable’s definition, the study protocol, instrument or assay documentation, or a documented domain rule. State the applicable units and whether each limit is inclusive. For example, a rule might specify elapsed sample time from 0 through 72 hours, inclusive. That rule is useful only if the recorded time is indeed elapsed time in hours and the study context supports the bound.

A hard plausibility limit and a typical-value range answer different questions. A value outside a well-justified hard limit may indicate a coding or data problem, but still needs investigation. A value outside a typical range may simply be uncommon. Conversely, an entire variable can lie within broad limits while still showing an unexpected distribution, such as values clustered at a boundary or a second cluster that suggests inconsistent units.

Summaries provide a compact first view: the minimum, maximum, median, quartiles, and count of observed values. A histogram or dot plot can show skewness, gaps, clusters, and isolated values. A boxplot gives a visual summary based on quartiles. These tools are complementary: a single summary may conceal a cluster, while a plot does not replace checking units, missingness, or the underlying records.

Definition: For ordered observations, the interquartile range is \(IQR=Q_3-Q_1\), where \(Q_1\) and \(Q_3\) are the first and third quartiles. The common exploratory boxplot fences are \(Q_1-1.5(IQR)\) and \(Q_3+1.5(IQR)\). Observations beyond a fence are often called potential outliers. A fence identifies values for review; it is not a scientific plausibility limit or proof of error.

Quartile conventions can differ, especially in small samples. In the examples below, use the median-of-halves convention: order the observations, find the overall median, and, when the sample size is even, divide the observations into equally sized lower and upper halves. The medians of those halves are \(Q_1\) and \(Q_3\). Always state or follow the convention used by the analysis tools so that results are reproducible.

Using Distribution Checks Carefully

The interquartile range measures the spread of the middle half of the data. Because it is based on quartiles, it is less affected by an extreme value than the range or standard deviation. The \(1.5(IQR)\) fences extend beyond the middle half to provide a practical flagging rule. They are exploratory: they do not test a stated scientific hypothesis, and they do not imply that values inside the fences are correct or that values outside them are incorrect.

A histogram or boxplot can also reveal patterns that a single outlier rule misses. For example, two clusters may indicate different populations or incompatible recording conventions. A long right tail may be expected for a positive concentration variable. A pile-up at zero can have different meanings depending on whether zero is a valid measurement, a coding convention, or a substitute for a below-quantification result. The plot describes the recorded values; interpreting why they look that way requires study and data-definition context.

Worked Example: Flagging a Sample Time Against a Prespecified Limit

In a hypothetical study, elapsed sample time is recorded in hours after dose. The documented range for this collection is 0 through 48 hours, inclusive. The ordered recorded times for one review subset are 0, 0.5, 1, 2, 4, 8, 24, and 240 hours. Apply the range check.

The limit check is direct: each time must satisfy \(0\leq t\leq48\) hours. The first seven values satisfy this condition. For the final value, \(240>48\), so 240 hours is flagged. It is not silently changed to 24 hours, even though that would be a possible transcription explanation.

The flag prompts review of the source record, the time definition, and the unit. If the source confirms 240 hours and the study permits a late sample, the value may be valid and the documented limit may need reconsideration. If the source shows 24 hours, correction should follow the established traceable data-transformation process. Until the discrepancy is resolved, the value should remain identifiable as flagged.

Worked Example: Applying the Interquartile-Range Fence

A hypothetical dataset contains six concentrations in mg/L: 1, 2, 2, 3, 4, and 100. Use the median-of-halves convention to find the quartiles, calculate the upper fence, and interpret the result.

The values are already ordered. The lower half is 1, 2, 2, whose median is \(Q_1=2\). The upper half is 3, 4, 100, whose median is \(Q_3=4\). Therefore, \(IQR=4-2=2\) mg/L. The upper fence is

$$ Q_3+1.5(IQR)=4+1.5(2)=7\ \text{mg/L}. $$

Since \(100>7\) mg/L, the value 100 is beyond the exploratory upper fence and should be flagged for review. This calculation does not show that the result is wrong. The value could reflect an unusual but valid concentration, or it could arise from a recording or unit problem. The dataset is small, so the fence is especially useful as a prompt for inspection rather than as a basis for automatic exclusion.

Reading Plots in Context

Consider a separate hypothetical set of concentrations in mg/L: 0.04, 0.05, 0.08, 0.12, 0.20, 0.40, 0.80, 1.60, and 16.0. Suppose the documented assay-related plausibility interval for this review is 0.01 to 20 mg/L. All nine values satisfy that interval. A linear-scale histogram would show most values near the lower end and one high value; a logarithmic display can make the spacing among positive values easier to inspect.

The 16.0 mg/L result is not a range violation under the stated rule, but it may still deserve a distribution review because it is separated from the other observations. Its presence alone is not a reason to exclude it. Check the recorded units, relevant assay metadata, and source record, and interpret it in the context of the variable and sample. A log display is a visualization choice; it does not convert a flagged observation into an error or justify changing the stored value.

For covariates, the same principles apply. A recorded weight or age outside a study’s documented domain may warrant review, while an uncommon but feasible value should not be rejected merely because it is far from the median. For dose and time variables, verify the intended unit and definition before interpreting a numerical range. These checks concern the values and their distributions; explaining relationships between different fields is a separate task.

A Reproducible Review Process

A good workflow separates the mechanical act of finding a flag from the decision about what to do with it. Record the variable, units, rule or summary used, affected record identifiers, and review outcome. If a value is confirmed, preserve it. If a source-supported correction is made, retain the original value and make the correction traceable. If the question remains unresolved, keep the uncertainty visible rather than choosing a convenient value.

1
Confirm the definition.
Verify what the variable represents, its units, and the records to which the check applies.
2
Apply documented limits.
Count and list values outside any prespecified lower or upper bound; keep inclusive or exclusive limits explicit.
3
Inspect summaries and plots.
Review minimum, maximum, quartiles, and a suitable plot for unusual values, gaps, clusters, or boundary accumulation.
4
Investigate and document.
Compare flagged values with available source information and record whether each is confirmed, corrected with support, or unresolved.

Choosing an Approach and Recognizing Failure Modes

Prespecified limits and distribution-based rules serve different purposes. A documented hard limit can identify values that violate a defined domain. The IQR fence and visual summaries can identify unusual values without requiring a hard limit. Neither replaces the other: a value can pass a range check and still be unusual, or be statistically unusual while remaining valid.

ApproachWhat it helps identifyMain limitation
Prespecified plausibility limitsValues outside a documented, context-specific intervalLimits can be wrong, too broad, or applied to the wrong units
Summaries and plotsSkew, clusters, gaps, boundary patterns, and unusual observationsPatterns do not establish the cause or validity of a value
IQR fencesValues far from the middle half under a reproducible ruleFlags depend on the quartile convention and can be unhelpful for small or clustered datasets

Several errors are common. A frequent mistake is to treat every point beyond a boxplot fence as erroneous. The correction is to treat it as a review flag and seek context before any change. Another mistake is to define limits after seeing the values so that inconvenient observations disappear; document the rationale for limits before applying them where possible. A third is to inspect only the minimum and maximum: this can miss internal clusters or repeated values at a boundary. Use a plot as well as numerical summaries.

A distribution-based flag can be especially misleading for a small sample, a skewed variable, or a mixture of distinct groups. There is no general requirement that pharmacometric covariates, doses, or concentrations follow a normal distribution. Do not impose a normal-range rule without a justified model and purpose. Equally, do not assume that values within a broad range are correct: a factor-of-ten unit error may leave values inside an overly permissive interval.

Key takeaway: A range or distribution check identifies values and patterns to investigate. It does not by itself diagnose a data error, justify deleting an observation, or authorize replacing a value.

Check Your Understanding

Answer each question, then compare your reasoning with the solutions.

  1. A hypothetical time variable is specified as 0 to 36 hours inclusive. A record contains 40 hours. What does the check establish, and what does it not establish?
  2. For the ordered values 2, 3, 3, 5, 6, 20, use the median-of-halves convention to calculate \(Q_1\), \(Q_3\), the IQR, and the upper fence. Is 20 beyond the fence?
  3. A concentration is the largest value in a dataset but is within the documented assay-related plausibility interval. Should it be deleted automatically? Explain.
  4. Name two patterns a histogram can reveal that a minimum and maximum alone may not show.

Solutions. (1) Since \(40>36\) hours, the record violates the stated limit and is flagged. The check does not establish whether the source value is wrong or whether the limit was appropriate. (2) The lower half is 2, 3, 3, so \(Q_1=3\); the upper half is 5, 6, 20, so \(Q_3=6\). Thus \(IQR=6-3=3\), and the upper fence is \(6+1.5(3)=10.5\). Since \(20>10.5\), it is a potential outlier for review, not a proven error. (3) No. Passing the interval does not prove validity, but being the largest value does not prove error. Review context and supporting records before deciding. (4) A histogram can reveal clusters, gaps, skew, or a pile-up at a boundary that the minimum and maximum do not describe.

Clinical Biostats