Tutorials › Biostatistics › Quantile Regression for Clinical Outcomes

Regression & Clinical Modeling

Quantile Regression for Clinical Outcomes

A practical guide to quantile regression for clinical research, including median treatment effects, upper and lower outcome quantiles, clinical interpretation, model assumptions, confidence intervals, R implementation, and how quantile regression differs from ordinary least-squares regression.

Advanced 15 min read

What You'll Learn

  • Why mean regression can miss clinically important distributional effects
  • How quantile regression models the median and other outcome quantiles
  • How to interpret treatment effects at the 25th, 50th, and 75th percentiles
  • How quantile regression handles skewed and heterogeneous clinical outcomes
  • How to fit and interpret quantile regression models in R
  • How to report quantile-specific clinical treatment effects

Introduction

Many clinical regression analyses focus on the mean outcome. For example, an investigator may compare mean change from baseline between two treatment groups or fit a linear regression model for the average change in a biomarker.

The mean is often useful, but it does not tell the entire story.

Clinical outcomes can be strongly skewed, contain substantial heterogeneity, or respond differently among patients at different points of the outcome distribution.

For example, suppose a treatment changes a continuous clinical outcome by only a modest amount on average. It is possible that:

  • patients with relatively favorable outcomes improve very little, while
  • patients with severe outcomes experience a much larger improvement.

A mean regression model can obscure this pattern.

Quantile regression addresses this problem by modeling a specified conditional quantile of the outcome rather than only its conditional mean.

Key idea: Ordinary linear regression asks, "How does treatment change the average outcome?" Quantile regression asks, "How does treatment change a particular point of the outcome distribution?" The point can be the 25th percentile, median, 75th percentile, or another prespecified quantile.

What Is a Quantile?

A quantile is a point that divides a distribution according to cumulative probability.

The most familiar quantiles are:

Quantile Common Name Interpretation
0.25 25th percentile 25% of observations are at or below this value
0.50 Median 50% of observations are at or below this value
0.75 75th percentile 75% of observations are at or below this value
0.90 90th percentile 90% of observations are at or below this value

The median is therefore simply the 0.50 quantile.

Quantile regression generalizes regression from the mean to these other locations in the conditional outcome distribution.

Why the Median Can Be Clinically Useful

Consider a clinical outcome that is highly right-skewed.

Suppose most patients experience a modest change, but a small number experience very large changes.

Those extreme observations can substantially influence the mean.

The median is much less sensitive to extreme observations.

Quantile regression goes further by allowing investigators to examine several parts of the distribution rather than choosing between mean and median alone.

Clinical interpretation: If treatment effects differ substantially between the 25th, 50th, and 75th conditional quantiles, the treatment effect is heterogeneous across the outcome distribution.

Ordinary Least-Squares Regression

In ordinary linear regression, the model is commonly written:

$$ E(Y\mid X) = \beta_0+\beta_1X_1+\cdots+\beta_kX_k $$

The model describes the conditional mean of the outcome.

For example, consider:

$$ Y_i = \beta_0+ \beta_1\operatorname{Treatment}_i+ \beta_2\operatorname{Baseline}_i+ \varepsilon_i $$

The coefficient \(\beta_1\) represents the adjusted difference in the conditional mean outcome between treatment groups.

That is a useful estimand, but it is only one feature of the conditional distribution.

Quantile Regression Changes the Target

Instead of modeling:

$$ E(Y\mid X) $$

quantile regression models:

$$ Q_Y(\tau\mid X) $$

where \(\tau\) is the selected quantile.

For example:

$$ Q_Y(0.50\mid X) $$

is the conditional median, while:

$$ Q_Y(0.75\mid X) $$

is the conditional 75th percentile.

A basic linear quantile regression model is:

$$ Q_Y(\tau\mid X) = \beta_0(\tau) + \beta_1(\tau)X_1 + \cdots + \beta_k(\tau)X_k $$

The coefficients are allowed to depend on \(\tau\).

This is the central concept: There is not necessarily one treatment coefficient. There can be a different treatment coefficient at each modeled quantile.

Interpreting the Quantile Regression Coefficient

Suppose treatment is represented by a binary variable:

$$ X_{\text{trt}} = \begin{cases} 0,&\text{control}\\ 1,&\text{active treatment} \end{cases} $$

At quantile \(\tau\), the treatment coefficient is:

$$ \beta_1(\tau) $$

This represents the adjusted difference in the conditional \(\tau\)-th quantile of the outcome associated with treatment, under the fitted model.

For the median model, \(\beta_1(0.50)\) describes the treatment-associated difference in the conditional median outcome.

For the 75th percentile model, \(\beta_1(0.75)\) describes the corresponding difference at the conditional 75th percentile.

A Simple Example

Suppose a clinical trial evaluates change in a continuous symptom score at Week 12.

Assume that lower values indicate better symptoms.

A quantile regression analysis produces:

Quantile Treatment Coefficient 95% CI Interpretation
0.25 -1.2 -2.3 to -0.1 Small improvement in the lower portion of the outcome distribution
0.50 -3.5 -4.8 to -2.2 3.5-point lower conditional median
0.75 -7.1 -9.8 to -4.4 Larger improvement in the upper portion

The pattern suggests that the treatment effect is not constant across the distribution.

At the median, the adjusted treatment difference is 3.5 points.

At the 75th percentile, the difference is 7.1 points.

This may indicate that patients with relatively high symptom scores experience a larger treatment benefit.

Do not interpret the 75th-percentile coefficient as saying that every patient improves by 7.1 points. It describes a difference in the conditional 75th percentile, not an individual-level guarantee.

Why Quantile Regression Is Attractive in Clinical Research

Clinical outcomes frequently violate the simple assumptions that make mean regression particularly convenient.

Examples include:

  • Highly skewed laboratory measurements
  • Healthcare utilization and cost outcomes
  • Length of stay
  • Time spent in a symptom state
  • Change scores with substantial heterogeneity
  • Patient-reported outcomes with ceiling or floor effects
  • Functional scores with asymmetric distributions
  • Biomarkers with extreme values

Quantile regression can provide a more complete description of treatment effects when the scientific question concerns different portions of the outcome distribution.

Mean Regression vs. Quantile Regression

Feature Mean Regression Quantile Regression
Primary target Conditional mean Specified conditional quantile
Median effect directly estimated? No Yes, using \(\tau=0.50\)
Upper-tail effects Not directly Yes
Lower-tail effects Not directly Yes
Sensitivity to extreme outcomes Often higher Generally lower
Effect heterogeneity across distribution May be obscured Can be characterized
Normal outcome required? No No

The Check Function and Quantile Loss

Quantile regression is not estimated by ordinary least squares.

Instead, the model minimizes an asymmetric loss function known as the check function, or pinball loss.

For quantile \(\tau\), define:

$$ \rho_\tau(u) = u\left[\tau-I(u<0)\right] $$

where \(u\) is the residual.

Equivalently:

$$ \rho_\tau(u) = \begin{cases} \tau u,&u\ge0\\ (\tau-1)u,&u<0 \end{cases} $$

The fitted coefficients minimize the sum of these asymmetric losses.

At the median, \(\tau=0.50\), the loss becomes symmetric and is closely related to minimizing absolute deviations.

Why is the loss asymmetric? For the 75th percentile, the model places different penalties on observations above and below the fitted quantile so that the estimated line represents the 75th rather than the 50th percentile.

The Quantile Regression Model

Suppose the outcome is a continuous clinical measure \(Y\), treatment is \(T\), and baseline disease severity is \(B\).

The quantile regression model at quantile \(\tau\) is:

$$ Q_Y(\tau\mid T,B) = \beta_0(\tau) + \beta_1(\tau)T + \beta_2(\tau)B $$

The treatment coefficient is now explicitly indexed by \(\tau\).

At the 25th percentile:

$$ Q_Y(0.25\mid T,B) = \beta_0(0.25) + \beta_1(0.25)T + \beta_2(0.25)B $$

At the median:

$$ Q_Y(0.50\mid T,B) = \beta_0(0.50) + \beta_1(0.50)T + \beta_2(0.50)B $$

And at the 75th percentile:

$$ Q_Y(0.75\mid T,B) = \beta_0(0.75) + \beta_1(0.75)T + \beta_2(0.75)B $$

A Worked Clinical Example

Consider a hypothetical randomized clinical trial comparing an active treatment with placebo.

The primary continuous outcome is change from baseline in a symptom severity score at Week 12.

Lower values represent better outcomes.

Suppose the analysis adjusts for baseline symptom severity.

Variable Description
\(Y\) Week 12 symptom score
\(T\) 1 = active treatment, 0 = placebo
\(B\) Baseline symptom score
\(\tau\) 0.25, 0.50, 0.75

The scientific question is not merely whether the treatment changes the average symptom score.

The investigators also want to know whether the treatment effect differs among patients with relatively low, typical, and high Week 12 symptom scores.

Fit Three Quantile Regression Models

Three models can be fit:

$$ Q_Y(0.25\mid T,B) $$
$$ Q_Y(0.50\mid T,B) $$
$$ Q_Y(0.75\mid T,B) $$

The resulting treatment estimates might look like:

Quantile Estimate 95% CI P-value
25th -1.4 -2.7 to -0.1 0.036
50th -3.2 -4.5 to -1.9 <0.001
75th -6.0 -8.1 to -3.9 <0.001

The estimated treatment effect becomes progressively larger at higher quantiles.

This suggests that treatment benefit may be greater among patients toward the higher end of the Week 12 symptom-score distribution.

Step 1: Interpret the 25th Percentile

The estimated treatment coefficient is:

$$ \hat{\beta}_1(0.25)=-1.4 $$

Holding baseline symptom severity constant, the model estimates a 1.4-point lower conditional 25th percentile for the active treatment compared with placebo.

Because lower scores represent better symptoms, this corresponds to a favorable treatment effect.

Step 2: Interpret the Median

The median treatment coefficient is:

$$ \hat{\beta}_1(0.50)=-3.2 $$

After adjustment for baseline severity, the active treatment is associated with a 3.2-point lower conditional median symptom score compared with placebo.

This is the quantile-regression analogue of a median treatment effect in the specified conditional model.

Step 3: Interpret the 75th Percentile

The 75th-percentile treatment coefficient is:

$$ \hat{\beta}_1(0.75)=-6.0 $$

Holding baseline severity constant, the estimated conditional 75th percentile is 6 points lower in the active-treatment group.

Because lower scores are clinically preferable, this represents a larger beneficial effect than the median estimate.

Distributional conclusion: The treatment effect appears heterogeneous across the outcome distribution: approximately -1.4 points at the 25th percentile, -3.2 points at the median, and -6.0 points at the 75th percentile. This pattern would be difficult to describe using a single mean treatment coefficient.

Why Baseline Adjustment Matters

Quantile regression can include the same types of covariates commonly used in other regression models.

For example:

  • Treatment group
  • Baseline outcome
  • Age
  • Sex
  • Disease severity
  • Study region
  • Other prespecified prognostic variables

A baseline-adjusted model might be:

$$ Q_Y(\tau\mid T,B,A) = \beta_0(\tau) + \beta_1(\tau)T + \beta_2(\tau)B + \beta_3(\tau)A $$

where \(A\) represents age.

The treatment coefficient is then interpreted conditional on the included covariates.

Quantile Regression Does Not Require Normally Distributed Outcomes

One attractive feature of quantile regression is that it does not require the outcome itself to follow a normal distribution.

This can be useful for clinical outcomes that are:

  • Skewed
  • Heavy-tailed
  • Heteroscedastic
  • Non-normal

However, this does not mean that quantile regression is assumption-free.

The validity of inference still depends on issues such as model specification, dependence, sample size, covariate structure, and the method used to estimate standard errors.

Important distinction: Quantile regression avoids the requirement that the outcome be normally distributed for the basic model formulation. It does not eliminate the need to assess whether the fitted conditional-quantile model is scientifically reasonable.

Heteroscedasticity and Quantile Regression

In ordinary least-squares regression, heteroscedasticity means that the variance of the residuals changes across the range of predicted values or covariates.

Quantile regression is particularly useful when the spread of the outcome distribution changes with predictors.

For example, suppose variability in a biomarker becomes much larger among patients with severe disease.

A mean model may estimate the average treatment effect but provide limited information about this changing spread.

Quantile regression can show whether treatment effects differ at lower and upper conditional quantiles.

Quantile Regression and Effect Heterogeneity

Suppose the estimated treatment effects are:

Quantile Treatment Effect
0.10 -0.5
0.25 -1.4
0.50 -3.2
0.75 -6.0
0.90 -8.1

The treatment effect clearly becomes larger at higher quantiles.

This is evidence of distributional heterogeneity in the conditional treatment effect.

The pattern could suggest that patients with worse outcomes benefit more from treatment.

However, the clinical interpretation must consider what the outcome scale means and whether the estimated differences are clinically meaningful.

Quantile Regression Is Not the Same as Subgroup Analysis

A common misconception is that a 75th-percentile treatment effect represents a treatment effect in a particular subgroup of patients.

It does not.

Quantile regression partitions the outcome distribution, not the patient population according to a baseline characteristic.

For example:

  • Age > 65 years is a patient subgroup.
  • Baseline disease severity > 8 is a patient subgroup.
  • The 75th percentile of the outcome is a location in the outcome distribution.

These are fundamentally different concepts.

Remember: Quantile regression asks how treatment relates to different conditional quantiles of the outcome. It does not automatically identify biological subgroups.

Quantile Regression vs. Median Regression

Median regression is simply quantile regression at:

$$ \tau=0.50 $$

Therefore:

$$ \text{Median regression} = \text{Quantile regression at }\tau=0.50 $$

Calling the method "median regression" is appropriate when only the median is being modeled.

The broader term "quantile regression" is preferable when multiple quantiles are analyzed.

Quantiles Commonly Used in Clinical Research

Quantile Potential Purpose
0.10 Examine lower-tail behavior
0.25 Lower portion of the outcome distribution
0.50 Median treatment effect
0.75 Upper portion of the distribution
0.90 Upper-tail behavior

There is no universal requirement to use these particular quantiles.

The selected quantiles should be motivated by the clinical question and supported by adequate sample size.

Extreme Quantiles Require More Data

Estimating the median is generally easier than estimating a very extreme quantile.

For example, the 90th percentile is estimated using relatively little information from the upper tail.

In small clinical trials, estimates at \(\tau=0.90\) or \(\tau=0.10\) can therefore be unstable.

Practical rule: Do not automatically fit a large collection of extreme quantiles simply because software makes it easy to do so. Quantile selection should reflect the sample size, precision, and scientific objective.

Confidence Intervals

Quantile regression coefficients should generally be reported with confidence intervals.

For a treatment coefficient at quantile \(\tau\):

$$ \hat{\beta}_1(\tau) \pm z_{1-\alpha/2} SE\left[\hat{\beta}_1(\tau)\right] $$

This is the familiar large-sample form when an appropriate standard error is available.

In practice, quantile regression standard errors can be estimated using different approaches, including asymptotic methods and bootstrap methods.

Bootstrap Inference

Bootstrap methods are frequently useful for quantile regression inference, particularly when the sampling distribution is difficult to approximate reliably.

A basic bootstrap procedure is:

1
Resample patients from the original dataset with replacement.
2
Fit the quantile regression model to the bootstrap sample.
3
Store the treatment coefficient.
4
Repeat the procedure many times.
5
Use the empirical bootstrap distribution to construct confidence intervals.

The bootstrap must respect the study design.

For example, in a randomized trial, the resampling strategy may need to preserve treatment structure or other relevant clustering depending on the analysis.

Independent Observations Are Important

The simplest quantile regression model assumes independent observations.

Clinical datasets often violate this assumption.

Examples include:

  • Repeated measurements from the same patient
  • Patients nested within clinical sites
  • Matched observations
  • Cluster-randomized trials
  • Longitudinal assessments

Standard quantile regression should not simply be applied to repeated measurements while pretending that all observations are independent.

Longitudinal data: When multiple observations per patient are present, specialized methods such as longitudinal or mixed-effects quantile regression may be more appropriate, depending on the scientific estimand and study design.

Quantile Regression With Categorical Covariates

Categorical predictors can be incorporated in the same general way as in ordinary regression.

For example, with treatment and sex:

$$ Q_Y(\tau\mid T,S) = \beta_0(\tau) + \beta_1(\tau)T + \beta_2(\tau)S $$

The treatment coefficient continues to describe the adjusted difference in the specified conditional quantile.

Interaction Terms in Quantile Regression

Quantile regression can also investigate whether a treatment effect varies according to another covariate.

For treatment \(T\) and baseline severity \(B\):

$$ Q_Y(\tau\mid T,B) = \beta_0(\tau) + \beta_1(\tau)T + \beta_2(\tau)B + \beta_3(\tau)(T\times B) $$

The interaction coefficient is:

$$ \beta_3(\tau) $$

This coefficient can differ across quantiles.

Therefore, treatment-effect modification may itself be distribution-dependent.

Caution: Interaction analyses in quantile regression can become difficult to interpret quickly. They should be driven by a prespecified scientific hypothesis rather than an exhaustive search across many quantiles and covariates.

Quantile Regression and Treatment Effect Heterogeneity

One of the most interesting applications in clinical research is exploring whether the treatment effect varies across the outcome distribution.

Suppose:

$$ \beta_1(0.25) = -1 $$
$$ \beta_1(0.50) = -3 $$
$$ \beta_1(0.75) = -6 $$

The treatment effect is much larger at the upper quantiles.

This can provide clinically important information that would not be apparent from a single mean difference.

But Different Coefficients Do Not Automatically Prove Heterogeneity

Suppose the estimates are:

Quantile Estimate 95% CI
25th -1.0 -3.0 to 1.0
50th -3.0 -5.0 to -1.0
75th -6.0 -10.0 to -2.0

The point estimates differ.

But that alone does not establish that the true treatment effects are statistically different from one another.

If the scientific question is whether:

$$ \beta_1(0.25) = \beta_1(0.75) $$

then an appropriate formal comparison is needed.

Important: "Significant at one quantile but not significant at another" is not itself a valid statistical test of whether the two treatment effects differ.

Comparing Quantile-Specific Effects

A scientifically relevant contrast might be:

$$ \Delta = \beta_1(0.75) - \beta_1(0.25) $$

A large value of \(\Delta\), with an appropriate confidence interval or test, can provide evidence that the treatment effect differs across the distribution.

Such comparisons should account for the fact that multiple quantiles may be being evaluated.

Multiple Quantiles and Multiplicity

Suppose an investigator fits models at:

  • 0.10
  • 0.25
  • 0.50
  • 0.75
  • 0.90

and reports a separate P-value for each treatment effect.

If all of these analyses are being used for confirmatory claims, multiplicity can become important.

The appropriate strategy depends on whether the quantiles are:

  • Primary and secondary estimands
  • Exploratory descriptive analyses
  • Part of a prespecified hierarchical testing strategy
  • Selected after examining the data
Best practice: Prespecify the primary quantile or primary distributional contrast when a confirmatory claim is intended. Treat extensive post hoc quantile searching as exploratory unless the multiplicity and estimand strategy has been addressed.

R Implementation

The most common R package for classical quantile regression is quantreg.

install.packages("quantreg")
library(quantreg)

Suppose the dataset is called trial and contains:

  • outcome — Week 12 clinical outcome
  • treatment — treatment indicator
  • baseline — baseline outcome
  • age — patient age

Fit a Median Regression Model

fit_median <- rq(
  outcome ~ treatment + baseline + age,
  tau = 0.50,
  data = trial
)

summary(fit_median)

The argument:

tau = 0.50

specifies the conditional median.

Fit a 25th-Percentile Model

