Quick Review
Moderation (Process model 1)
“The moderator function of third variables, which partitions a focal
independent variable into subgroups that establish its domains of
maximal effectiveness regarding a given dependent variable” - Baron
& Kenny, 1986.
For example, is success on a kindergarten entrance exam predicted by
time to eat the marshmallow, but moderated by parenting
style?
- Permissive parents (no boundaries) vs Authoritative (strict).
- Measurement scale from -3 to 3 (permissive to authoritative)
Steps
Center
Marshmallow.Mod$Parents.C<-scale(Marshmallow.Mod$Parents,scale=F)[,]
Marshmallow.Mod$Time.C<-scale(Marshmallow.Mod$Time,scale=F)[,]
Regression models
Mod.1<-lm(Success~Time.C+Parents.C, data= Marshmallow.Mod)
Mod.2<-lm(Success~Time.C*Parents.C, data= Marshmallow.Mod)
Test simple slopes
- Plot the results of each moderator to help us visualize the
results
- We must set our moderator levels (-1SD [Permissive] and +1SD
[Authoritative])
Permissive<--sd(Marshmallow.Mod$Parents.C)
Authoritative<-+sd(Marshmallow.Mod$Parents.C)
- Permissive: Parents.C = -1.7 score
- Authoritative: Parents.C = 1.7 score
- To do this quickly we will use rockchalk package, but to do this by
hand you have to recenter the data (which we covered a few weeks
ago).
library(rockchalk)
m1ps <- plotSlopes(Mod.2, modx = "Parents.C", plotx = "Time.C", n=2, modxVals="std.dev")
m1psts <- testSlopes(m1ps)
knitr::kable(round(m1psts$hypotests,4))
## Values of Parents.C OUTSIDE this interval:
## lo hi
## -2.793686 -1.583800
## cause the slope of (b1 + b2*Parents.C)Time.C to be statistically significant
(m-sd) |
-1.7 |
0.8331 |
0.5734 |
1.4530 |
0.1473 |
(m+sd) |
1.7 |
8.2879 |
0.6062 |
13.6712 |
0.0000 |
Summary
So what do these results tell us?
Summary
So what do these results tell us?
References
Baron, R. M., & Kenny, D. A. (1986). The moderator-mediator
variable distinction in social psychological research: Conceptual,
strategic, and statistical considerations. Journal of personality
and social psychology, 51(6), 1173.
Preacher, K. J., Rucker, D. D., & Hayes, A. F. (2007). Addressing
moderated mediation hypotheses: Theory, methods, and prescriptions.
Multivariate behavioral research, 42(1), 185-227.
Imai, K., Keele, L., & Tingley, D. (2010). A general approach to
causal mediation analysis. Psychological methods, 15(4), 309.
LS0tDQp0aXRsZTogJ01vZGVyYXRlZCBNZWRpYXRpb24nDQpvdXRwdXQ6DQogIGh0bWxfZG9jdW1lbnQ6DQogICAgY29kZV9kb3dubG9hZDogeWVzDQogICAgZm9udHNpemU6IDhwdA0KICAgIGhpZ2hsaWdodDogdGV4dG1hdGUNCiAgICBudW1iZXJfc2VjdGlvbnM6IG5vDQogICAgdGhlbWU6IGZsYXRseQ0KICAgIHRvYzogeWVzDQogICAgdG9jX2Zsb2F0Og0KICAgICAgY29sbGFwc2VkOiBubw0KLS0tDQoNClxwYWdlYnJlYWsNCg0KYGBge3Igc2V0dXAsIGluY2x1ZGU9RkFMU0V9DQprbml0cjo6b3B0c19jaHVuayRzZXQoY2FjaGUgPSBUUlVFKQ0Ka25pdHI6Om9wdHNfY2h1bmskc2V0KGVjaG8gPSBUUlVFKSAjU2hvdyBhbGwgc2NyaXB0IGJ5IGRlZmF1bHQNCmtuaXRyOjpvcHRzX2NodW5rJHNldChtZXNzYWdlID0gRkFMU0UpICNoaWRlIG1lc3NhZ2VzIA0Ka25pdHI6Om9wdHNfY2h1bmskc2V0KHdhcm5pbmcgPSAgRkFMU0UpICNoaWRlIHBhY2thZ2Ugd2FybmluZ3MgDQprbml0cjo6b3B0c19jaHVuayRzZXQoZmlnLndpZHRoPTUpICNTZXQgZGVmYXVsdCBmaWd1cmUgc2l6ZXMNCmtuaXRyOjpvcHRzX2NodW5rJHNldChmaWcuaGVpZ2h0PTMuNSkgI1NldCBkZWZhdWx0IGZpZ3VyZSBzaXplcw0Ka25pdHI6Om9wdHNfY2h1bmskc2V0KGZpZy5hbGlnbj0nY2VudGVyJykgI1NldCBkZWZhdWx0IGZpZ3VyZQ0Ka25pdHI6Om9wdHNfY2h1bmskc2V0KGZpZy5zaG93ID0gImhvbGQiKSAjU2V0IGRlZmF1bHQgZmlndXJlDQprbml0cjo6b3B0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