library(knitr)
The Bayesian framework is the right way to go for psychological science. To facilitate its use for newcommers, we implemented the bayes_cor.test
function in the psycho package, a user-friendly wrapper for the correlationBF
function of the great BayesFactor
package by Richard D. Morey.
Let's first perform a traditional correlation.
# devtools::install_github("neuropsychology/psycho.R") # Install the latest psycho version # Load packages library(tidyverse) library(psycho) # Import data df <- psycho::affective cor.test(df$Concealing, df$Tolerating)
There is a significant (whatever that means), yet weak positive correlation between Concealing and Tolerating affective styles.
And now, see how quickly we can do a Bayesian correlation:
bayes_cor.test(df$Concealing, df$Tolerating)
The results are roughly the same, but neatly dissociate the likelihood in favour or against the null hypothesis (using the Bayes Factor), from the "significance" (wether a portion of the Credible Interval covers 0), from the effect size (interpreted here with Cohen's (1988) rules of thumb). Critically, you can, now, simply copy/paste this output to your manuscript! It includes and formats the Bayes Factor, the median (a good point-estimate, close to the r estimated in frequentist correlation), MAD (robust equivalent of SD for median) and credible interval (CI) of the posterior distribution, as well as effect size interpretation.
We can have access to more indices with the summary
:
results <- bayes_cor.test(df$Concealing, df$Tolerating) summary(results)
knitr::kable(summary(results), digits=2)
Those indices include the ROPE decision criterion (see Kruschke, 2018) as well as the Maximum Probability of Effect (MPE, the probability that an effect is negative or positive and different from 0).
We can easily extract the posterior distribution to visualize the probability of possible effects.
posterior <- results$values$posterior plot(density(posterior))
This package helped you? Don't forget to cite the various packages you used :)
You can cite psycho
as follows:
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.