[Mediation-information] 'mediations' and multiple imputed datasets
Daniel Caro
dcarov at gmail.com
Fri Feb 21 18:26:43 CET 2014
Dear mediators!
I've have been using your package for analyses with educational data.
I am very thankful for your work developing this package, I think it
is a great contribution to the study of causation.
I've successfully estimated ACME with 'mediation' but I am not able to
use 'mediations' with multiple imputed datasets. This is the function
I am trying to perform:
mediations(datasets=mydata, treatment= rep("pared", 5),
mediators=rep("ela", 5), outcome=rep("read",5),
covariates = c("dadsei + momsei + hompos + books + childb +
presch + langb"),
families=c("gaussian","gaussian"), interaction=FALSE,
conf.level=.90, sims=50)
where mydata is a list with 5 imputed datasets, all with the same
variable names, the treatment is "pared", mediator is "ela", outcome
is "read", there is a list of covariates. I get the following error
message
Error in rep(1, nrow(dataarg)) : invalid 'times' argument
If I include a 'weight' variable in the model, the error message is different:
Error in eval(expr, envir, enclos) : object 'pared' not found
I think I am not including the right arguments in the function and
would be grateful for some advice. I tried to follow your example, but
in my case variable names are exactly the same in the 5 datasets, that
is why I am using 'rep'. Is this maybe the issue? I am able to share a
random sample of my data is necessary (100 obs in each imputed data,
for example).
Thank you,
Daniel
More information about the Mediation-information
mailing list