Tutorials › Regression Analysis (Undergraduate) › A Worked Regression Analysis of a Randomized Trial

Regression in Randomized Studies · Tutorial 916 of 991

A Worked Regression Analysis of a Randomized Trial

Follow a randomized trial from treatment coding through three regression specifications, and learn how to interpret their treatment contrasts, uncertainty, and limitations.

Intermediate 10 min read

What You'll Learn

  • Code randomized treatment assignment as a zero-one predictor and interpret its coefficient.
  • Calculate an unadjusted difference in follow-up means and its standard error.
  • Interpret a baseline-adjusted treatment coefficient in context.
  • Read a treatment-by-baseline interaction and calculate a treatment contrast at the centering value.
  • Construct and interpret a confidence interval for a conditional treatment contrast.
  • Compare model specifications without treating agreement as proof of correctness.
  • State a cautious conclusion that reflects uncertainty and trial limitations.

From Trial Question to Regression Analysis

A randomized trial can produce several reasonable regression analyses of the same outcome. A simple comparison of follow-up means describes the observed difference between assigned groups. Adding the baseline outcome can account for chance baseline imbalance and often improve precision. A treatment-by-baseline interaction allows the treatment contrast to vary across baseline values. The analyst must interpret each model on its own terms and keep the uncertainty visible.

The following is a fully hypothetical trial. Forty adults with elevated blood pressure are randomly assigned in equal numbers to a new program or a control program. Systolic blood pressure is recorded at baseline and again after 12 weeks. The analysis compares participants according to their randomized assignment. The outcome is measured in millimeters of mercury (mmHg), and lower follow-up values indicate lower blood pressure.

Analysis setup: Let \(T_i=1\) for a participant assigned to the new program and \(T_i=0\) for a participant assigned to control. Let \(Y_i\) be participant \(i\)'s 12-week systolic blood pressure in mmHg, and let \(X_i\) be that participant's baseline systolic blood pressure in mmHg. In the interaction model, use the centered baseline value \(Z_i=X_i-140\). Thus, \(Z_i=0\) means baseline blood pressure was 140 mmHg.

Before calculating regression-based uncertainty, specify the assumptions relevant to the model and inference. Each participant contributes one outcome, and participants' outcomes are treated as independent. The regression mean is assumed to have the form stated for the model being used. For the usual small-sample \(t\)-based intervals, errors are assumed to have mean zero conditional on the predictors, roughly constant variance, and an approximately normal distribution. Random assignment supports a comparison by assigned group, but it does not guarantee identical baseline measurements in a sample of 40. A causal interpretation also requires that assignment and follow-up have been handled as intended; missing outcomes or departures from the planned trial can limit that interpretation.

First Look: Compare the Assigned Groups

The hypothetical follow-up means are 141.0 mmHg in the control group and 136.8 mmHg in the new-program group. Their observed difference, defined as new program minus control, is \(-4.2\) mmHg. This is a direct summary of the assigned groups, without adjustment for baseline blood pressure.

Worked Example: The Unadjusted Follow-Up Difference

Suppose each group has \(n=20\) participants. The sample standard deviation of follow-up blood pressure is 5.2 mmHg in the control group and 5.0 mmHg in the new-program group. Calculate the unadjusted difference and its standard error.

Difference in sample means. With the contrast defined as new program minus control,

$$ \bar{Y}_{T=1}-\bar{Y}_{T=0}=136.8-141.0=-4.2\text{ mmHg}. $$

Standard error. For independent groups, the estimated standard error of the difference in means is the square root of the sum of the two sample-mean variances:

$$ SE=\sqrt{\frac{s_1^2}{n_1}+\frac{s_0^2}{n_0}} =\sqrt{\frac{5.0^2}{20}+\frac{5.2^2}{20}} =\sqrt{1.250+1.352} =\sqrt{2.602} =1.613\text{ mmHg}. $$

The estimated difference is therefore about 2.60 standard errors below zero, since \(-4.2/1.613=-2.604\). This calculation describes the raw follow-up comparison; it does not account for baseline blood pressure. An interval or test based on this calculation also relies on independent observations and an appropriate sampling or randomization-based justification for the standard error.

The sample baseline means are 150.4 mmHg in control and 149.6 mmHg in the new-program group. This 0.8 mmHg difference is a chance imbalance that can occur despite random assignment. It is not evidence that randomization failed. Baseline adjustment is one way to use the measured baseline outcome in the analysis.

Baseline-Adjusted Analysis

An analysis of covariance (ANCOVA) model predicts follow-up blood pressure from assigned group and baseline blood pressure. In this hypothetical analysis, the fitted model is

