#Example with JOBS II Field experiment
#For illustration purposes simulations set to low number.
#Example with JOBS II Field experiment
data(jobs)
#########################################
#continuous mediator and continuous outcome
#########################################
#fit parametric model
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)
#pass model objects through medsens function
sens.cont <- medsens(model.m, model.y, T="treat", M="job_seek", INT=FALSE, DETAIL=FALSE, sims=1000)
#plot mediation effect and 95plot(sens.cont, main="JOBS", ylim=c(-.2,.2))
Run the code above in your browser using DataLab