Tutorials › Biostatistics › Forest Plots for Subgroup Analyses

Clinical Trial Analysis

Forest Plots for Subgroup Analyses

A practical guide to designing, interpreting, and programming forest plots for subgroup analyses, including effect estimates, confidence intervals, interaction tests, subgroup hierarchy, multiplicity, missing data, and publication-quality implementation in R.

Intermediate22 min read

What You'll Learn

  • What a subgroup forest plot displays
  • How effect estimates and confidence intervals are represented
  • How to choose appropriate measures for binary, continuous, and time-to-event endpoints
  • Why interaction tests are usually more informative than separate subgroup p-values
  • How to distinguish prespecified from exploratory subgroup analyses
  • How to handle small subgroups, missing data, and multiplicity
  • How to structure subgroup data for analysis and plotting
  • How to create publication-quality forest plots in R

Introduction

Subgroup analyses are used to investigate whether a treatment effect is consistent across clinically important patient characteristics. Common subgroup variables include age, sex, disease stage, geographic region, baseline risk, biomarker status, prior treatment, and other factors defined in the protocol or statistical analysis plan.

A forest plot provides a compact way to display these subgroup-specific treatment effects together with their uncertainty. Each subgroup is represented by an effect estimate and confidence interval, allowing the reader to compare the direction, magnitude, and precision of the estimated treatment effect.

The forest plot is therefore not simply a decorative summary. It is a statistical display that should be tied closely to the endpoint definition, analysis population, treatment contrast, model, subgroup definition, and prespecified analysis plan.

Key idea: A forest plot shows estimated treatment effects and their uncertainty across subgroups. It does not, by itself, establish that treatment effects differ between subgroups. Evidence for treatment-effect heterogeneity should generally come from an appropriate treatment-by-subgroup interaction analysis.

What Is a Forest Plot?

A forest plot places several estimates on a common horizontal scale. The central marker represents the estimated treatment effect, while the horizontal line represents its confidence interval.

For a ratio measure such as a hazard ratio, risk ratio, or odds ratio, the line of no treatment effect is typically:

Ratio measures: the null value is 1. Values below 1 may favor treatment when the treatment effect is defined as treatment relative to control, while values above 1 may favor control. The direction must always be defined explicitly in the figure.

For a difference measure, such as a mean difference or risk difference, the null value is 0.

The Basic Structure

A typical subgroup forest plot contains:

  • Subgroup label: the characteristic and category being displayed.
  • Sample size: often the number of randomized or analyzed participants in that subgroup.
  • Effect estimate: the treatment-versus-control estimate.
  • Confidence interval: the uncertainty around the estimate.
  • Reference line: the null treatment effect.
  • Overall estimate: when appropriate, a primary analysis estimate displayed alongside the subgroup results.

An Actual Example

Figure 1. Forest plot with subgroup-specific treatment effects
Illustrative hazard-ratio estimates. Squares represent subgroup estimates and horizontal lines represent 95% confidence intervals. The vertical line at 1 represents no treatment effect.
Figure 1. Forest plot with subgroup-specific treatment effects Hazard ratio / odds ratio / risk ratio (log scale) 0.25 0.5 1 2 4 Age <65 years n=214 Age ≥65 years n=186 Male n=231 Female n=169 Stage III n=142 Stage IV n=258 Overall Favors treatment Favors control

All values are simulated for teaching purposes. The apparent crossing of the null line should not be interpreted as proof of a treatment-by-subgroup interaction.

How to Read a Forest Plot

Start by identifying the effect measure and the direction of the treatment contrast. Then locate the null line and examine each subgroup estimate and confidence interval.

Visual featureInterpretation
Marker left of 1 for a ratio measureEstimated effect favors treatment if treatment/control is defined in that direction.
Marker right of 1Estimated effect favors control under the same convention.
Confidence interval crosses 1The subgroup confidence interval includes the null value.
Confidence interval entirely below 1The estimated effect is compatible with benefit under the stated direction.
Very wide confidence intervalThe subgroup estimate is imprecise, often because of limited information.
Different point estimatesThe observed estimates differ, but this alone does not demonstrate heterogeneity.
Important: A subgroup with a statistically significant result and another subgroup with a non-significant result does not automatically mean the treatment effects differ. “Significant in one subgroup, not significant in another” is not a valid interaction test.

Choosing the Effect Measure

The forest plot should use the effect measure appropriate to the endpoint and primary analysis.

Endpoint typeCommon effect measureTypical null value
Time-to-eventHazard ratio1
BinaryRisk ratio or odds ratio1
BinaryRisk difference0
ContinuousMean difference0
Continuous, differing scalesStandardized mean difference0

Consistency matters. If the primary analysis uses a hazard ratio, a subgroup forest plot intended to explain that analysis will usually be easiest to interpret when it uses the same estimand and treatment contrast.

Subgroup Definitions

A subgroup forest plot is only as good as its subgroup definitions. The analysis should specify how continuous variables are categorized and how clinically meaningful categories are constructed.

For example, age might be displayed as <65 versus ≥65, while a biomarker could be categorized as negative versus positive according to a prespecified assay rule.

Subgroup definitions should be applied consistently to the analysis dataset. Avoid silently changing cutoffs after seeing treatment results because this can introduce substantial bias.

1
Define the subgroup: use the protocol/SAP definition where applicable.
2
Define the analysis population: specify which participants contribute to the endpoint analysis.
3
Fit the prespecified model: maintain the treatment contrast and endpoint definition.
4
Estimate the subgroup effect: obtain the point estimate and confidence interval.
5
Assess interaction: evaluate whether the treatment effect differs across subgroup categories.
6
Display and validate: confirm labels, estimates, confidence limits, sample sizes, and treatment direction.

Sample Size and Information in Subgroups

Subgroup estimates are often less precise than the overall treatment estimate because each subgroup contains fewer participants or fewer endpoint events.

Figure 2. Small subgroup sample size can produce wide confidence intervals
The biomarker-positive subgroup contains substantially fewer participants than the biomarker-negative subgroup, producing greater uncertainty.
Figure 2. Small subgroup sample size can produce wide confidence intervals Hazard ratio / odds ratio / risk ratio (log scale) 0.25 0.5 1 2 4 Overall n=420 Biomarker negative n=354 Biomarker positive n=66 Positive: <50% n=41 Positive: ≥50% n=25 Favors treatment Favors control

A wide confidence interval should not be interpreted as evidence that the treatment does not work in the subgroup. It may simply reflect limited information.

Why Confidence Intervals Matter

The point estimate alone can be misleading. Consider two subgroup estimates of 0.60. If one has a 95% confidence interval of 0.45–0.80 and the other has an interval of 0.20–1.80, they do not provide the same level of information.

The first estimate is comparatively precise. The second is highly uncertain and is compatible with substantial benefit, little effect, or potentially harm.

A strong forest plot therefore gives visual prominence to the confidence intervals rather than relying only on the markers.

The Most Important Concept: Interaction

Suppose a trial reports:

  • Subgroup A: HR = 0.60, 95% CI 0.45–0.80
  • Subgroup B: HR = 0.90, 95% CI 0.65–1.25

It is tempting to conclude that the treatment works in A but not B. That conclusion is not justified solely from these two confidence intervals.

The relevant question is whether there is evidence that the treatment effect differs between A and B. This is the role of an interaction test.

Correct interpretation: “The estimated treatment effect was 0.60 in subgroup A and 0.90 in subgroup B. The treatment-by-subgroup interaction was [reported result].” This separates the descriptive subgroup estimates from the formal evidence for heterogeneity.

Interaction Tests

An interaction model includes treatment, subgroup, and their interaction. Conceptually, for a model with treatment indicator T and subgroup indicator S, the model contains a term such as:

Outcome ~ Treatment + Subgroup + Treatment:Subgroup

The interaction term addresses whether the treatment effect changes as the subgroup changes.

The exact model depends on the endpoint. For a time-to-event analysis this may involve a treatment-by-subgroup interaction in a proportional hazards model; for a binary endpoint it may involve a logistic or other appropriate model; and for continuous endpoints it may involve a linear model or another prespecified method.

Separate Subgroup P-Values vs. Interaction P-Value

QuestionAppropriate evidence
Is the treatment effect different from the null within subgroup A?Subgroup-specific estimate and confidence interval, with appropriate inferential context.
Is the treatment effect different from the null within subgroup B?Subgroup-specific estimate and confidence interval, with appropriate inferential context.
Do treatment effects differ between A and B?Treatment-by-subgroup interaction analysis.

Prespecified vs. Exploratory Subgroups

Not all subgroup analyses have the same evidentiary status. Prespecified subgroup analyses are defined before examining the treatment results and are generally more credible than post hoc analyses selected because they produce an interesting pattern.

Exploratory subgroup analyses can still be useful. They may generate hypotheses for future studies or help investigate unexpected findings. Their conclusions, however, should be presented with appropriate caution.

Multiplicity

When many subgroup characteristics and categories are examined, the probability of observing apparently unusual findings by chance increases.

For example, a study might examine treatment effects across age, sex, race, region, disease stage, baseline severity, biomarker status, prior therapy, and several additional factors. Even if the treatment effect is genuinely homogeneous, some subgroup estimates may appear unusually large or small simply through random variation.

