0

I am doing an experimental pysch research project and have a designed a study that requires serial mediation for a within-subjects design. I cannot find literature or packages that explains how to do run serial mediation for a within-subjects design in R. Might anyone know how to do this? Below is a sample data frame that can be used. Thank you.

#Create data frame
id = c(1,1,2,2,3,3,4,4,5,5,6,6) 
x = c(1,2,3,4,5,6,7,8,9,10,11,12)
mediator_1 = c(2,10,33,1,5,4,7,33,21,18,14,12) 
mediator_2 = c(6,13,3,45,1,5,9,15,3,8,11,14) 
dv = c(6,13,3,15,9,7,13,2,88,66,10,12) 
df =data.frame(id,x,mediator_1,mediator_2,dv) 
richiepop2
  • 348
  • 1
  • 12
  • Sorry, I missed the within subjects part. I suspect you can add `* id`, but it'd probably be better to ask on [Cross Validated](https://stats.stackexchange.com). You could probably link to the [previous question](https://stats.stackexchange.com/questions/340857/serial-mediation-in-r-how-to-setup-the-model) in your question for context. – Ian Campbell Jun 16 '20 at 00:38
  • got it -- thanks for your help, Ian. – richiepop2 Jun 16 '20 at 00:42

0 Answers0