fit_q25 <- rq(
  outcome ~ treatment + baseline + age,
  tau = 0.25,
  data = trial
)

summary(fit_q25)

This estimates the conditional 25th percentile.

Fit a 75th-Percentile Model

fit_q75 <- rq(
  outcome ~ treatment + baseline + age,
  tau = 0.75,
  data = trial
)

summary(fit_q75)

This estimates the conditional 75th percentile.

Fit Several Quantiles at Once

The quantreg package can estimate several quantiles in one model call.

fit_multi <- rq(
  outcome ~ treatment + baseline + age,
  tau = c(0.25, 0.50, 0.75),
  data = trial
)

summary(fit_multi)

This is often convenient for examining how the treatment coefficient changes across the outcome distribution.

Bootstrap Standard Errors in R

A bootstrap-based summary can be requested using:

summary(
  fit_multi,
  se = "boot",
  R = 1000
)

where R = 1000 specifies the number of bootstrap replicates.

For a production clinical analysis, the bootstrap approach and resampling scheme should be specified deliberately rather than chosen solely because it is convenient.

Extracting the Treatment Coefficients

Suppose treatment is represented by a variable called treatment.

coef(fit_multi)

The resulting matrix contains coefficient estimates for the modeled quantiles.

For example, conceptually the output may resemble:

                 tau= 0.25   tau= 0.50   tau= 0.75

(Intercept)          8.10        9.40       11.20
treatment           -1.40       -3.20       -6.00
baseline             0.52        0.48        0.41
age                  0.03        0.02        0.01

The treatment row is particularly important.

Here the estimated treatment effects are:

$$ \hat{\beta}_1(0.25)=-1.40 $$
$$ \hat{\beta}_1(0.50)=-3.20 $$
$$ \hat{\beta}_1(0.75)=-6.00 $$

Visualizing Quantile Regression

A useful exploratory analysis is to estimate treatment effects over a grid of quantiles.

taus <- seq(0.10, 0.90, by = 0.05)

fit_grid <- rq(
  outcome ~ treatment + baseline + age,
  tau = taus,
  data = trial
)

coef_grid <- coef(fit_grid)

coef_grid["treatment", ]

This allows the treatment coefficient to be examined as a function of the quantile.

A plot of:

$$ \tau \quad\text{vs.}\quad \hat{\beta}_1(\tau) $$

can reveal whether the treatment effect is approximately constant or changes systematically across the outcome distribution.

Quantile Process Interpretation

Imagine the treatment coefficient follows this pattern:

\(\tau\) Treatment Effect
0.10 -0.3
0.20 -0.8
0.30 -1.5
0.40 -2.4
0.50 -3.2
0.60 -4.0
0.70 -5.1
0.80 -6.4
0.90 -7.3

This pattern suggests that the treatment effect becomes increasingly favorable at higher conditional quantiles.

A single mean regression coefficient would compress this entire pattern into one number.

Quantile Regression vs. Transforming the Outcome

Another common strategy for skewed outcomes is to transform the outcome.

For example:

$$ Y^*=\log(Y) $$

and then fit ordinary linear regression to \(Y^*\).

Transformation can be useful, but it answers a different question.

Quantile regression directly models a specified quantile of the original outcome scale.

Clinical advantage: When the outcome scale itself has a meaningful clinical interpretation, quantile regression can provide treatment effects directly on that scale without requiring a transformation to define the primary estimand.

Quantile Regression vs. Robust Regression

Robust regression and quantile regression are related in that both can be useful when ordinary least squares is sensitive to unusual observations.

But they have different goals.

Method Primary Goal
OLS regression Estimate conditional mean
Robust regression Estimate a regression relationship with reduced sensitivity to influential observations
Median regression Estimate conditional median
Quantile regression Estimate conditional quantiles

Quantile regression should therefore not be described simply as a "robust version of linear regression."

Clinical Outcomes That Can Benefit From Quantile Regression

Patient-Reported Outcomes

Patient-reported outcomes can exhibit skewness, ceiling effects, and substantial heterogeneity.

Quantile regression can help determine whether treatment effects are similar among patients with relatively low and high symptom burden.

Healthcare Costs

Cost outcomes are often strongly right-skewed.

A mean cost difference can be dominated by a relatively small number of patients with extremely high costs.

Quantile regression can characterize treatment differences at several points of the conditional cost distribution.

Length of Stay

Hospital length of stay can have a long upper tail.

Quantile regression can examine whether a treatment primarily affects typical patients or produces a particularly large effect among patients with long hospitalizations.

Biomarkers

Biomarker concentrations can be highly skewed.

Quantile regression can characterize treatment effects without requiring the outcome distribution to be approximately symmetric.

A More Detailed Clinical Example: Length of Stay

Suppose a clinical study evaluates an intervention intended to shorten hospitalization.

The outcome is length of stay in days.

The distribution is strongly right-skewed.

An ordinary regression model produces:

$$ \hat{\beta}_{\text{treatment}} = -0.8 $$

This suggests an average adjusted reduction of 0.8 days.

