#Example with JOBS II Field experiment
#**For illustration purposes simulations set to low number**
data(jobs)
#########################################
#continuous mediator and continuous outcome
#########################################
model.m <- lm(job_seek ~ treat + depress1 + econ_hard + sex + age + occp + marital + nonwhite + educ + income, data=jobs)
model.y <- lm(depress2 ~ treat + job_seek + depress1 + econ_hard + sex + age + occp + marital + nonwhite + educ + income, data=jobs)
continuous <- mediate(model.m, model.y, sims=10, treat="treat", mediator="job_seek")
summary(continuous)Run the code above in your browser using DataLab