kosukeimai / mediation

R package mediation
58 stars 29 forks source link

Model combination error using medsens on a mediate object derived from amelidiate (multiply-imputed data) #56

Open vriesTR opened 1 year ago

vriesTR commented 1 year ago

I have a question regarding the functionality of the medsens function.

I am conducting a causal mediation analysis with a binary outcome and a continous mediator. My data is subject to missing data and I have opted to use multiple imputation in my workflow (through MICE). The mediations package workflow allows me to conduct the mediation analysis on imputed data in a very straightforward manner (through the mediations and amelidiate functions). The summary and plot functions work appropiately; I have obtained the results of the main analysis.

I am now in the stage where I would like to pass the mediate object (that results from the amelidiate function, which I use to pool results from the imputed datasets) through the medsens function in order to conduct the sensitivity analysis. Unfortunately, this is where I run into issues. I receive an error message which mentions that the model combination used in my analysis is not supported. The model combination should however be supported if I am not mistaken (continous mediator, binary outcome. Families in the mediations call are correctly specified as "gaussian" and "binomial", respectively; the mediate object confirms this. No treatment-mediator interaction was specified).

The question: should the medsens function in theory support the workflow described in the vignet accompanying the 'mediation' package on multiple-imputed data? I have no issues running the workflow on the non-imputed data, nor when I run the analysis on the individual imputed datasets (I have not gone through pooling the results from the individual analyses so far).

Looking forward as to any reply. Thanks in advance!

tingleyd commented 1 year ago

Hi, Medsens was not setup to take in the output of ameldiate. It should be possible, but not as it is currently setup.