Klinkenberg
University of Amsterdam
28 sep 2022
In statistics and regression analysis, moderation occurs when the relationship between two variables depends on a third variable. The third variable is referred to as the moderator variable or simply the moderator. The effect of a moderating variable is characterized statistically as an interaction.
Source WIKIPEDIA
\[\definecolor{red}{RGB}{255,0,0} \definecolor{black}{RGB}{0,0,0} \color{black}Out_i = b_0 + b_1 Pred_i + b_2 Mod_i + \color{red}b_3 Pred_i \times Mod_i \color{black}+ \epsilon_i\]
Video games are among the favourite online activities for young people: two-thirds of 5–16-year-olds have their own video games console, and 88% of boys aged 8–15 own at least one games console. Although playing violent video games can enhance visuospatial acuity, visual memory, probabilistic inference, and mental rotation, compared to games such as Tetris, these games have also been linked to increased aggression in youths Another predictor of aggression and conduct problems is callous-unemotional traits such as lack of guilt, lack of empathy, and callous use of others for personal gain.
Imagine a scientist wanted to look at the relationship between playing violent video games such as Grand Theft Auto, MadWorld and Manhunt and aggression. She gathered data from 442 youths. She measured their aggressive behaviour, callous unemotional traits, and the number of hours per week they play video games.
Source: Field 11.3.1
predictor <- predictor + 15
moderator <- moderator + 7
data <- data.frame(predictor, moderator, outcome)
head(data)
predictor moderator outcome
1 18.02061 7.746939 9.797006
2 15.60117 5.937336 8.638962
3 14.02281 6.477516 8.336367
4 16.47405 9.520816 5.396567
5 11.99709 5.404452 8.246535
6 13.00026 2.415985 11.893936
Take it for a spin (does not work on tablet)
#fit2 <- lm(outcome ~ predictor + moderator)
fit <- lm(outcome ~ predictor + moderator + predictor*moderator); summary(fit)
Call:
lm(formula = outcome ~ predictor + moderator + predictor * moderator)
Residuals:
Min 1Q Median 3Q Max
-7.1725 -2.0186 0.2975 2.2995 10.0602
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 40.70870 3.38786 12.016 < 2e-16 ***
predictor -2.18586 0.24825 -8.805 5.47e-14 ***
moderator -5.91087 0.42821 -13.804 < 2e-16 ***
predictor:moderator 0.37000 0.02649 13.967 < 2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 3.086 on 96 degrees of freedom
Multiple R-squared: 0.6869, Adjusted R-squared: 0.6771
F-statistic: 70.2 on 3 and 96 DF, p-value: < 2.2e-16
\(\definecolor{red}{RGB}{255,0,0} \definecolor{black}{RGB}{0,0,0} \color{black}\widehat{Out_i} = b_0 + b_1 Pred_i + b_2 Mod_i + \color{red}b_3 Pred_i \times Mod_i \color{black}\)
\(\definecolor{red}{RGB}{255,0,0} \definecolor{black}{RGB}{0,0,0} \color{black}\widehat{Out_i} = 40.71 + -2.19 \times Pred_i + -5.91 \times Mod_i + \color{red} 0.37 \times Pred_i \times Mod_i \color{black}\)
We use the interactions packaage
if(!"interactions" %in% installed.packages()) { install.packages("interactions") };
if(!"sandwich" %in% installed.packages()) { install.packages("sandwich") };
library("sandwich")
library("interactions")
sim_slopes(fit, pred = predictor, modx = moderator, johnson_neyman = FALSE)
SIMPLE SLOPES ANALYSIS
Slope of predictor when moderator = 3.684843 (- 1 SD):
Est. S.E. t val. p
------- ------ -------- ------
-0.82 0.18 -4.52 0.00
Slope of predictor when moderator = 7.807686 (Mean):
Est. S.E. t val. p
------ ------ -------- ------
0.70 0.15 4.54 0.00
Slope of predictor when moderator = 11.930528 (+ 1 SD):
Est. S.E. t val. p
------ ------ -------- ------
2.23 0.20 11.35 0.00
JOHNSON-NEYMAN INTERVAL
When moderator is OUTSIDE the interval [5.02, 6.74], the slope of predictor
is p < .05.
Note: The range of observed values of moderator is [-0.70, 18.20]
SIMPLE SLOPES ANALYSIS
Slope of predictor when moderator = 3.684843 (- 1 SD):
Est. S.E. t val. p
------- ------ -------- ------
-0.82 0.18 -4.52 0.00
Slope of predictor when moderator = 7.807686 (Mean):
Est. S.E. t val. p
------ ------ -------- ------
0.70 0.15 4.54 0.00
Slope of predictor when moderator = 11.930528 (+ 1 SD):
Est. S.E. t val. p
------ ------ -------- ------
2.23 0.20 11.35 0.00
Wetenschapsfilosofie & Statistisch Redeneren