Multiplicity should therefore be considered in the protocol and SAP. The appropriate strategy depends on the purpose of the subgroup analysis, the regulatory context, and whether the analyses are confirmatory or exploratory.

Continuous Variables: Categorize or Model?

Forest plots often display categorized subgroups because categories are easy to read. However, categorizing a continuous variable can discard information and make results sensitive to arbitrary cutoffs.

For some questions, it may be preferable to investigate treatment effect modification using a continuous interaction term, potentially with a prespecified nonlinear structure such as splines.

If a categorical display is used, the cutoff should be scientifically justified and defined independently of the observed treatment effect whenever possible.

Missing Subgroup Information

Some participants may have missing values for a subgroup variable. The analysis plan should define how these participants are handled.

Potential approaches include a separate “Unknown” category, exclusion from that subgroup analysis, or a prespecified imputation strategy. The choice should be made based on the estimand, data characteristics, and SAP rather than convenience.

Best practice: Report how many participants have missing subgroup information and make the denominator definition clear. A forest plot should not make the reader guess why subgroup totals do not match the overall analysis population.

Randomization and Subgroup Balance

Randomization generally supports unbiased treatment comparisons in the overall randomized population. Within small subgroups, however, treatment groups can be numerically imbalanced simply by chance.

Subgroup analyses should not be interpreted as though randomization guarantees equally precise or equally balanced comparisons within every subgroup. Small cell counts can produce unstable estimates and wide confidence intervals.

What Does a Crossing Confidence Interval Mean?

A confidence interval crossing the null value means that the interval includes the null. It does not prove that there is no treatment effect.

For a hazard ratio of 0.75 with a 95% CI of 0.50–1.12, the point estimate suggests a favorable treatment effect under the stated direction, but the interval is compatible with a range of effects that includes the null.

The forest plot should therefore be read as a distribution of estimates and uncertainty, not as a collection of binary “significant/non-significant” labels.

Ordering Subgroups

Subgroups should normally be organized according to a logical clinical or analytical hierarchy rather than sorted by the magnitude of the observed treatment effect.

For example:

  • Overall population
  • Age
  • Sex
  • Disease stage
  • Biomarker status
  • Prior therapy

Within a subgroup, preserve a natural order such as younger/older, male/female, negative/positive, or stage III/stage IV.

Reference Lines and Direction Labels

The null line is essential. The figure should also make the direction of benefit explicit.

For example, a ratio-scale forest plot can place Favors treatment on the left and Favors control on the right, provided the treatment contrast and effect measure make that direction correct.

Do not assume that “left is better.” Whether lower or higher values are favorable depends on the endpoint and the way the effect measure was calculated.

Forest Plot vs. Other Clinical Trial Displays

DisplayPrimary questionTypical use
Forest plotHow does the estimated treatment effect vary across subgroups?Subgroup and sensitivity analyses
Kaplan-Meier plotHow does event-free probability evolve over time?Time-to-event endpoints
Waterfall plotHow much did individual tumors shrink or grow?Oncology tumor response
Spider plotHow did tumor burden change over time?Longitudinal oncology response
Swimmer plotHow long did patients remain on treatment and when did events occur?Patient-level oncology timelines

Common Interpretation Errors

  1. “One subgroup is significant and another is not, so the treatment effects differ.” This is not an interaction test.
  2. “The confidence intervals overlap, so the effects are identical.” Overlap or non-overlap of individual confidence intervals is not a substitute for an interaction analysis.
  3. “A wide interval means no treatment effect.” It may instead indicate limited information.
  4. “The largest subgroup effect is the most important.” Large estimates can be unstable, particularly in small subgroups.
  5. “A post hoc subgroup with p<0.05 proves a subgroup-specific benefit.” Multiplicity and exploratory selection must be considered.
  6. “The forest plot is the analysis.” The figure displays results from an underlying statistical analysis; it does not replace the model or SAP.
  7. “All subgroup definitions are equally credible.” Prespecification, biological plausibility, and multiplicity matter.

Designing a Publication-Quality Forest Plot

A good forest plot should be compact without sacrificing statistical information.

  • Use a clear, consistent effect scale.
  • Show the null reference line.
  • Display confidence intervals prominently.
  • Include subgroup sample sizes when useful.
  • Use consistent decimal precision.
  • Keep subgroup labels concise but unambiguous.
  • Include the treatment contrast in the title or footnote.
  • State whether intervals are 95% and whether estimates are adjusted or unadjusted.
  • Make the direction of benefit explicit.
  • Use the same x-axis scale when comparing related panels.