Now suppose quantile regression gives:

Quantile Treatment Effect
25th -0.2 days
50th -0.5 days
75th -1.4 days
90th -3.0 days

This tells a much more detailed clinical story.

The intervention appears to have relatively little effect among patients with shorter hospital stays but a substantially larger effect among patients in the upper tail.

The intervention might therefore be particularly valuable for reducing prolonged hospitalization.

Why this matters: A mean reduction of 0.8 days alone does not reveal whether the benefit is distributed evenly or concentrated among patients with unusually long stays.

Conditional vs. Unconditional Quantiles

This distinction is extremely important.

An ordinary sample median is an unconditional quantile of the observed outcome distribution.

Quantile regression estimates a conditional quantile.

For example:

$$ Q_Y(0.50\mid T,B) $$

is the median of the outcome conditional on treatment and baseline severity.

It is not simply the median outcome among all patients in the treatment group.

Key distinction: A regression-adjusted conditional median should not automatically be described as the raw observed median for a treatment group.

Quantile Regression and Causal Interpretation

In a randomized clinical trial, treatment assignment can support causal interpretation under the usual assumptions of the randomized design.

However, the interpretation of a quantile treatment effect requires care.

A regression coefficient at a conditional quantile is not automatically identical to every possible definition of a causal quantile treatment effect.

In particular, conditional and marginal treatment effects can differ.

Investigators should therefore define the estimand clearly.

For regulatory or confirmatory work: Specify exactly whether the target is a conditional quantile regression coefficient, a marginal quantile treatment effect, or another distributional estimand.

Missing Data

Quantile regression does not solve missing-data problems.

If Week 12 outcomes are missing, simply analyzing complete cases may introduce bias when missingness is informative.

Potential approaches include:

  • Prespecified complete-case analysis
  • Multiple imputation
  • Inverse-probability weighting
  • Sensitivity analyses
  • Other model-based approaches

The appropriate method depends on the estimand, missingness mechanism, trial design, and regulatory context.

Ceiling and Floor Effects

Quantile regression can be informative for patient-reported or functional outcomes with ceiling or floor effects, but these features also create statistical challenges.

Suppose a large fraction of patients have the best possible score.

Several quantiles may then be concentrated at the boundary.

A simple continuous quantile regression model may not fully capture the data-generating process.

Do not force quantile regression onto bounded or highly discrete outcomes without considering the measurement scale. For strongly discrete, ordinal, censored, or zero-inflated outcomes, another model may be more appropriate.

When Quantile Regression Is a Poor Choice

Quantile regression is powerful, but it is not universally appropriate.

Consider another modeling framework when:

  • The outcome is binary.
  • The outcome is a nominal categorical variable.
  • The outcome is strongly ordinal and has few categories.
  • The outcome contains extensive censoring.
  • Repeated measurements require specialized dependence modeling.
  • The scientific estimand is fundamentally a time-to-event quantity.
  • The sample size is too small to estimate the desired quantiles reliably.

The method should follow the endpoint and estimand, not the other way around.

Sample Size Considerations

Sample-size planning for quantile regression can be more complicated than planning for ordinary mean regression.

The precision of a quantile estimate depends strongly on:

  • The target quantile \(\tau\)
  • The sample size
  • The density of the outcome near that quantile
  • The number and distribution of covariates
  • The amount of residual variation
  • The treatment allocation ratio

Extreme quantiles generally require substantially more information than central quantiles.

A study powered for a mean difference is not automatically powered for a clinically important 90th-percentile treatment effect.

Planning principle: If a quantile-specific treatment effect is intended to support a primary confirmatory conclusion, sample-size planning should be based on that quantile-specific estimand rather than assuming that a conventional mean-based sample-size calculation is sufficient.

Quantile Regression and Clinical Trial Reporting

A clear report should identify:

  • The outcome definition
  • The quantiles analyzed
  • The regression covariates
  • The treatment coding
  • The estimation method
  • The standard-error method
  • The confidence-interval method
  • The handling of missing data
  • The primary quantile, if one was prespecified
  • Any multiplicity strategy
  • Any sensitivity analyses

Example Statistical Reporting

A concise report might state:

Example: "Baseline-adjusted quantile regression was used to estimate the treatment difference in Week 12 symptom score at the 25th, 50th, and 75th conditional quantiles. At the median, treatment was associated with a 3.2-point lower symptom score compared with placebo (95% CI -4.5 to -1.9). The corresponding treatment differences were -1.4 points (95% CI -2.7 to -0.1) at the 25th quantile and -6.0 points (95% CI -8.1 to -3.9) at the 75th quantile."

The wording makes clear that the estimates refer to conditional quantiles and not simply raw group medians.

Quantile Regression in a Randomized Trial

For a simple randomized trial, a model may contain only treatment:

$$ Q_Y(\tau\mid T) = \beta_0(\tau) + \beta_1(\tau)T $$

This provides a direct quantile-specific treatment comparison.

A more efficient baseline-adjusted analysis may include the baseline outcome:

$$ Q_Y(\tau\mid T,B) = \beta_0(\tau) + \beta_1(\tau)T + \beta_2(\tau)B $$

The exact covariate strategy should be prespecified and aligned with the primary estimand.

Checking the Model

Quantile regression does not have a single diagnostic plot analogous to the ordinary residual-vs-fitted plot that solves every model-checking problem.

Useful diagnostics include:

  • Inspection of fitted conditional quantiles
  • Assessment of influential observations
  • Comparison of estimated quantiles across plausible model specifications
  • Examination of coefficient stability across quantiles
  • Assessment of nonlinear covariate relationships
  • Evaluation of bootstrap stability
  • Comparison with alternative reasonable models

Nonlinear Covariate Effects

A linear term for age assumes that its association with the specified conditional quantile is linear.

For example:

$$ Q_Y(\tau\mid X) = \beta_0(\tau) + \beta_1(\tau)X $$

may be inadequate if the relationship is curved.

Quantile regression can incorporate:

  • Polynomial terms
  • Splines
  • Restricted cubic splines
  • Other flexible functions

For example:

library(splines)

fit_spline <- rq(
  outcome ~ treatment + ns(age, df = 4) + baseline,
  tau = 0.50,
  data = trial
)

The flexibility should be justified by the sample size and scientific model.

Quantile Crossing

When several quantile regression models are fitted separately, an undesirable phenomenon called quantile crossing can occur.

For example, the estimated 75th percentile should ordinarily not fall below the estimated 50th percentile at the same covariate values.

But separately estimated models can sometimes produce fitted curves that cross.

Why does crossing matter? Quantiles are ordered by definition. If a fitted 75th percentile falls below a fitted 50th percentile for some covariate pattern, the model is producing a distribution that is internally inconsistent.

Possible approaches include constrained estimation or other methods designed to maintain quantile ordering.

Quantile Regression and the Outcome Distribution

It is useful to think of the conditional outcome distribution as a set of layers.

1
The 25th percentile describes the lower portion of the conditional outcome distribution.
2
The 50th percentile describes its center.
3
The 75th percentile describes the upper portion.
4
Comparing treatment coefficients across these layers reveals whether the treatment effect changes across the distribution.

Common Mistakes

  1. Calling a quantile coefficient an individual treatment effect. A quantile coefficient describes a conditional distributional feature, not a guaranteed effect for an individual patient.
  2. Assuming quantile regression is completely assumption-free. The method has fewer distributional assumptions than ordinary least squares, but model specification and inference still matter.
  3. Confusing conditional and unconditional quantiles. A regression-adjusted conditional median is not necessarily the same as the raw observed group median.
  4. Using very extreme quantiles in a small trial. Tail quantiles can be unstable when sample size is limited.
  5. Claiming heterogeneity because one quantile is significant and another is not. The two coefficients must be compared directly.
  6. Ignoring repeated measurements. Standard quantile regression assumes an appropriate independence structure.
  7. Ignoring missing outcomes. Quantile regression does not automatically solve missing-data bias.
  8. Running dozens of quantiles without a prespecified analysis plan. Extensive quantile searching can create multiplicity and interpretation problems.
  9. Assuming quantile regression is always preferable to mean regression. The correct method depends on the scientific question and estimand.
  10. Ignoring the clinical scale. A statistically different quantile effect may not represent a clinically meaningful treatment benefit.

A Practical Quantile Regression Workflow

1
Define the continuous clinical outcome and its direction of clinical benefit.
2
Define the target estimand: mean, median, specific quantile, or distributional contrast.
3
Select clinically meaningful quantiles.
4
Prespecify treatment and adjustment covariates.
5
Fit the quantile regression models.
6
Obtain appropriate standard errors and confidence intervals.
7
Examine coefficient patterns across quantiles.
8
Assess nonlinearities, influential observations, and model stability.
9
Address missing data and dependence structures.
10
Interpret statistical results in terms of clinical importance.

Example R Analysis From Start to Finish

The following example illustrates a basic analysis workflow.

library(quantreg)

# Median model
fit_q50 <- rq(
  outcome ~ treatment + baseline + age,
  tau = 0.50,
  data = trial
)

# 25th percentile
fit_q25 <- rq(
  outcome ~ treatment + baseline + age,
  tau = 0.25,
  data = trial
)

# 75th percentile
fit_q75 <- rq(
  outcome ~ treatment + baseline + age,
  tau = 0.75,
  data = trial
)

# Model summaries
summary(fit_q25)
summary(fit_q50)
summary(fit_q75)

The primary treatment coefficient can then be extracted from each model.

coef(fit_q25)["treatment"]
coef(fit_q50)["treatment"]
coef(fit_q75)["treatment"]

This produces the treatment effect at each target quantile.

Testing Whether Treatment Effects Vary Across Quantiles

Suppose the treatment coefficients are:

$$ \hat{\beta}_1(0.25)=-1.4 $$
and:
$$ \hat{\beta}_1(0.75)=-6.0 $$

The difference is:

$$ \hat{\Delta} = -6.0-(-1.4) = -4.6 $$

