Learn R Programming

BayesMed (version 1.0.1)

plot.CI: 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

"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).

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

Yuan, Y., & MacKinnon, D. (2009). Bayesian mediation analysis. Psychological Methods, 14, 301-322.

See Also

jzs_medSD

Examples

Run this code
## 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)

Run the code above in your browser using DataLab