Good morning,
I was wondering if anyone could help me out in setting up code for a simulation based sample size estimation?
I'm working with a moderated mediation model (Model 14 as per A.Hayes PROCESS templates), where:
X is a dichotomous experimental condition (0 and 1)
M is a continuous mediator (mean of discrete 1 to 5 items)
V is a continuous moderator (mean of discrete 1 to 5 items)
Y is a continuous outcome (mean of discrete 1 to 5 items)
When I was analyzing pilot data I mean centered X, M and V, computed the product of M*V by hand and set the analysis template to the following syntax:
# # This model specification was automatically generated by Onyx # require("OpenMx"); modelData <- read.table(DATAFILENAME, header = TRUE) manifests<-c("X","M","Y","V","M_V") latents<-c() model <- mxModel("Unnamed_Model", type="RAM", manifestVars = manifests, latentVars = latents, mxPath(from="X",to=c("M","Y"), free=c(FALSE,FALSE), value=c(1.0,1.0) , arrows=1, label=c("X__M","X__Y") ), mxPath(from="M",to=c("Y"), free=c(FALSE), value=c(1.0) , arrows=1, label=c("M__Y") ), mxPath(from="V",to=c("Y"), free=c(FALSE), value=c(1.0) , arrows=1, label=c("V__Y") ), mxPath(from="M_V",to=c("Y"), free=c(FALSE), value=c(1.0) , arrows=1, label=c("M_V__Y") ), mxPath(from="X",to=c("X"), free=c(TRUE), value=c(1.0) , arrows=2, label=c("VAR_X") ), mxPath(from="M",to=c("M"), free=c(TRUE), value=c(1.0) , arrows=2, label=c("VAR_M") ), mxPath(from="Y",to=c("Y"), free=c(TRUE), value=c(1.0) , arrows=2, label=c("VAR_Y") ), mxPath(from="V",to=c("V"), free=c(TRUE), value=c(1.0) , arrows=2, label=c("VAR_V") ), mxPath(from="M_V",to=c("M_V"), free=c(TRUE), value=c(1.0) , arrows=2, label=c("VAR_M_V") ), mxPath(from="one",to=c("X","M","Y","V","M_V"), free=F, value=0, arrows=1), mxData(modelData, type = "raw") ); result <- mxRun(model) summary(result)
I already learned that I can't run a simulation for sample size using lavaan model syntax in simsem - due to the fact, that I'm introducing a variable being a product of other two variables.
I was wondering if you could help me out in working out an OpenMx syntax for such simulation, where conditional indirect effects are hypothesized, and sample size is estimated based on previous research data. For example:
These where the model estimates of a pilot study (analyzed with lavaan)
lhs op est mult rhs M ~ 1.202004232 * X Y ~ 0.575722530 * M Y ~ -0.006049529 * V Y ~ 0.069165295 * MxV Y ~ -0.030178110 * X M ~~ 0.615693995 * M Y ~~ 0.361699422 * Y X ~~ 0.249909489 * X X ~~ 0.028958249 * V X ~~ -0.164863026 * MxV V ~~ 2.527681615 * V V ~~ -0.102325584 * MxV MxV ~~ 2.918988907 * MxV indirect := 0.692020918 * a*b1 direct := -0.030178110 * c ab3 := 0.083136978 * a*b3 lo := 0.532131320 * a*(b1+ab3*-1.6) av := 0.692020918 * a*(b1+ab3*0) hi := 0.851910516 * a*(b1+ab3*1.6)
Based on those values I want to show what would be the sample size required to observe similar effects (ab3, lo, hi) with a power of .8.
Is OpenMx capable of running such thing?
BTW> for what is worth I don't need to use mean aggregates for exogenous variables, as I could construct them from raw item scores as latent variables - if that's of any value...