Displaying 1 result from an estimated 1 matches for "desirdata".
2012 Jul 31
1
Mediation analysis
...rning how to do mediation analysis in R. Ideally, I would like to use
Preacher's Bootstrapping test for mediation (Preacher & Hayes, 2004). I have
attempted to use the mediate package to set this up, using code that looks
basically like this:
model.m <- lm(data$outcome ~ data$mediator + desirdata$predictor)
model.y <- lm(data$outcome ~ data$predictor)
age1 <- mediate(model.m, model.y, treat = "predictor", mediator =
"mediator", conf.level=.95, boot=TRUE, sims=50)
However, I get an error indicating that the number of observations doesn't
match across the two m...