jzs_partcorSD(V1, V2, control, SDmethod = c("fit.st", "dnorm", "splinefun", "logspline"), alternative = c("two.sided", "less", "greater"), n.iter=10000,n.burnin=500,standardize=TRUE)two.sided, greater than zero, or less than zero.
R2jags). Defaults to 10000.
R2jags). Defaults to 500.
fit.st will fail to converge. If so, another optimization method is used, using different starting values. If the other optimization method does not converge either or gives you a negative Bayes factor (which is meaningless), you could try one of the other SDmethod options or see jzs_partcor.Liang, F., Paulo, R., Molina, G., Clyde, M. A., & Berger, J. O. (2008). Mixtures of g priors for Bayesian variable selection. Journal of the American Statistical Association, 103(481), 410-423.
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
Wetzels, R., & Wagenmakers, E.-J. (2012). A Default Bayesian Hypothesis Test for Correlations and Partial Correlations. Psychonomic Bulletin & Review, 19, 1057-1064.
jzs_partcor, jzs_corSD
# simulate partially correlated data
X <- rnorm(50,0,1)
C <- .5*X + rnorm(50,0,1)
Y <- .3*X + .6*C + rnorm(50,0,1)
# run jzs_partcor
(res <- jzs_partcorSD(X,Y,C))
# plot posterior samples
plot(res$beta_samples)
# plot traceplot
plot(res$jagssamples)
# where the first chain (theta[1]) is for tau' and the second chain (theta[2]) for beta
Run the code above in your browser using DataLab