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)