kosukeimai / mediation

R package mediation
58 stars 29 forks source link

Multiple imputations with mediations and amelidiate functions #31

Open a-chernofsky opened 3 years ago

a-chernofsky commented 3 years ago

I am using the mediations() and amelidiate() functions to estimate causal mediated effects with 5 imputed datasets. After running the amelidiate() function on the 5 mediation analyses from the mediations() function, the estimates are equivalent to the mediation based on the first imputed dataset. I did some digging in the source code and realized that the amelidiate() function uses the names from mediations() to organize the data but the names of the 5 mediation analyses are identical so it is only using the first dataset. I am going to rename the resulting list from the mediations() function so that I can use the amelidiate() function. The main application for these functions seems to be a scenario with multiple outcome or mediators and so that resulting names would be different in that case but multiple imputations is also mentioned as an application so I thought this might be a useful comment for future releases of the package or for anyone who is having a similar problem.