plot.CI: Plot the posterior distribution of the indirect effect...

Description Usage Arguments Author(s) References See Also Examples

View source: R/plot.CI.R

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

1
2
## 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

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

See Also

jzs_medSD

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## 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)

MicheleNuijten/BayesMed documentation built on Jan. 31, 2020, 7:45 a.m.