Section 36 MLR - Interaction of Continuous variables: lm
Outputs
36.1 Statistical Model
\[ \large y_{i} = \beta_0 + \beta_1 x_{1i} + \beta_2 x_{2i} + \beta_3 x_{1i}x_{2i} + \epsilon_{i} \]
\[ \large fm \leftarrow lm(SBP \sim BMI + Age + BMI:Age, \space data=BP) \]
\[ \large anova(fm) \]
Df | Sum Sq | Mean Sq | F value | Pr(>F) | |
---|---|---|---|---|---|
BMI | 1 | 15103.0386 | 15103.0386 | 2177.7953 | 0.0000 |
Age | 1 | 335.4035 | 335.4035 | 48.3638 | 0.0000 |
BMI:Age | 1 | 6.9906 | 6.9906 | 1.0080 | 0.3159 |
Residuals | 496 | 3439.7664 | 6.9350 | NA | NA |
Total | 499 | 18885.1991 | NA | NA | NA |
36.2 Estimates: Effects
\[ \large summary(fm) \]
Estimate | Std. Error | t value | Pr(>|t|) | |
---|---|---|---|---|
(Intercept) | -69.4019 | 58.7423 | -1.1815 | 0.2380 |
BMI | 4.7145 | 2.3746 | 1.9854 | 0.0477 |
Age | 2.2592 | 1.1748 | 1.9231 | 0.0550 |
BMI:Age | -0.0475 | 0.0473 | -1.0040 | 0.3159 |
36.3 Estimates: Effects with centered variables
BP <- read.csv('data/BP.csv')
BP$cBMI <- scale(BP$BMI, center=mean(BP$BMI), scale=1)
BP$cAge <- scale(BP$Age, center=mean(BP$Age), scale=1)
fm <- lm(SBP ~ cBMI + cAge + cBMI:cAge, data=BP)
\[ \large summary(fm) \]
Estimate | Std. Error | t value | Pr(>|t|) | |
---|---|---|---|---|
(Intercept) | 102.0359 | 0.1308 | 780.0545 | 0.0000 |
cBMI | 2.3370 | 0.0713 | 32.7788 | 0.0000 |
cAge | 1.0719 | 0.1578 | 6.7908 | 0.0000 |
cBMI:cAge | -0.0475 | 0.0473 | -1.0040 | 0.3159 |
36.4 Plot
Note the slight difference in slopes due to Age for different values of BMI. As shown in the plot as well as from the model outcomes, the difference is not statistically significant. We will possibly remove the interaction term from the final model. At this stage, however, we need to investigate the model further along with other predictors. The green dashed vertical lines shows the mean Age of the population. The mean BMI of the population is approximately 25.