# Confidence Intervals on Indirect Effect: Moderated Mediation/Conditional Path Analysis in R

I'm trying to bootstrap confidence intervals for my estimates of the indirect effects of a mediation model. Because it is actually (first-stage, a-path) moderated mediation, I need to actually do this three times, to find the indirect effect when my moderator (fiscal below) is at the mean(fiscal) and +- 1 standard deviation.

I have estimated my model in two ways:

1. Using the mediation package.

summary(model_m <- lm(unaccept_i ~ condition*fiscal, data=d1))
summary(model_y <- lm(redis_i ~ condition*fiscal + unaccept_i, data=d1))

mod_med <- mediation::mediate(model_m, model_y,
covariates = list(fiscal = 0),
treat="condition",
mediator="unaccept_i",
boot=T,
sims = 5000)


2. Using the psych package.

psy_med <- psych::mediate(redis_i ~ condition*fiscal + (unaccept_i),
data=d1, plot=F, n.iter=5000)


I can either try to access the indirect effects from either of the two approaches above (if it that's possible? It's unclear) or by directly calculating it myself:

#conditional effect of X on Y through M: (a1 + a3*W)*b
a1 <- mod_med$$model.m$$coefficients[2]
a3 <- mod_med$$model.m$$coefficients[4]
b <- mod_med$$model.y$$coefficients[4]

cond_fx_pap <- tibble(fis_val = c(mean(d1$$fiscal)-sd(d1$$fiscal),
mean(d1$$fiscal), mean(d1$$fiscal)+sd(d1\$fiscal)),
cond_ind_fx = (a1 + a3*fis_val)*b)


The only problem is that this approach doesn't give me confidence intervals.

Is anyone able to figure out how to bootstrap/Monte Carlo simulate confidence intervals so I can plot the conditional indirect effects (a*b) at the mean and +- 1 SD of my moderator?