R: Plot the posterior distribution of the indirect effect...
plot.CI
R Documentation
Plot the posterior distribution of the indirect effect alpha*beta
Description
Plot the posterior distribution of the indirect effect alpha*beta including a 95% credible interval around the mean of the posterior (see Nuijten et al. (2014); Yuan & MacKinnon, 2009).
Usage
## S3 method for class 'CI'
plot(x,...)
Arguments
x
the posterior samples of alpha*beta as obtained from the output of jzs_medSD. This is an object of class CI.
...
additional arguments to be passed on to the plot method, such as graphical parameters (see par).
Author(s)
Michele B. Nuijten <m.b.nuijten@uvt.nl>, Ruud Wetzels, Dora Matzke, Conor V. Dolan, and Eric-Jan Wagenmakers.
References
Nuijten, M. B., Wetzels, R., Matzke, D., Dolan, C. V., & Wagenmakers, E.-J. (2014). A default Bayesian hypothesis test for mediation. Behavior Research Methods. doi: 10.3758/s13428-014-0470-2
## Not run:
# simulate mediational data
a <- .5
b <- .6
t_prime <- .3
X <- rnorm(50,0,1)
M <- a*X + rnorm(50,0,1)
Y <- t_prime*X + b*M + rnorm(50,0,1)
# run jzs_med
res <- jzs_med(independent=X,dependent=Y,mediator=M)
# plot posterior distribution of a*b
plot(res$ab_samples)
# print the exact lower and upper boundary of the interval
res$CI_ab
## End(Not run)