1 / 48

Using SPSS and R for Mediation Analyses

Using SPSS and R for Mediation Analyses. Matt Baldwin Lucas Keefer. We will cover…. Simple and simultaneous mediation Sequential mediation Moderated mediation Three models using PROCESS for SPSS R-code for those models MAYBE: Monte-Carlo estimator online. Terms. M. b. a. Y. X. c’.

allan
Download Presentation

Using SPSS and R for Mediation Analyses

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Using SPSS and R for Mediation Analyses Matt Baldwin Lucas Keefer

  2. We will cover… • Simple and simultaneous mediation • Sequential mediation • Moderated mediation • Three models using PROCESS for SPSS • R-code for those models • MAYBE: Monte-Carlo estimator online

  3. Terms M b a Y X c’ Indirect effect: a * b ≠ 0

  4. Terms • Simple mediation • One predictor • One outcome • One or more mediators in parallel • Sequential mediation • One predictor • One outcome • More than one mediator in sequence

  5. Terms • Moderated mediation: strength of indirect effect depends on one or more moderators • One predictor • One outcome • One or more mediators (not in sequence) • One or more moderators • Bootstrapping: estimating a parameter from repeated resampling of the data • Approximates sampling distribution • Uses standard error to calculate confidence interval for indirect effect (a*b)

  6. PROCESS: SPSS • Andrew Hayes, Ph.D. • http://afhayes.com/introduction-to-mediation-moderation-and-conditional-process-analysis.html

  7. Installing PROCESS

  8. PROCESS: Models • Templates PDF file: templates.pdf

  9. Model 4 • Simple mediation • Multiple mediators in parallel

  10. Model 4

  11. Model 4 Output

  12. Model 4 Output • Remember, if the confidence interval does NOT include zero, the indirect effect is significant!

  13. Model 6 • Sequential mediation • Multiple mediators in sequence

  14. Model 6

  15. Model 6 Output

  16. Model 7 • Moderated mediation • Multiple mediators in parallel

  17. Model 7

  18. Model 7

  19. Model 7 Output

  20. Bootstrapping Mediation in R

  21. The boot package • Install the boot package and dependencies • What does it do?

  22. The boot package

  23. Data • Whatever object contains the data you are analyzing • If there are filters to apply, do so beforehand: • med_data <- subset(data, filters)

  24. Model • The model must be specified manually: • mediation<-function(med_data,i){ • d <- med_data[i,] • model1<- lm(M~X, data=d) • model2<-lm(Y~M+X, data=d) • ab <- coef(model1)[2]*coef(model2)[2] • return(as.numeric(ab)) • }

  25. Model • The model must be specified manually: • mediation<-function(med_data,i){ • d <- med_data[i,] • model1<- lm(M~X, data=d) • model2<-lm(Y~M+X, data=d) • ab <- coef(model1)[2]*coef(model2)[2] • return(as.numeric(ab)) • }

  26. Model • The model must be specified manually: • mediation<-function(med_data,i){ • d <- med_data[i,] • model1<- lm(M~X, data=d) • model2<-lm(Y~M+X, data=d) • ab <- coef(model1)[2]*coef(model2)[2] • return(as.numeric(ab)) • }

  27. Model • The model must be specified manually: • mediation<-function(med_data,i){ • d <- med_data[i,] • model1<- lm(M~X, data=d) • model2<-lm(Y~M+X, data=d) • ab <- coef(model1)[2]*coef(model2)[2] • return(as.numeric(ab)) • }

  28. Model • The model must be specified manually: • mediation<-function(med_data,i){ • d <- med_data[i,] • model1<- lm(M~X, data=d) • model2<-lm(Y~M+X, data=d) • ab <- coef(model1)[2]*coef(model2)[2] • return(as.numeric(ab)) • }

  29. Model • The model must be specified manually: • mediation<-function(med_data,i){ • d <- med_data[i,] • model1<- lm(M~X, data=d) • model2<-lm(Y~M+X, data=d) • ab <- coef(model1)[2]*coef(model2)[2] • return(as.numeric(ab)) • }

  30. Simple Mediation

  31. Simple Mediation • mediation<-function(med_data,i){ • d <- med_data[i,] • model1<- lm(M~X, data=d) • model2<-lm(Y~M+X, data=d) • ab <- coef(model1)[2]*coef(model2)[2] • return(as.numeric(ab)) • }

  32. Simple Mediation • boot(model, data, R = #) • obj <- boot(mediation, med_data, R = 10000) • boot.ci(obj)

  33. Moderated Mediation

  34. Moderated Mediation • mediation<-function(med_data,i){ • d <- med_data[i,] • model1<- lm(M~X+W+WX, data=d) • model2<-lm(Y~M+X, data=d) • ab <- coef(model1)[2]*coef(model2)[2] • return(as.numeric(ab)) • }

  35. Sequential Mediation

  36. Sequential Mediation • mediation<-function(med_data,i){ • d <- med_data[i,] • model1<- lm(M1~X, data=d) • model2<-lm(M2~M1+X, data=d) • model3<-lm(Y~M2+M1+X, data=d) • ab <- coef(model1)[2]*coef(model2)[2]* coef(model3)[2] • return(as.numeric(ab)) • }

  37. Final Pointers • Want to add model covariates? Just add them into all the model commands (NOT as first predictor)

  38. Final Pointers • Want to add model covariates? Just add them into all the model commands (NOT as first predictor) • Because you are specifying the model manually, triple check your work!

  39. Final Pointers • Want to add model covariates? Just add them into all the model commands (NOT as first predictor) • Because you are specifying the model manually, triple check your work! • It won’t catch misspecification

  40. Final Pointers • Want to add model covariates? Just add them into all the model commands (NOT as first predictor) • Because you are specifying the model manually, triple check your work! • It won’t catch misspecification • Make sure it is storing the right coefficient

  41. Thank you

  42. Monte-Carlo Estimator • Similar to bootstrapping method • Calculates indirect effect from a, b, and standard error • http://www.quantpsy.org/medmc/medmc.htm

  43. Thank You • Please feel free to ask us questions now or later! • Matt’s email: mwbaldwin@ku.edu • Lucas’ email: lkeefer1@ku.edu • These slides can be found at http://matthewbaldwin.yolasite.com/tools.php

More Related