# NOT RUN {
# Examples with JOBS II Field Experiment
# **For illustration purposes a small number of simulations are used**
# }
# NOT RUN {
data(jobs)
require(lme4)
# educ: mediator group
# occp: outcome group
# Varying intercept for mediator
model.m <- glmer(job_dich ~ treat + econ_hard + (1 | educ),
family = binomial(link = "probit"), data = jobs)
# Varying intercept and slope for outcome
model.y <- glmer(work1 ~ treat + job_dich + econ_hard + (1 + treat | occp),
family = binomial(link = "probit"), data = jobs)
# Output based on mediator group
multilevel <- mediate(model.m, model.y, treat = "treat",
mediator = "job_dich", sims=50, group.out="educ")
#plot(multilevel, group.plots=TRUE)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab