Learning Outcomes
By the end of this section, students will be able to:
- Explore the data with correlations and scatterplots.
- Use an ANOVA to test for a difference in means across a categorical variable.
- Conduct univariable and multivariable linear regression
- Check the regression diagnostics of a linear model.
You can download a copy of the slides here: B1.4a Multiple Linear Regression
Video B1.4a – Introduction to Multiple Linear Regression (7 minutes)
You can download a copy of the slides here: B1.4b Controlling for Confounding
Video B1.4b – Controlling for Confounding (9 minutes)
B1.4 PRACTICAL: Stata
Multiple linear regression
How do we fit a model with more than one explanatory variable?
Here, we will include each covariate one at a time into the model, starting with BMI, then adding ‘ldlc’ and lastly adding ‘currsmoker’. We like to add variables one at time so that we can see how each new additional covariate affects the other variables already in the model- this gives us an idea about how interrelationships between variables may underlie the associations in the model.
To build a multivariable model, the command is the same as before:
  regress outcome covariate1 covariate2 covariate3 [,options]
 Therefore, to examine the impact the association of BMI group on SBP, adjusted for LDL-C, we write:
regress sbp ib2.bmi_grp4 ldlc
The output is:

Being overweight compared with normal weight is associated with a 1.91 mmHg higher SBP on average, once adjusted for LDL-C (95% CI: 0.80-3.02, p=0.001). This is a slightly stronger association for the overweight BMI group than before we adjusted for LDL-C.
Note that each covariate in the model is adjusted for all other covariates in the model. So BMI group is adjusted for LDL-C, and LDL-C is adjusted for BMI group. In other words, we can see the association of BMI group independent of LDL-C, and vice versa.
Question B1.4a: What is the association of BMI group with SBP, once adjusted for LDL-C and current smoking?
Answer    
regress sbp ib2.bmi_grp4 ldlc i.currsmoker

On average, being obese is associated with a 3.7 mmHg higher SBP than being normal weight, once adjusted for LDL-C and current smoking (95% CI 1.74-5.63, p<0.001). This association was not affected by additional adjustment for current smoking.
Each covariate in the model can be interpreted as adjusted for the other covariates in the model. So being a current smoker is associated with a -0.56 mmHg lower SBP compared to non-smokers, once adjusted for LDL-C and BMI group. The 95% CI crosses the null value (which is 0 in this case, as we are not working with ratios; -2.15-1.02) so this association is not statistically significant.
B1.4 PRACTICAL: SPSS
How do we fit a model with more than one explanatory variable?
Here, we will include each covariate one at a time into the model, starting with BMI, then adding ‘ldlc’ and lastly adding ‘currsmoker’. We like to add variables one at time so that we can see how each new additional covariate affects the other variables already in the model- this gives us an idea as to the mechanisms underlying an association.
To build a multivariable model, the process is the same as before.
Select
Analyze >> General Linear Model >> Univariate
Place SBP in the Dependent box and BMI group (bmi_grp4) in the Fixed Factors as in the earlier exercise. Then add LCL-C (ldlc) this time to the Covariate box.
Don’t forget to make sure Parameter Estimates is selected in the Options tab.
NB: we only use multivariate if we have more than one dependant variable. As we are only examining the effects on one dependant variable (SBP) then this is still a univariate analysis. We will cover when you would use the multivariate in Module B2.
The output should be as follows.


Being obese compared with normal weight is associated with a 3.7 mmHg higher SBP on average, once adjusted for LDL-C (95% CI: 1.77-5.66, p<0.001). This is a slightly stronger association than before we adjusted for LDL-C.
Note that each covariate in the model is adjusted for all other covariates in the model. So BMI group is adjusted for LDL-C, and LDL-C is adjusted for BMI group. In other words, we can see the association of BMI group independent of LDL-C, and vice versa.
Now expand this to include current smoking into the analysis as another fixed factor.
To avoid SPSS getting carried away and measuring ‘interactions’, which we will cover in the next module, once you have set up the General Linear Model, click on ‘Model’ from the menu on the right hand side. Select ‘Build terms’ at the top, then ‘Main effects’ from the drop down menu in the middle. The finally move all of your explanatory variables into the Model box on the right hand side. Click Continue to go back to the main screen.

What is the association of BMI group with SBP, once adjusted for LDL-C and current smoking?
Answer


