PUBH-311 · Lesson 9 of 12 · 24 min
Multiple linear regression
▶ Video coming soon A video version of this lesson is on the way.
Encouraged by the clinic results, Jonah ran a regression of systolic blood pressure on body mass index using the full Kestrel Valley survey. Each additional unit of BMI was associated with a 1.05 mmHg higher systolic pressure. He drafted a sentence for the annual report: “Reducing BMI by 5 units would lower blood pressure by about 5 mmHg.” Dr. Osei stopped him. “Older people in our survey have higher BMI and higher blood pressure. Men have higher pressure and, here, slightly higher BMI. How much of that 1.05 is really about BMI, and how much is age and sex riding along?” To answer, Jonah needed a model with more than one predictor.
This lesson extends simple regression to multiple linear regression, in which a numerical outcome is modelled as a function of several predictors at once. We cover the model and how to interpret its coefficients as adjusted associations, categorical predictors and dummy variables, interaction, measures of fit, testing groups of variables, multicollinearity, model-building strategies and diagnostics. As in the last lesson, we focus on reading and interpreting output rather than calculating by hand, because multiple regression is always done with software.
The multiple regression model
With \(k\) predictors, the model for the mean of the outcome is
The coefficients are again estimated by least squares, minimizing the sum of squared residuals. Each coefficient \(\beta_j\) now has a specific meaning: it is the expected change in the outcome for a one-unit increase in \(x_j\), holding all the other predictors in the model constant. This phrase is the heart of multiple regression. It means the coefficient compares people who differ in \(x_j\) but have the same values of the other predictors, which is exactly what we mean by adjusting or controlling for those variables.
Adjustment for confounding
Recall from Principles of Epidemiology that a confounder is a variable associated with both the exposure and the outcome, and not on the causal pathway between them, that distorts the observed association. Stratification controls one or two confounders, but the number of strata grows quickly. Multiple regression adjusts for many variables at once by including them as predictors.
Table 1 shows the results Jonah obtained after adding age, sex, smoking and physical activity to the model. The data are invented but realistic.
| Predictor | Coefficient | Std. error | 95 percent CI | p-value |
|---|---|---|---|---|
| Intercept | 84.6 | 3.1 | 78.5 to 90.7 | < 0.001 |
| Age (per year) | 0.44 | 0.03 | 0.38 to 0.50 | < 0.001 |
| Male (vs female) | 4.2 | 0.8 | 2.6 to 5.8 | < 0.001 |
| BMI (per kg/m²) | 0.78 | 0.09 | 0.60 to 0.96 | < 0.001 |
| Current smoker (vs not) | 1.9 | 1.1 | −0.3 to 4.1 | 0.084 |
| Physically active (vs inactive) | −2.6 | 0.9 | −4.4 to −0.8 | 0.004 |
Each row is read in the same way. The BMI coefficient of 0.78 means that, among people of the same age, sex, smoking status and activity level, each additional unit of BMI is associated with a 0.78 mmHg higher mean systolic pressure (95 percent CI 0.60 to 0.96). The crude coefficient was 1.05, so about a quarter of the crude association was explained by the other variables, mainly age. The male coefficient of 4.2 means that men had systolic pressures 4.2 mmHg higher on average than women of the same age, BMI, smoking status and activity. The physically active coefficient of −2.6 means active people had pressures 2.6 mmHg lower, other factors being equal.
The smoker coefficient is positive but its confidence interval includes zero (p = 0.084). We would say the data are compatible with anything from a small decrease to a 4 mmHg increase associated with smoking after adjustment, rather than that smoking has no effect on blood pressure. Smoking’s major harms to the cardiovascular system act through mechanisms other than resting blood pressure.
The intercept, 84.6, is the predicted pressure for a 0-year-old female non-smoking inactive person with a BMI of zero, which is meaningless; as in simple regression, it positions the model.
Worked problem
Predicting from the multiple regression model
Use Table 1 to predict systolic blood pressure for (a) a 60-year-old man with BMI 30 who does not smoke and is inactive, and (b) a 45-year-old woman with BMI 24 who does not smoke and is physically active.
Show solution
- (a) 84.6 + 0.44 × 60 + 4.2 + 0.78 × 30 + 0 + 0 = 84.6 + 26.4 + 4.2 + 23.4 = 138.6 mmHg.
- (b) 84.6 + 0.44 × 45 + 0 + 0.78 × 24 + 0 − 2.6 = 84.6 + 19.8 + 18.7 − 2.6 = 120.5 mmHg.
- For the man in (a), a 5-unit lower BMI, with everything else unchanged, would predict 0.78 × 5 = 3.9 mmHg lower pressure, not the 5.3 mmHg implied by the crude coefficient.
Answer: Predicted means are about 139 mmHg for (a) and 121 mmHg for (b). These are averages for people with those characteristics; individuals vary around them with a residual SD of roughly 15 mmHg.
Even the adjusted coefficient is not proof that lowering BMI would lower blood pressure by 0.78 mmHg per unit. The model adjusts only for the variables included, and only as well as they are measured. Residual confounding from unmeasured or poorly measured factors, such as diet, alcohol and medication use, may remain, and the cross-sectional data cannot show which came first. Randomized trials of weight loss provide stronger evidence about the effect of changing BMI.
Categorical predictors and dummy variables
Regression needs numbers, so categorical predictors are represented by indicator or dummy variables coded 0 or 1. A binary predictor such as sex needs one dummy (male = 1, female = 0); the coefficient is the difference between the two groups, and the group coded 0 is the reference category. A predictor with \(m\) categories needs \(m - 1\) dummies. For household income in three groups (lowest, middle, highest third), we might choose the highest third as the reference and create two dummies: one for the lowest third and one for the middle third. Each coefficient compares its group with the reference.
| Income group | Dummy: lowest third | Dummy: middle third | Interpretation of coefficient |
|---|---|---|---|
| Highest third (reference) | 0 | 0 | Absorbed into the intercept |
| Middle third | 0 | 1 | Difference from highest third |
| Lowest third | 1 | 0 | Difference from highest third |
Never enter category codes such as 1, 2, 3 for a nominal variable as if they were numbers; that forces equal steps between categories in an arbitrary order. For ordinal variables, analysts sometimes enter the codes as a numerical score to test for a linear trend, but should check that this fits. The choice of reference category does not change the model’s predictions, only which comparisons appear in the table; choose a large group or a natural baseline.
A model with a binary dummy and a numerical predictor gives parallel lines: the dummy shifts the line up or down by the same amount at every value of the numerical predictor (Figure 1, left).
Interaction
Sometimes the association between a predictor and the outcome differs depending on the value of another predictor. This is called interaction or, in epidemiology, effect modification. In regression it is modelled by including the product of the two predictors as an additional term:
Among non-smokers (smoker = 0), the slope for age is \(\beta_1\). Among smokers it is \(\beta_1 + \beta_3\). The interaction coefficient \(\beta_3\) is the difference in slopes, and its test asks whether the lines are parallel. In the right-hand panel of Figure 1, blood pressure rises more steeply with age among smokers than non-smokers.
When an interaction is present, the "main effect" coefficients can no longer be interpreted alone; the effect of smoking depends on age, so it should be reported at specific ages or the results presented separately for each group. Interaction tests usually have low power, and testing many possible interactions invites false positives, so they should be planned in advance on substantive grounds.
How well does the model fit?
R² in multiple regression is the proportion of variation in the outcome explained by all the predictors together. It never decreases when a predictor is added, even a useless one, so adjusted R² penalizes additional predictors and is better for comparing models of different sizes. The model in Table 1 has R² = 0.27: the predictors explain about a quarter of the variation in blood pressure. That is typical of models of biological outcomes in populations and does not mean the model is poor; the goal here is to estimate adjusted associations, not to predict individuals precisely.
The overall F-test tests the null hypothesis that all the slope coefficients are zero. It is almost always significant in public health data sets and is rarely of much interest. More useful is a partial F-test (or likelihood ratio test) comparing a full model with a reduced one, to ask whether a group of variables together improves the model. For example, the two income dummies should be tested together, because the question is whether income as a whole is associated with blood pressure, not whether each dummy separately is.
Multicollinearity
Multicollinearity occurs when predictors are strongly correlated with each other, such as weight and BMI, or waist circumference and BMI. The model then struggles to separate their individual contributions: coefficients become unstable, standard errors inflate, and signs may even flip. The variance inflation factor (VIF) measures how much a coefficient’s variance is inflated by correlation with the other predictors; values above about 5 or 10 are often taken as warning signs. Remedies include dropping one of a set of redundant variables, combining them into a single score, or accepting wide intervals if both variables are genuinely needed for adjustment. Multicollinearity does not bias predictions; it makes individual coefficients hard to interpret.
Building a model
How should predictors be chosen? The answer depends on the purpose of the model.
For explanation, estimating the association of a particular exposure with an outcome after adjustment, choose covariates on subject-matter grounds before looking at the data: known or plausible confounders, identified from previous research and often laid out in a causal diagram (a directed acyclic graph, covered in Epidemiologic Methods). Avoid adjusting for variables on the causal pathway (mediators), which removes part of the effect you want to estimate. For example, if the question is whether physical activity is associated with blood pressure, adjusting for BMI removes the part of the association that operates through weight.
For prediction, building a model to forecast an individual’s outcome, the aim is accuracy on new data. Variables are chosen for predictive value, and performance is checked in data not used to build the model, through cross-validation or an independent validation sample.
Automated stepwise selection, in which software adds or removes variables based on p-values, is widely criticized by statisticians. It produces biased coefficients, overly narrow confidence intervals and models that often fail in new data. It should not be used to select confounders.
A further concern is overfitting: with too many predictors for the sample size, a model fits the noise of the particular data set and predicts poorly elsewhere. A common rule of thumb for linear regression is at least 10 to 20 observations per predictor (counting each dummy separately).
Diagnostics
The LINE assumptions from Lesson 8 apply to multiple regression and are checked the same way: residuals against fitted values for linearity and equal variance, residuals against each numerical predictor for curvature, and a normal quantile plot for normality. Influential observations are flagged with leverage and Cook’s distance. If a relationship looks curved, it can be modelled with a squared term, a transformation or a spline, a flexible curve built from joined pieces. Independence must again be judged from the design; clustered data, such as patients within clinics, need methods such as mixed-effects models or robust standard errors that account for clustering.
Reading a regression table in a journal article
When you read a published study, ask these questions of every regression table. What is the outcome, and in what units? What is the unit of each predictor (per year, per 10 years, per standard deviation)? Which variables were adjusted for, and were they chosen on reasonable grounds? Which category is the reference for each categorical predictor? Are confidence intervals given, and how wide are they? Is the sample size after excluding missing data reported? Would residual confounding plausibly explain the result? Nursing Research and Evidence-Based Practice offers critical appraisal checklists that include these questions.
Worked problem
Interpreting a published coefficient
A study reports that, adjusting for age, sex and income, each additional 10 µg/m³ of long-term fine particulate matter (PM2.5) exposure was associated with a 1.4 mmHg higher systolic pressure (95 percent CI 0.6 to 2.2). Write a plain-language interpretation and one limitation.
Show solution
- Identify the unit: the coefficient is per 10 µg/m³, not per 1 µg/m³.
- State the adjustment: comparisons are among people of the same age, sex and income.
- State the estimate and precision: 1.4 mmHg, plausibly between 0.6 and 2.2 mmHg.
- Consider limitations: residual confounding (for example, by traffic noise or diet), exposure measurement error from estimating pollution by home address, and cross-sectional timing.
Answer: Among people of similar age, sex and income, those exposed to 10 µg/m³ more fine particulate pollution had systolic pressure about 1.4 mmHg higher on average (plausibly 0.6 to 2.2). A key limitation is possible confounding by factors that vary with pollution, such as noise or neighbourhood characteristics.
Back to the annual report
The final annual report said that, after accounting for age, sex, smoking and physical activity, each additional unit of BMI was associated with a systolic pressure about 0.8 mmHg higher, and that people who met physical activity guidelines had pressures about 2.6 mmHg lower than inactive people of similar age, sex and BMI. It described these as associations from a survey and referred readers to trial evidence for the effects of weight loss and exercise. Jonah’s original sentence, with its crude coefficient and causal wording, was gone.
Common mistakes
MistakeInterpreting a multiple regression coefficient without mentioning the other variables in the model.
InsteadEach coefficient is the association holding the other predictors constant; say what was adjusted for.
MistakeEntering a nominal variable’s codes (1, 2, 3) as a single numerical predictor.
InsteadUse m − 1 dummy variables with a clear reference category.
MistakeAdjusting for a variable on the causal pathway between exposure and outcome.
InsteadAdjust for confounders, not mediators, when estimating a total effect.
MistakeUsing stepwise selection to choose confounders.
InsteadChoose covariates in advance from subject-matter knowledge and causal reasoning.
MistakeConcluding that a low R² means the exposure association is unimportant.
InsteadR² describes overall predictive power; an adjusted association can be important even when R² is modest.
Summary and key terms
- Multiple linear regression models a numerical outcome as a linear function of several predictors.
- Each coefficient is the change in mean outcome per unit of its predictor, holding the others constant; this is how regression adjusts for confounding.
- Categorical predictors with m categories use m − 1 dummy variables compared with a reference category.
- Interaction terms allow the association of one predictor to depend on another; main effects then cannot be read alone.
- R² measures explained variation, adjusted R² penalizes extra predictors, and partial F-tests assess groups of variables.
- Multicollinearity inflates standard errors; VIF helps detect it.
- Choose covariates by purpose: confounders on subject-matter grounds for explanation, validated performance for prediction; avoid stepwise selection and overfitting.
- Multiple linear regression
- A model of a numerical outcome as a linear function of two or more predictors.
- Adjusted coefficient
- A regression coefficient estimated while holding other predictors constant.
- Dummy variable
- A 0/1 indicator representing membership of a category.
- Reference category
- The category coded 0 on all dummies, against which other categories are compared.
- Interaction
- A situation in which the association between one predictor and the outcome depends on the value of another predictor.
- Adjusted R²
- R² penalized for the number of predictors.
- Multicollinearity
- Strong correlation among predictors that makes individual coefficients unstable.
- Variance inflation factor
- A measure of how much a coefficient’s variance is increased by multicollinearity.
- Residual confounding
- Confounding that remains after adjustment because of unmeasured or poorly measured variables.
- Overfitting
- Fitting a model so closely to one data set that it predicts poorly in new data.
Practice problems
Work each problem on paper first, then reveal the answer to check.
Using Table 1, how much higher is the predicted systolic pressure of a 70-year-old than a 50-year-old with identical sex, BMI, smoking and activity?
Show answer
20 years × 0.44 = 8.8 mmHg.
A model of hemoglobin A1c includes three ethnicity dummy variables with "Group A" as reference. One coefficient is 0.3 for Group C. Interpret it.
Show answer
People in Group C have a mean A1c 0.3 units higher than people in Group A with the same values of the other predictors in the model.
In a model with age, sex and an age × sex interaction, the age coefficient is 0.40 and the interaction coefficient (age × male) is 0.15. What is the age slope for men and for women (female = reference)?
Show answer
Women: 0.40 per year. Men: 0.40 + 0.15 = 0.55 per year.
A model includes both body weight and BMI, and both coefficients have huge standard errors. What is the likely problem and solution?
Show answer
Multicollinearity, because weight and BMI are highly correlated. Keep only one, usually BMI, or justify both and accept wide intervals.
Lesson quiz · 5 questions
Score 60% or more to complete this lesson.
Create a free account to save your progress, take quizzes and earn a certificate.