$$ Y_i=\beta_0+\beta_TT_i+\beta_XX_i+\varepsilon_i. $$

Here, \(\beta_T\) is the adjusted difference in mean follow-up blood pressure between the assigned groups for participants with the same baseline value, under this model. The model assumes a common linear relationship between baseline and follow-up blood pressure in the two groups: there is no treatment-by-baseline interaction in this specification.

Worked Example: Interpreting the Baseline-Adjusted Coefficient

Suppose the fitted ANCOVA model has an estimated baseline slope of 0.75 mmHg of follow-up blood pressure per 1 mmHg of baseline blood pressure. The estimated treatment coefficient is \(-3.60\) mmHg, with standard error 1.30 mmHg and 37 degrees of freedom. Interpret the coefficient and form a 95% confidence interval.

Interpretation. Holding baseline blood pressure fixed, the fitted model estimates that the new-program assignment is associated with a mean follow-up systolic blood pressure 3.60 mmHg lower than control. The negative sign indicates a lower predicted value in the new-program group. This is an adjusted assigned-group contrast, not an estimate that every participant's blood pressure falls by 3.60 mmHg.

Confidence interval. A two-sided 95% interval for a regression coefficient is its estimate plus or minus the appropriate \(t\) critical value times its standard error. With 37 degrees of freedom, \(t_{0.975,37}\) is approximately 2.026:

$$ -3.60\mathbin{\pm}2.026(1.30) =-3.60\mathbin{\pm}2.634 =(-6.234,-0.966)\text{ mmHg}. $$

Under the model and its assumptions, the interval procedure would capture the fixed adjusted contrast in 95% of repeated samples. For this hypothetical fit, the interval ranges from a 6.234 mmHg lower mean in the new-program group to a 0.966 mmHg lower mean. It does not say there is a 95% probability that the fixed contrast lies in this particular interval.

The estimated baseline slope describes the fitted association between baseline and follow-up blood pressure after accounting for treatment assignment. Its value of 0.75 says that a 1 mmHg higher baseline value corresponds to a 0.75 mmHg higher predicted follow-up value, on average, in this common-slope model. It is an adjusted regression association, not a claim that changing a person's baseline value would cause that change in follow-up blood pressure.

Allowing the Contrast to Vary With Baseline

The common-slope model may be too restrictive if the treatment contrast changes with baseline blood pressure. To allow that possibility, fit a treatment-by-baseline interaction. Using \(Z_i=X_i-140\) centers baseline at 140 mmHg:

$$ Y_i=\beta_0+\beta_TT_i+\beta_ZZ_i+\beta_{TZ}(T_iZ_i)+\varepsilon_i. $$

For a participant with baseline value \(X_i\), the fitted contrast between new-program assignment and control is \(\beta_T+\beta_{TZ}(X_i-140)\). At a baseline value of 140 mmHg, the centered value is zero, so the contrast is simply \(\beta_T\). The interaction coefficient \(\beta_{TZ}\) describes the change in the fitted treatment contrast for each 1 mmHg increase in baseline blood pressure.

Worked Example: A Treatment Contrast at 140 mmHg

Suppose the interaction model estimates a treatment coefficient of \(-3.10\) mmHg at the centering value of 140 mmHg, with standard error 1.53 mmHg and 36 degrees of freedom. The estimated interaction coefficient is 0.12 mmHg per 1 mmHg of baseline blood pressure. Calculate the treatment contrast at 140 mmHg and its 95% confidence interval.

Contrast. At \(X=140\), \(X-140=0\), so the interaction term contributes nothing:

$$ \widehat{\text{contrast}}(140)=\hat{\beta}_T+\hat{\beta}_{TZ}(140-140) =-3.10+0.12(0) =-3.10\text{ mmHg}. $$

Interval. With 36 degrees of freedom, \(t_{0.975,36}\) is approximately 2.028094. Therefore,

$$ -3.10\mathbin{\pm}2.028094(1.53) =-3.10\mathbin{\pm}3.102984 =(-6.202984,0.002984)\text{ mmHg}. $$

At baseline 140 mmHg, the fitted treatment contrast is 3.10 mmHg lower follow-up blood pressure for the new-program assignment. The 95% interval includes zero, with an upper endpoint of approximately 0.002984 mmHg. Thus, under this model, the interval does not rule out a contrast of zero at the two-sided 5% level. Its endpoint being very close to zero should not be turned into a confident claim of benefit or no benefit.

The interaction estimate of 0.12 means the fitted treatment contrast becomes 0.12 mmHg less negative for each 1 mmHg increase in baseline blood pressure. For example, at 150 mmHg the fitted contrast would be \(-3.10+0.12(10)=-1.90\) mmHg. This point estimate alone does not establish that treatment effects genuinely differ across baseline values; uncertainty in the interaction and in the conditional contrast matters.

Compare Specifications, Then Check the Analysis

A useful analysis distinguishes what changes across models from what remains stable. The following summaries are hypothetical fitted results for the same trial. Standard errors and degrees of freedom are shown for the treatment contrasts. The interaction-model contrast is specifically evaluated at baseline 140 mmHg.

SpecificationTreatment contrast (new program minus control)Standard errorDegrees of freedom
Unadjusted follow-up means\(-4.20\) mmHg1.613 mmHg38
ANCOVA with baseline, common slope\(-3.60\) mmHg1.30 mmHg37
Baseline interaction model, at 140 mmHg\(-3.10\) mmHg1.53 mmHg36

The estimates are all negative, but they are not identical. They answer slightly different model-based questions: the first compares observed group means; the second adjusts for baseline under a common-slope assumption; the third gives a conditional contrast at a particular baseline value. The interaction model's contrast at 150 mmHg is not the same contrast as its value at 140 mmHg.

A comparison of numerical estimates is not a substitute for checking model fit. In this hypothetical example, assume plots of residuals against fitted values show no strong curvature or change in spread, and a normal probability plot shows no severe departure from approximate normality. Those checks make the stated linear-model calculations more defensible, but they do not prove the assumptions. Also check for influential observations and verify that the outcome, baseline measurement, assignment coding, and analysis sample were handled correctly. With only 40 participants, diagnostic plots have limited power to reveal problems.

1
Define the contrast and coding.
State which group has \(T=1\), which has \(T=0\), the outcome units, and the direction of subtraction. This prevents a sign error in interpretation.
2
Fit a prespecified primary model.
For baseline-adjusted ANCOVA, state the common-slope assumption and interpret the treatment coefficient as an adjusted assigned-group contrast.
3
Use the interaction model for a varying contrast.
Report the baseline value at which a contrast is evaluated, and calculate its uncertainty using the standard error for that contrast.
4
Check assumptions and communicate limits.
Review residual and influence diagnostics, describe the interval in context, and avoid treating one model's result as certain proof.

Why the Model Choice Matters

Randomization makes assigned groups comparable in expectation, not necessarily identical in every realized sample. Baseline adjustment can account for measured baseline differences and may improve precision when baseline predicts follow-up. An interaction model answers a further question: whether the fitted assigned-group contrast varies with baseline. The more flexible model also estimates more parameters, so its conditional contrasts can be less precise.

The primary model should be selected for a scientific and design-based reason, not because it gives the most favorable result. A sensitivity analysis can show whether conclusions change under reasonable specifications. Similar estimates across models can be reassuring, but do not verify the assumptions shared by those models. Different estimates do not automatically mean that one model is wrong; they may reflect different assumptions or chance variation.

Common mistake: “The treatment coefficient is \(-3.10\), so the new program lowers blood pressure by 3.10 mmHg for everyone.” This ignores that the estimate comes from an interaction model and is the fitted contrast specifically at baseline 140 mmHg. The correct interpretation states the baseline value, the assigned groups, the outcome, and the uncertainty. It also avoids claiming that assignment causes the same individual change for every participant.

A cautious report for this hypothetical trial could say: “In the baseline-adjusted model, assignment to the new program was associated with an estimated 3.60 mmHg lower mean 12-week systolic blood pressure than assignment to control, at the same baseline blood pressure; the 95% confidence interval was \(-6.234\) to \(-0.966\) mmHg. In an interaction model, the estimated contrast at baseline 140 mmHg was \(-3.10\) mmHg, with a 95% interval from \(-6.202984\) to \(0.002984\) mmHg. The interaction-model interval includes zero, and these analyses do not by themselves establish that the contrast varies by baseline or that the result would generalize beyond the trial participants.” This separates the two model-specific findings and does not overstate either.

Check Your Understanding

Try these questions before reviewing the worked calculations.

  1. In the interaction model, what does \(\beta_T\) represent when baseline is centered at 140 mmHg?
  2. If the treatment-by-baseline coefficient is positive, what happens to the fitted new-program-minus-control contrast as baseline blood pressure increases?
  3. Why can randomized groups have different observed baseline means even when assignment was properly randomized?
  4. What does it mean when a 95% confidence interval for a treatment contrast includes zero?
  5. Why should a report of an interaction-model treatment coefficient name the baseline value at which the contrast applies?
  6. Name one diagnostic check relevant to the usual \(t\)-based regression interval and explain what it assesses.