I have a dataset which has independent variable, dependent variable and Mediator.
I am trying to measure the direct effect and indirect effect.
I am using mediation package in R for doing this.
My dataset:
dput(data)[1:5,1:3]
structure(list(M = c(-0.794018835723402, 0.0365124064274065,
0.33468319748728, -1.56961436563011, -0.682147589670344, 0.973918338728507,
0.0243385995265122, -0.651749000024809, -0.134251272184058, 0.0486916271315886,
-0.916846082214958, 1.21779740455763, 0.592675922123552, -2.18177403751704,
0.713190061542312, 0.535602920784965, 1.19264174697961, 0.744935555245567,
-0.777450201772443, -0.0852799450788844, 1.49114919016139, 0.0852799450788844,
-0.360535649771563, 0.0608780749854632, 0.171185803484072, -0.507718909302338,
-0.810808368120177, -0.666871261897525, -1.09882441592895, -0.220806992868416,
-0.121982823723662, 1.14447383125234, 0.549701290113435, 0.283623365386844,
-0.493924893351373, -0.880403471264061, -0.89847561689514, -1.29832768395309,
0.728970974693915, 1.16821897957015, 1.52920515832222, -1.97257775644404,
1.05535688017356, 0.373551713728383, -0.535602920784965, 0.208355427419648,
0.862614392377302, -1.07683631583624, -0.0730735708617071, -2.5860339092871,
-0.208355427419648, 1.42092072964222, -0.0974990393467144, -0.426281258524948,
-1.89379348180508, -0.713190061542312, 0.360535649771563, 0.651749000024809,
1.12135702229057, 0.993660150363511, -1.05535688017356, -0.578233038217381,
-0.954548986789128, -1.01379703238149, -0.233292888303216, -0.862614392377302,
-0.158850820973749, 0.521610217854033, -0.146539961556908, -1.21779740455763,
0.134251272184058, 1.76436882734292, -0.258376301003193, -0.56390977976962,
-0.309052549457822, 1.35707531328169, -0.321841444045122, 0.296314005323909,
-0.109732708742409, -0.386631376099102, -0.0608780749854632,
2.5860339092871, -0.728970974693915, -0.399777521631387, 0.621941124231925,
0.810808368120177, 0.954548986789128, 0.794018835723402, 0.666871261897525,
-0.935531295081454, 0.0730735708617071, -1.12135702229057, -0.827829632765587,
1.89379348180508, 0.45308791532932, -2.33741769899198, -1.76436882734292,
0.578233038217381, 0.321841444045122, 0.682147589670344, -0.012168398709521,
0.012168398709521, -0.697584795041875, 1.09882441592895, -0.373551713728383,
0.347580384376274, -0.621941124231925, 1.01379703238149, 1.65914102242341,
-0.0365124064274065, 1.29832768395309, -0.0486916271315886, -0.283623365386845,
-0.973918338728507, 2.33741769899198, 0.466613119262383, 0.439645094434601,
-0.245815261241795, 0.220806992868416, -1.45513797472952, 0.258376301003193,
-1.24374824700315, 0.480224227652705, -0.347580384376274, 0.493924893351373,
-0.466613119262383, -0.744935555245567, 1.8252642315836, -1.49114919016139,
0.399777521631387, 0.827829632765587, -1.16821897957015, 0, 0.507718909302338,
1.27056485915352, 0.916846082214958, -0.521610217854033, 1.97257775644404,
0.121982823723662, 1.07683631583624, 1.327128982828, -0.412993125389175,
-0.45308791532932, 0.935531295081454, -2.06593146369746, 0.56390977976962,
-1.327128982828, -1.27056485915352, 0.270978241702546, 0.109732708742409,
-1.38829069765691, -1.14447383125234, -0.439645094434601, 0.412993125389176,
-0.636774336760061, 2.06593146369747, -1.42092072964222, 0.146539961556908,
-1.35707531328169, 0.697584795041875, -1.70939049299292, 1.03435362971249,
0.426281258524949, 0.777450201772443, 1.38829069765691, -0.29631400532391,
2.18177403751704, -0.549701290113435, 1.61276249827574, 0.183546888343148,
0.309052549457822, -1.19264174697961, 0.245815261241795, 0.845094189177777,
-0.993660150363511, -0.480224227652705, 0.158850820973749, 0.636774336760061,
-1.65914102242341, -0.33468319748728, -0.270978241702546, 0.607243511184333,
-1.8252642315836, -1.52920515832222, 0.89847561689514, -0.761092295870183,
0.195936083375207, -1.61276249827574, 1.70939049299292, 0.880403471264061,
-0.607243511184333, -1.03435362971249, 1.24374824700315, 0.233292888303215,
-0.845094189177777, 1.56961436563011, -0.0243385995265122, -0.592675922123552,
-0.171185803484072, 0.386631376099102, 0.0974990393467144, -0.183546888343148,
-0.195936083375207, 1.45513797472952, 0.761092295870183), Y = c(0.134251272184058,
-1.52920515832222, -0.935531295081454, -0.0730735708617071, -0.916846082214958,
0.744935555245567, 2.18177403751704, -0.146539961556908, 1.19264174697961,
-0.56390977976962, -0.426281258524948, 1.97257775644404, -0.697584795041875,
-0.993660150363511, -1.09882441592895, -0.283623365386845, 1.8252642315836,
2.06593146369747, -0.549701290113435, -0.158850820973749, 0.208355427419648,
0.549701290113435, -2.18177403751704, -0.89847561689514, -0.713190061542312,
-1.61276249827574, -1.01379703238149, -0.521610217854033, 0.45308791532932,
0.607243511184333, 0.158850820973749, 1.45513797472952, -0.245815261241795,
-0.0486916271315886, -1.05535688017356, -1.07683631583624, -0.728970974693915,
0.220806992868416, -2.33741769899198, -0.810808368120177, -0.666871261897525,
-0.233292888303216, -0.220806992868416, 0.916846082214958, 0.321841444045122,
0.258376301003193, 1.21779740455763, 0.146539961556908, -1.21779740455763,
0.713190061542312, -0.607243511184333, 1.56961436563011, 0.33468319748728,
0.954548986789128, -1.27056485915352, -0.386631376099102, 0.386631376099102,
1.42092072964222, 0.426281258524949, 0.480224227652705, 0.636774336760061,
-0.0974990393467144, -0.134251272184058, 0.0486916271315886,
0.109732708742409, -0.845094189177777, 0.666871261897525, 0.728970974693915,
0.761092295870183, 0.195936083375207, -0.29631400532391, 1.27056485915352,
-1.49114919016139, 0.439645094434601, 0.521610217854033, -0.535602920784965,
0.697584795041875, -1.38829069765691, 0.935531295081454, 0.0365124064274065,
-1.16821897957015, 1.61276249827574, -0.171185803484072, -0.466613119262383,
0.56390977976962, 1.29832768395309, 0.845094189177777, 1.35707531328169,
-0.880403471264061, -0.309052549457822, -0.651749000024809, -0.399777521631387,
-0.777450201772443, 0.507718909302338, -0.45308791532932, 0.578233038217381,
0.0608780749854632, 1.05535688017356, -1.45513797472952, 0.012168398709521,
1.07683631583624, 1.38829069765691, 0.0974990393467144, 0.535602920784965,
1.327128982828, -0.347580384376274, 1.16821897957015, 0.651749000024809,
-0.109732708742409, 0.0852799450788844, 2.33741769899198, 0.183546888343148,
0.973918338728507, 0, -1.70939049299292, 0.810808368120177, -0.270978241702546,
1.89379348180508, 0.283623365386844, -0.0243385995265122, -0.794018835723402,
-2.5860339092871, -1.42092072964222, 0.0243385995265122, 0.777450201772443,
-0.744935555245567, -0.0608780749854632, -0.321841444045122,
-0.0365124064274065, 1.76436882734292, -0.578233038217381, -0.208355427419648,
1.65914102242341, -0.592675922123552, -1.65914102242341, -0.621941124231925,
-1.29832768395309, 0.89847561689514, 1.01379703238149, 0.880403471264061,
1.52920515832222, 1.09882441592895, 0.121982823723662, -1.89379348180508,
-0.412993125389175, 1.24374824700315, -0.827829632765587, 0.794018835723402,
0.466613119262383, -2.06593146369746, 0.233292888303215, -1.56961436563011,
-0.360535649771563, -0.493924893351373, -0.373551713728383, 2.5860339092871,
-0.480224227652705, -0.439645094434601, 0.0730735708617071, 0.827829632765587,
-0.183546888343148, -0.954548986789128, -0.973918338728507, -0.195936083375207,
1.14447383125234, -0.862614392377302, 0.245815261241795, -1.12135702229057,
-0.012168398709521, 0.592675922123552, 0.309052549457822, 0.412993125389176,
-1.24374824700315, 0.296314005323909, 0.373551713728383, 0.270978241702546,
-1.327128982828, 0.862614392377302, 0.347580384376274, -0.507718909302338,
-1.76436882734292, 0.621941124231925, 0.682147589670344, -0.33468319748728,
-0.121982823723662, -1.03435362971249, -0.258376301003193, 0.399777521631387,
-0.682147589670344, -0.636774336760061, 1.03435362971249, 0.993660150363511,
-1.35707531328169, 0.493924893351373, 1.12135702229057, -1.8252642315836,
-1.97257775644404, 1.49114919016139, 1.70939049299292, -0.761092295870183,
0.171185803484072, 0.360535649771563, -1.14447383125234, -0.0852799450788844,
-1.19264174697961), X = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 1L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 1L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L,
0L, 0L, 0L, 0L)), class = "data.frame", row.names = c(NA, -205L
))
M Y X
1 -0.79401884 0.13425127 0
2 0.03651241 -1.52920516 0
3 0.33468320 -0.93553130 0
4 -1.56961437 -0.07307357 0
5 -0.68214759 -0.91684608 0
I followed these steps:
model.M <- lm(M~X,data)
model.Y <- lm(Y~X+M,data)
results <- mediate(model.M,model.Y,sims=500,boot=T,mediator="M",treat="X")
plot(results)
summary(results)
Causal Mediation Analysis
Nonparametric Bootstrap Confidence Intervals with the Percentile Method
Estimate 95% CI Lower 95% CI Upper
ACME -0.184 -0.418 -0.02
ADE 0.808 0.347 1.18
Total Effect 0.624 0.122 1.08
Prop. Mediated -0.295 -1.850 -0.01
p-value
ACME 0.016 *
ADE <2e-16 ***
Total Effect 0.024 *
Prop. Mediated 0.040 *
---
Signif. codes:
0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Sample Size Used: 205
Simulations: 500][1]][1]
After running mediation, I know that if there is mediation the direct effect is reduced or becomes 0 in comparison to total effect But in my case the direct effect is increased: does it mean after controlling for M, M is not a mediator? I am not able to interpret the increased value Can anyone who has done mediation analysis provide any comments/feedback Thank you.