plot.rjags: Plot the chains of the JAGS samples

Description Usage Arguments Author(s) References Examples

Description

Displays a plot of iterations vs. sampled values for each variable in the chain, with a separate plot per variable (see traceplot of the package R2jags; Su & Yajima, 2012).

Usage

1
2
## S3 method for class 'rjags'
plot(x,...)

Arguments

x

an rjags object.

...

additional arguments to be passed on to the traceplot method, such as graphical parameters (see traceplot).

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

Su, Y.-S., & Yajima, M. (2012). R2jags: A package for running jags from Rb[Computer software manual]. Available from http://CRAN.R-project.org/package=R2jags (R package version 0.03-08)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
## Not run: 
# simulate correlational data
X <- rnorm(50,0,1)
Y <- .3*X + rnorm(50,0,1)

# save jzs_cor output
res <- jzs_cor(X,Y)

# plot results
plot(res$jagssamples)

############

# 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
res2 <- jzs_med(independent=X,dependent=Y,mediator=M)

# plot resulting chains for alpha, beta, and tau_prime
plot(res2$jagssamplesA)
plot(res2$jagssamplesTB)

## End(Not run)

BayesMed documentation built on May 2, 2019, 9:27 a.m.