9.5 Comparing conditional effects
9.5.1 Comparing conditional effects in the additive multiple moderation model.
9.5.2 Comparing conditional effects in the moderated moderation model.
9.5.3 Implementation in
Since we don’t have the
contrast feature automated like in PROCESS, we’ll have to carefully follow the equations at the bottom of page 344 to specify the values properly in R.
post %>% transmute(`30-year-old men` = b_negemot + `b_negemot:sex`*1 + `b_negemot:age`*30 + `b_negemot:sex:age`*1*30, `50-year-old women` = b_negemot + `b_negemot:sex`*0 + `b_negemot:age`*50 + `b_negemot:sex:age`*0*30) %>% mutate(contrast = `30-year-old men` - `50-year-old women`) %>% gather() %>% group_by(key) %>% summarize(mean = mean(value), sd = sd(value), ll = quantile(value, probs = .025), ul = quantile(value, probs = .975)) %>% mutate_if(is.double, round, digits = 3)
## # A tibble: 3 x 5 ## key mean sd ll ul ## <chr> <dbl> <dbl> <dbl> <dbl> ## 1 30-year-old men 0.371 0.062 0.252 0.495 ## 2 50-year-old women 0.319 0.037 0.247 0.391 ## 3 contrast 0.052 0.07 -0.084 0.191
Notice how our posterior \(SD\) corresponded nicely to the standard error in Hayes’s contrast test. And we didn’t even have to worry about using the frightening formula 9.21 on page 345. That information was contained in the posterior distribution all along. All we had to do was combine the parameter iterations with a little algebra and then