Axis Scaling

Ratio measures are commonly displayed on a logarithmic axis because ratios are multiplicative and the values can span a wide range.

A log scale also makes reciprocal effects visually symmetric around the null. For example, a ratio of 0.5 and its reciprocal, 2, are equally distant from 1 on a log scale.

The axis range should be chosen deliberately. If an extreme subgroup estimate forces a very wide range, the other estimates may become difficult to distinguish.

Displaying Numerical Results Beside the Plot

Many publication-quality forest plots include a numerical results column containing the estimate and confidence interval, for example:

0.69 (0.56, 0.85)

This allows readers to obtain exact values without estimating them from the graphical position.

When space permits, numerical columns can also show subgroup sample sizes, event counts, or interaction p-values. Avoid overcrowding the figure with statistics that do not support the primary interpretation.

R Data Structure

A convenient plotting dataset contains one row per subgroup result.

subgroup_data <- data.frame(
  subgroup = c("Age <65", "Age ≥65",
               "Male", "Female"),
  n = c(214, 186, 231, 169),
  estimate = c(0.62, 0.74, 0.67, 0.71),
  lower = c(0.43, 0.49, 0.49, 0.47),
  upper = c(0.89, 1.12, 0.92, 1.07)
)

R Implementation With ggplot2

The forest plot can be built by plotting the point estimate and confidence interval on a log-scaled x-axis.

library(ggplot2)

ggplot(
  subgroup_data,
  aes(
    y = reorder(subgroup, estimate),
    x = estimate,
    xmin = lower,
    xmax = upper
  )
) +
  geom_vline(
    xintercept = 1,
    linetype = "dashed"
  ) +
  geom_errorbarh(
    height = 0.15
  ) +
  geom_point(
    size = 3
  ) +
  scale_x_log10(
    breaks = c(0.25, 0.5, 1, 2, 4)
  ) +
  labs(
    x = "Hazard Ratio (95% CI)",
    y = NULL
  ) +
  theme_classic()

Depending on the installed ggplot2 version and preferred implementation, horizontal intervals can also be constructed with geom_errorbar() using a flipped coordinate system, or with specialized forest-plot packages.

Adding the Numerical Estimate

subgroup_data$label <- sprintf(
  "%.2f (%.2f, %.2f)",
  subgroup_data$estimate,
  subgroup_data$lower,
  subgroup_data$upper
)

The label can then be placed in a dedicated annotation column or assembled as part of a more complex figure layout.

Faceting by Treatment or Endpoint

If several related endpoints are displayed, separate panels can be useful. Keep the statistical meaning of each panel explicit and avoid mixing effect measures without clear labels.

ggplot(
  subgroup_data,
  aes(
    x = estimate,
    y = subgroup,
    xmin = lower,
    xmax = upper
  )
) +
  geom_vline(xintercept = 1, linetype = "dashed") +
  geom_errorbarh(height = 0.15) +
  geom_point(size = 2.8) +
  facet_wrap(~ endpoint) +
  scale_x_log10() +
  theme_classic()

Interaction Results in the Figure

Interaction p-values can be displayed when they are part of the planned presentation, but they should not be used as the sole explanation for the subgroup pattern.

A good figure can show the subgroup estimates and confidence intervals while the accompanying text or table reports the treatment-by-subgroup interaction results.

Figure 3. Interaction matters more than separate within-subgroup p-values
Illustrative subgroup estimates. The plot shows the descriptive estimates; a formal heterogeneity conclusion requires the corresponding interaction analysis.
Figure 3. Interaction matters more than separate within-subgroup p-values Hazard ratio / odds ratio / risk ratio (log scale) 0.25 0.5 1 2 4 Age <65 n=214 Age ≥65 n=186 Male n=231 Female n=169 Biomarker negative n=354 Biomarker positive n=66 Favors treatment Favors control

The visual difference between point estimates is descriptive. The interaction analysis determines whether the observed difference is supported by statistical evidence of effect modification.

Forest Plots for Time-to-Event Endpoints

For survival endpoints, subgroup forest plots commonly display hazard ratios with confidence intervals. The subgroup estimate should come from the prespecified time-to-event model or an appropriately defined subgroup model.

Care is required when proportional hazards assumptions, stratification factors, time-varying effects, competing risks, or other model features are part of the primary analysis. The forest plot should faithfully represent the estimand and model used for the analysis.

Forest Plots for Binary Endpoints

For binary endpoints, risk ratios, odds ratios, and risk differences can all be used depending on the analysis strategy.

The choice should be consistent with the estimand and primary analysis. A risk difference and an odds ratio answer different questions, so they should not be substituted merely because one produces a more visually convenient forest plot.