This means the estimated treatment effect at the 75th quantile is 4.6 points more favorable than the estimated treatment effect at the 25th quantile.

However, a formal inference procedure is needed before concluding that the difference is statistically significant.

Mean Effect and Quantile Effects Can Tell Different Stories

Consider the following hypothetical results:

Estimand Treatment Effect
Mean -2.8
25th percentile -0.5
Median -2.0
75th percentile -5.5

The mean effect of -2.8 provides a useful summary.

But it does not reveal that the effect appears substantially larger in the upper part of the outcome distribution.

This may matter greatly clinically.

What Quantile Regression Adds to the Clinical Story

A mean analysis might conclude:

Mean-based conclusion: "The treatment reduced the outcome by an average of 2.8 units."

A quantile analysis can provide a richer conclusion:

Distributional conclusion: "The estimated treatment difference was modest at the lower quartile and increased progressively through the median and upper quartile, suggesting greater treatment benefit among patients toward the upper portion of the conditional outcome distribution."

The second statement describes information that the mean alone cannot provide.

Quantile Regression Does Not Replace Clinical Judgment

A statistically interesting pattern across quantiles does not automatically mean that treatment should be targeted to a particular group.

Investigators should consider:

  • Clinical relevance of the effect size
  • Precision of the estimates
  • Prespecification
  • Multiplicity
  • Biological plausibility
  • Consistency across analyses
  • Missing-data assumptions
  • Generalizability

Quantile regression is best viewed as a tool for describing and testing distributional treatment effects, not as a mechanism for automatically discovering clinically actionable subgroups.

How to Choose the Primary Quantile

The median is often a natural primary quantile because it is familiar, relatively stable, and less sensitive to extreme observations.

However, the median is not always the clinically most relevant estimand.

For example, if the primary clinical question concerns prolonged hospital stays, the 75th or 90th percentile might be scientifically meaningful.

The choice should therefore be based on:

  • The clinical question
  • The outcome distribution
  • The expected treatment mechanism
  • Sample size
  • Precision
  • Clinical interpretability

Quantile Regression and Protocol Design

If quantile regression is intended as a confirmatory analysis, the protocol and statistical analysis plan should identify:

  • The primary outcome
  • The primary quantile
  • Secondary quantiles
  • The treatment contrast
  • Adjustment covariates
  • Standard-error methodology
  • Confidence-interval methodology
  • Missing-data handling
  • Multiplicity strategy
  • Sensitivity analyses

This is particularly important when several quantiles will be tested.

Quantile Regression and Regulatory Interpretation

For regulatory-facing analyses, the estimand must be especially clear.

A statement such as:

"The median treatment effect was -3.2."

is less precise than:

"The baseline-adjusted treatment coefficient from the \(\tau=0.50\) conditional quantile regression model was -3.2 points."

The latter identifies exactly what was estimated.

Summary Table

Concept Key Point
Mean regression Models the conditional mean
Quantile regression Models a specified conditional quantile
Median regression Quantile regression at \(\tau=0.50\)
25th percentile Describes the lower portion of the conditional outcome distribution
75th percentile Describes the upper portion of the conditional outcome distribution
Treatment coefficient Quantile-specific adjusted treatment difference
Skewed outcomes Quantile regression can be particularly informative
Extreme quantiles Require sufficient information and can be unstable in small samples
Repeated measures Require methods that account for within-patient dependence
Multiple quantiles Multiplicity and interpretation should be considered

The Most Important Concept

The most important idea in quantile regression is that a treatment effect does not have to be summarized by a single number.

A mean treatment effect answers:

$$ \text{How does treatment change the conditional mean?} $$

Quantile regression allows a series of questions:

$$ \text{How does treatment change the 25th percentile?} $$
$$ \text{How does treatment change the median?} $$
$$ \text{How does treatment change the 75th percentile?} $$

If those effects are similar, the treatment effect may be relatively uniform across the outcome distribution.

If they differ substantially, the treatment may have a distributionally heterogeneous effect.

Bottom line: Quantile regression extends clinical regression beyond the mean by estimating treatment effects at specific points of the conditional outcome distribution. The median model is obtained at \(\tau=0.50\), while lower and upper quantiles can reveal treatment effects that would otherwise be hidden by a single mean estimate. It is particularly useful for skewed or heterogeneous continuous outcomes, but the quantile, estimand, covariates, inference method, missing-data strategy, and multiplicity approach should be prespecified when the analysis is confirmatory.

References

Koenker, R. & Bassett, G. (1978). Regression quantiles. Econometrica, 46(1), 33–50.
Koenker, R. (2005). Quantile Regression. Cambridge University Press.
Koenker, R. & Hallock, K.F. (2001). Quantile regression. Journal of Economic Perspectives, 15(4), 143–156.
Hao, L. & Naiman, D.Q. (2007). Quantile Regression. SAGE Publications.
Davino, C., Furno, M. & Vistocco, D. (2014). Quantile Regression: Theory and Applications. Wiley.
Koenker, R. (2024). quantreg: Quantile Regression. R package documentation.