Description Usage Arguments Details Value Visible Output Author(s) References See Also Examples

This function can be used to perform a default Bayesian hypothesis test for mediation, using a Jeffreys-Zellner-Siow prior set-up (Liang et al., 2008). The test is based on the default Bayesian hypothesis tests for correlation and partial correlation (Wetzels & Wagenmakers, 2012).

1 2 3 4 5 |

`independent` |
a vector containing values for the independent variable. |

`dependent` |
a vector containing values for the dependent variable. |

`mediator` |
a vector containing values for the mediating variable. |

`alternativeA` |
specify the alternative hypothesis for path alpha: |

`alternativeB` |
specify the alternative hypothesis for path beta: |

`alternativeT` |
specify the alternative hypothesis for path tau_accent: |

`n.iter` |
number of total iterations per chain (see the package |

`n.burnin` |
length of burn in, i.e. number of iterations to discard at the beginning(see the package |

`standardize` |
logical. Should the variables be standardized? Defaults to TRUE. |

The test consists of four steps. Firstly, it computes the posterior probability for the existence of the path between the independent and the mediating variable (path alpha) by means of a default Bayesian hypothesis test for correlation (Wetzels & Wagenmakers, 2012).

Secondly, it computes the posterior probability for the existence of the path between the mediating and the dependent variable, controlled for the influence of the independent variable (path beta) by means of a default Bayesian hypothesis test for partial correlation (Wetzels & Wagenmakers, 2012).

Thirdly, the evidence for mediation is computed by multiplying the posterior probabilities for the paths alpha and beta.

Fourthly, the evidence for full mediation is computed by multiplying the evidence for mediation with one minus the posterior probability for the existence of path tau', the path between the independent and dependent variable, controlled for the mediator.

jzs_md returns a list containing visible (printed) and invisible components. The visible components are a data frame with the main results and the 95% credible interval of the mediated effect (see next section). The invisible components contain additional information on the parameters, and can be used for plot functions etc.

The visible output, the output that is printed to the screen, is a list containing a data frame and a credible interval.

- Estimate_alpha
The mean of the posterior samples of alpha.

- Estimate_beta
The mean of the posterior samples of beta.

- Estimate_tau_prime
The mean of the posterior samples of tau_prime.

- Estimate_Mediation (alpha*beta)
The mean of the posterior samples of the indirect effect alpha*beta.

- BF_alpha
The Bayes factor for the existence of path alpha. A value greater than one indicates evidence that alpha exists, a value smaller than one indicates evidence that alpha does not exist.

- BF_beta
The Bayes factor for the existence of path beta. A value greater than one indicates evidence that beta exists, a value smaller than one indicates evidence that beta does not exist.

- BF_tau_prime
The Bayes factor for the existence of path tau_prime. A value greater than one indicates evidence that tau_prime exists, a value smaller than one indicates evidence that tau_prime does not exist.

- BF_Mediation (alpha*beta)
The Bayes factor for mediation compared to no mediation. A value greater than one indicates evidence in favor of mediation, a value smaller than one indicates evidence against mediation.

- PostProb_alpha
The posterior probability that the path alpha (the relation between the independent and the mediating variable) is not zero.

- PostProb_beta
The posterior probability that the path beta (the relation between the mediating and the dependent variable after controlling for the independent variable) is not zero.

- PostProb_tau_prime
The posterior probability that the path tau_prime (the relation between the independent and the dependent variable after controlling for the mediator) is not zero.

- PostProb_Mediation (alpha*beta)
The posterior probability that the relation between the independent and the dependent variable is mediated by the specified mediator.

- CI_ab
The 95% credible interval of the indirect effect "ab".

Michele B. Nuijten <[email protected]>, Ruud Wetzels, Dora Matzke, Conor V. Dolan, and Eric-Jan Wagenmakers.

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_cor`

, `jzs_partcor`

, `jzs_medSD`

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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | ```
## 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
result <- jzs_med(independent=X,dependent=Y,mediator=M)
result
#-------------------------------------
# load Firefighter data
data(Firefighters)
X <- Firefighters$x
M <- Firefighters$m
Y <- Firefighters$y
# run jzs_med
result <- jzs_med(independent=X,dependent=Y,mediator=M)
# plot the result in a mediation diagram
plot(result$main_result)
# inspect posterior distribution of the coefficients
plot(result$alpha_samples)
plot(result$beta_samples)
plot(result$tau_prime_samples)
# print a traceplot of the chains
plot(result$jagssamplesA)
plot(result$jagssamplesTB)
# where the first chain (theta[1]) is for tau' and the second chain (theta[2]) for beta
# calculate and plot a 95% credible interval for the
# posterior mean of the indirect effect
result$CI_ab
plot(result$ab_samples)
## End(Not run)
``` |

MicheleNuijten/BayesMed documentation built on May 7, 2019, 4:56 p.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.