Forest Plots for Continuous Endpoints

For continuous endpoints, mean differences are often straightforward to interpret when all groups use the same scale. Standardized mean differences may be useful when outcomes are measured on different scales, but they have a less intuitive clinical interpretation.

Forest Plots and Adjusted Analyses

Subgroup estimates may come from adjusted or unadjusted models. The figure should state which is being shown.

Do not compare an adjusted overall estimate to unadjusted subgroup estimates without explaining the difference. Ideally, the subgroup estimates should correspond to a coherent analysis strategy and estimand.

Subgroups With Very Few Events

Rare events can produce unstable estimates, extremely wide confidence intervals, or model convergence problems. In some situations an estimate may not be estimable using the planned model.

The correct response is not to hide problematic subgroups. The analysis should follow the prespecified handling rule, and the figure or footnote should make important estimation limitations transparent.

When a Forest Plot Should Not Be Used Alone

A forest plot is most useful when accompanied by the underlying analysis and appropriate context. It should not be used alone to support claims of treatment benefit in particular patient categories.

For confirmatory subgroup claims, the reader should be able to determine:

  • Which subgroups were prespecified.
  • What analysis population was used.
  • What effect measure and treatment contrast were used.
  • How confidence intervals were calculated.
  • Whether interaction tests were performed.
  • How multiplicity was handled or considered.
  • Whether any subgroup definitions were exploratory.

Quality-Control Checklist

1
Population: confirm the correct analysis population and treatment groups.
2
Subgroups: verify definitions, category labels, cutoffs, and missing-value handling.
3
Endpoint: confirm the correct endpoint and analysis window.
4
Estimand: confirm the effect measure, treatment contrast, and direction.
5
Statistics: independently verify point estimates and confidence limits.
6
Interaction: confirm that any heterogeneity statement is supported by the appropriate interaction analysis.
7
Multiplicity: verify the planned interpretation of multiple subgroup analyses.
8
Graphics: confirm the null line, axis scale, direction labels, and confidence-interval rendering.
9
Numbers: reconcile displayed values with the source analysis output.
10
Traceability: ensure every plotted row can be traced to the analysis dataset and documented derivation.

Common Mistakes

  1. Using subgroup p-values as evidence of heterogeneity. Use an interaction analysis to address whether treatment effects differ.
  2. Changing subgroup cutoffs after seeing results. This can introduce bias and should not be presented as though it were prespecified.
  3. Ignoring small subgroup sizes. Precision depends on the amount of information, not merely the existence of a point estimate.
  4. Using an inappropriate effect measure. Match the forest plot to the endpoint and estimand.
  5. Failing to label the treatment direction. Readers should know immediately which side favors which treatment.
  6. Overinterpreting confidence intervals. A confidence interval crossing the null does not prove no effect.
  7. Sorting by observed effect size. This can exaggerate visual differences and makes the figure harder to compare across analyses.
  8. Hiding exploratory analyses. Clearly distinguish prespecified and exploratory findings.
  9. Overcrowding the figure. A forest plot with too many rows, statistics, and annotations can become unreadable.
  10. Failing to validate the plot. Every estimate and confidence interval should be traceable to the analysis output.

Final Perspective

A well-designed forest plot turns a potentially unwieldy set of subgroup results into a compact statistical summary. Its greatest value is not that it makes “significant” results easy to spot, but that it allows readers to see the magnitude and precision of treatment effects across clinically relevant groups.

The most important interpretive discipline is to separate three questions: what is the estimated effect in each subgroup?, how precise is each estimate?, and is there evidence that the treatment effect truly differs between subgroups? The first two are displayed directly by the forest plot; the third requires an appropriate interaction analysis.

Take-home message: Use forest plots to display subgroup estimates and uncertainty, but use the statistical model, prespecified analysis plan, interaction tests, and clinical context to determine what those estimates mean.

Summary

  • Forest plots display subgroup-specific treatment effects and confidence intervals.
  • The null value is usually 1 for ratio measures and 0 for difference measures.
  • Wide intervals often reflect limited information rather than absence of treatment benefit.
  • “Significant in one subgroup, not significant in another” is not an interaction test.
  • Treatment-by-subgroup interaction analyses are central to claims of effect modification.
  • Prespecified subgroup analyses generally carry greater evidentiary weight than post hoc findings.
  • Multiplicity becomes increasingly important as the number of subgroup analyses grows.
  • Effect measure, treatment direction, subgroup definitions, and analysis population must be clearly specified.
  • Every displayed value should be traceable to the underlying analysis output.
← Back to All Tutorials