From dcarov at gmail.com Fri Feb 21 18:26:43 2014 From: dcarov at gmail.com (Daniel Caro) Date: Fri, 21 Feb 2014 17:26:43 +0000 Subject: [Mediation-information] 'mediations' and multiple imputed datasets Message-ID: 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