From kimai at Princeton.Edu Thu Jan 22 05:31:42 2015 From: kimai at Princeton.Edu (Kosuke Imai) Date: Wed, 21 Jan 2015 23:31:42 -0500 Subject: [Mediation-information] "Mediation" package for R In-Reply-To: References: Message-ID: Dear Fan, Our mediation effect is on the same scale as the outcome variable, which means that you cannot simply compare it with the coefficients from a logistic regression. You might want to check out our American Political Science Review or Psychological Methods articles, which explain this. The papers are available at: http://imai.princeton.edu/projects/mechanisms.html In addition, because of non-linearity, there will be some discrepancies between alternative modeling strategies. For example, if you model M given T as a logistic regression and Y given M and T as another logistic regression, it follows that Y given T is NOT a logistic regression. Hopefully, your results are strong enough not to be dependent on this kind of model choice. Multiple mediators are quite tricky but we did write a paper that proposes one approach to deal with this problem. Have a look at the Political Analysis paper on the aforementioned webpage to see if the method proposed in that paper (which is implemented in the package) are applicable in your setting. Best, Kosuke --------------------------------------------------------- Kosuke Imai Office: Corwin Hall 036 Professor Phone: 609-258-6601 Department of Politics Fax: 609-258-1110 Princeton University Email: kimai at Princeton.Edu Princeton, NJ 08544-1012 http://imai.princeton.edu --------------------------------------------------------- On Tue, Jan 20, 2015 at 10:56 AM, Fan He wrote: > Dear Dr. Imai, > > This is Fan He, an investigator in the Penn State University College of > Medicine. Recently, I was trying to do some mediation analyses with your > ?Mediation? package for R, which is very user-friendly and productive. > > > > However, there are some difficulties when I applying the package on binary > outcome variables. Specifically, the ?Total Effect? that generated from the > R package is dramatically different from the one from traditional > regression models (e.g. logistic regression). > > > > To illustrate the problem, I did a simulation, in which the effect of ?T? > on ?y? was partially through ?M?, with the following codes and results: > > > > n = 2000 > > T = rbinom(n, 1, .5) > > M = 1.5 + 5*T + rnorm(n) > > pi1 = .5 + .3*(M - mean(M)) + .5*T > > pi1 = exp(pi1)/(1+exp(pi1)) > > > > y = rbinom(n, 1, pi1) > > > > model1 = glm(y~T, family=binomial) > > summary(model1) > > > > Coefficients: > > Estimate Std. Error z value Pr(>|z|) > > (Intercept) -0.37086 0.06566 -5.648 1.62e-08 *** > > T 2.05362 0.10764 19.078 < 2e-16 *** > > > > As expected, the regression coefficient from the above logistic regression > model for ?T? was around 2. > > > > > > > > med.fit <- lm(M ~ T) > > out.fit <- glm(y ~ T + M, family=binomial("probit")) > > med.out <- mediate(med.fit, out.fit, boot = TRUE, treat = "T", mediator = > "M", sims = 500) > > summary(med.out) > > > > Estimate 95% CI Lower 95% CI Upper p-value > > ACME (control) 0.35569 0.25187 0.43794 0.00 > > ACME (treated) 0.32105 0.20176 0.44693 0.00 > > ADE (control) 0.11286 -0.01480 0.23602 0.07 > > ADE (treated) 0.07823 -0.00951 0.18292 0.07 > > Total Effect 0.43391 0.39841 0.47005 0.00 > > Prop. Mediated (control) 0.81972 0.58100 1.02256 0.00 > > Prop. Mediated (treated) 0.73990 0.46773 1.03514 0.00 > > ACME (average) 0.33837 0.22614 0.44451 0.00 > > ADE (average) 0.09554 -0.01216 0.20802 0.07 > > Prop. Mediated (average) 0.77981 0.52695 1.02885 0.00 > > > > Although the proportion of the effect that explained by the mediator is > reasonable (close to 0.75), the ?Total Effect? from the mediation model was > substantially smaller than 2. Could you help me solve the problem? > > > > Besides, would the package be able to handle two or more inter-related > mediators and calculate the mediation effect for each of them? > > > > I read your paper that you have the ?multimed? function for two > causally-related mediators, in which you have a ?primary mediator? and an > ?alternative mediator?. But it doesn?t calculate the mediation effect for > the two mediators separately. > > > > Your help will be greatly appreciated. > > > > Thanks, > > Fan > > > > Fan He M.S. > > Department of Public Health Sciences > > Penn State University College of Medicine > > 90 Hope Dr. Suite 2200, A210 > > Hershey, PA 17033 > > E-mail: fhe at phs.psu.edu > > Tel: 717-531-1172 Fax: 717-531-5779 > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: