University of Amsterdam
2025-10-07
In this lecture we aim to:
Reading: Chapter 12
Determine main effect while accounting for covariate
A covariate is a variable that can influence the DV. By adding a covariate, we reduce error/residual in the model.

We want to test the difference in extraversion but want to also account for openness to experience.
\[{extraversion} = {model} + {error}\]
\({model} = {independent} + {covariate}\) \(\color{white}{model} = {nationality} + {openness}\)
\(\color{white}{model}\)
Linear model with \(k-1\) dummy variables:
\[\hat{y} = b_0 + b_1 {dummy}_1 + b_2 {dummy}_2 + b_3 covar\]
What are the beta coefficients when we fit a model that only has nationality as a predictor variable?
(Intercept) nationalityGerman nationalityBelgian
39.682857 1.184286 -2.082857
\(\beta_{0} = 39.68\)
\(\beta_{German} = 1.18\)
\(\beta_{Belgian} = -2.08\)
What are the beta coefficients when we fit a model that only has openness as predictor variable?
(Intercept) openness
24.993473 1.799697
\(\beta_{0} = 24.99\)
\(\beta_{Open} = 1.8\)
What are the beta coefficients when we fit the full model (i.e., with both predictor variables)?
(Intercept) nationalityGerman nationalityBelgian openness
25.9029405 -0.1220751 -2.7012528 1.8036540
\(\beta_{Dutch} = 25.9\)
\(\beta_{German} = -0.12\)
\(\beta_{Belgian} = -2.7\)
\(\beta_{Open} = 1.8\)
For a German with a score of 8 on Openness:
(Intercept) nationalityGerman nationalityBelgian openness
25.9029405 -0.1220751 -2.7012528 1.8036540
\(\beta_{0} = 25.9\)
\(\beta_{German} = -0.12\)
\(\beta_{Open} = 1.8\)
How about a Belgian with 6 Openness?
The model that predicts only using group means:
\(\hat{y} = b_0 + b_1 {dummy}_1 + b_2 {dummy}_2\)
\(\hat{y} = 39.68 + 1.18 \times {dummy}_1 + -2.08 \times {dummy}_2\)
The model that predicts only using openness:
\(\hat{y} = b_0 + b_3 covar\)
\(\hat{y} = 24.99 + 1.8 \times {Openness}\)
The model that predicts with group and covariate:
\(\hat{y} = b_0 + b_1 {dummy}_1 + b_2 {dummy}_2 + b_3 covar\)
\(\hat{y} = 25.9 + -0.12 \times {dummy}_1 + -2.7 \times {dummy}_2 + 1.8 \times {Openness}\)

Model SS of full model:
To see what is explained by group, we subtract the Model SS of the covariate model:
To see what is explained by covariate, we subtract the Model SS of the group model:
\(MS_{model-group} = \frac{32.582}{2} = 16.291\)
\(F = \frac{{MS}_{model}}{{MS}_{error}} = \frac{{SIGNAL}}{{NOISE}} = \frac{16.291}{4.095} = 3.98\)
Power becomes quite abstract when we increase the complexity (i.e., number of predictors) of our models. We can make an F-distribution that symbolizes the alternative distribution by shifting the distribution more to the right (although the interpretability becomes pretty murky..)
Marginal means are estimated group means, while keeping the covariate equal across the groups
What are extraversion averages in each group, if they would all score the same on openness?
See also this blogpost
Adjusted:
nationality mean.adj
1 Dutch 40.32444
2 German 40.20237
3 Belgian 37.62319
Observed:
nationality extraversion
1 Dutch 39.68286
2 German 40.86714
3 Belgian 37.60000

Scientific & Statistical Reasoning