On average, being obese is associated with a 3.7 mmHg higher SBP than being normal weight, once adjusted for LDL-C and current smoking (95% CI 1.74-5.63, p<0.001). This association was not affected by additional adjustment for current smoking.
Each covariate in the model can be interpreted as adjusted for the other covariates in the model. So being a current smoker is associated with a -0.56 mmHg lower SBP compared to non-smokers, once adjusted for LDL-C and BMI group. The 95% CI crosses the null value (which is 0 in this case, as we are not working with ratios; -2.15-1.02) so this association is not statistically significant.
B1.4 PRACTICAL: R
Multiple linear regression
How do we fit a model with more than one explanatory variable?
Here, we will include each covariate one at a time into the model, starting with BMI, then adding ‘age_grp’ and lastly adding ‘currsmoker’. We like to add variables one at time so that we can see how each new additional covariate affects the other variables already in the model- this gives us an idea as to the mechanisms underlying an association.
To build a multivariable model, the command is the same as before:
my.fit <- lm(Y ~ X+ X2 + X3, data = my.data)Â
Therefore, to examine the impact the association of BMI group on SBP, adjusted for LDL-C, we write:
fit4 <- lm(sbp ~ bmi_fact+ldlc, data=white.data)
summary(fit4)
Call:
lm(formula = sbp ~ bmi_fact + ldlc, data = white.data)
Residuals:
  Min    1Q  Median    3Q   MaxÂ
-43.769 -12.106 Â -1.685 Â 9.805 100.780Â
Coefficients:
      Estimate Std. Error t value Pr(>|t|)  Â
(Intercept) 133.0774 Â Â 1.2194 109.131 Â < 2e-16 ***
bmi_fact1 Â Â -3.7999 Â Â 2.5360 Â -1.498 0.134107 Â Â
bmi_fact3 Â Â 1.9109 Â Â 0.5656 Â 3.379 0.000735 ***
bmi_fact4 Â Â 3.7098 Â Â 0.9921 Â 3.739 0.000187 ***
ldlc     -1.0539   0.3444  -3.060 0.002227 **Â
—
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 17.48 on 4271 degrees of freedom
 (51 observations deleted due to missingness)
Multiple R-squared: Â 0.007247, Â Â Adjusted R-squared: Â 0.006318Â
F-statistic: 7.795 on 4 and 4271 DF, Â p-value: 2.958e-06
> confint(fit4, level=0.95)
         2.5 %    97.5 %
(Intercept) 130.6867084 135.4681420
bmi_fact1 Â Â -8.7717473 Â 1.1719708
bmi_fact3 Â Â 0.8020861 Â 3.0196496
bmi_fact4 Â Â 1.7648434 Â 5.6548333
ldlc     -1.7291229  -0.3786859
Being overweight (BMI group 3) compared with normal weight (group 2) is associated with a 1.91 mmHg higher SBP on average, once adjusted for LDL-C (95% CI: 0.80-3.02, p=0.001). This is a slightly stronger association for the overweight BMI group than before we adjusted for LDL-C.
Note that each covariate in the model is adjusted for all other covariates in the model. So BMI group is adjusted for LDL-C, and LDL-C is adjusted for BMI group. In other words, we can see the association of BMI group independent of LDL-C, and vice versa.
Question B1.4a: What is the association of BMI group with SBP, once adjusted for LDL-C and current smoking?
Answer    
> fit5 <- lm(sbp ~ bmi_fact+ldlc+currsmoker, data=white.data)
> summary(fit5)
Call:
lm(formula = sbp ~ bmi_fact + ldlc + currsmoker, data = white.data)
Residuals:
  Min    1Q  Median    3Q   MaxÂ
-43.857 -12.133 Â -1.698 Â 9.869 101.087Â
Coefficients:
      Estimate Std. Error t value Pr(>|t|)  Â
(Intercept) 133.1638 Â Â 1.2250 108.709 Â < 2e-16 ***
bmi_fact1 Â Â -3.8183 Â Â 2.5372 Â -1.505 0.132420 Â Â
bmi_fact3 Â Â 1.8963 Â Â 0.5664 Â 3.348 0.000820 ***
bmi_fact4 Â Â 3.6897 Â Â 0.9928 Â 3.717 0.000205 ***
ldlc     -1.0536   0.3446  -3.057 0.002248 **Â
currsmoker  -0.5632   0.8072  -0.698 0.485360  Â
—
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 17.48 on 4265 degrees of freedom
 (56 observations deleted due to missingness)
Multiple R-squared: Â 0.007334, Â Â Adjusted R-squared: Â 0.006171Â
F-statistic: 6.303 on 5 and 4265 DF, Â p-value: 7.781e-06
> confint(fit5, level=0.95)
         2.5 %    97.5 %
(Intercept) 130.7622530 135.5653401
bmi_fact1 Â Â -8.7925679 Â 1.1559657
bmi_fact3 Â Â 0.7859074 Â 3.0066019
bmi_fact4 Â Â 1.7433621 Â 5.6360128
ldlc     -1.7291747  -0.3779296
currsmoker  -2.1456862  1.0192539
On average, being obese is associated with a 3.7 mmHg higher SBP than being normal weight, once adjusted for LDL-C and current smoking (95% CI 1.74-5.63, p<0.001). This association was not affected by additional adjustment for current smoking.
Each covariate in the model can be interpreted as adjusted for the other covariates in the model. So being a current smoker is associated with a -0.56 mmHg lower SBP compared to non-smokers, once adjusted for LDL-C and BMI group. The 95% CI crosses the null value (which is 0 in this case, as we are not working with ratios; -2.15-1.02) so this association is not statistically significant.