pingouin.bayesfactor_pearson

pingouin.
bayesfactor_pearson
(r, n)[source] Bayes Factor of a Pearson correlation.
 Parameters
 rfloat
Pearson correlation coefficient
 nint
Sample size
 Returns
 bfstr
Bayes Factor (BF10). The Bayes Factor quantifies the evidence in favour of the alternative hypothesis.
Notes
Adapted from a Matlab code found at https://github.com/anneurai/Tools/blob/master/stats/BayesFactors/corrbf.m
If you would like to compute the Bayes Factor directly from the raw data instead of from the correlation coefficient, use the
pingouin.corr()
function.The JZS Bayes Factor is approximated using the formula described in ref [1]:
\[BF_{10} = \frac{\sqrt{n/2}}{\gamma(1/2)}* \int_{0}^{\infty}e((n2)/2)* log(1+g)+((n1)/2)log(1+(1r^2)*g)+(3/2)log(g)n/2g\]where n is the sample size and r is the Pearson correlation coefficient.
References
 1(1,2)
Wetzels, R., Wagenmakers, E.J., 2012. A default Bayesian hypothesis test for correlations and partial correlations. Psychon. Bull. Rev. 19, 1057–1064. https://doi.org/10.3758/s134230120295x
Examples
Bayes Factor of a Pearson correlation
>>> from pingouin import bayesfactor_pearson >>> bf = bayesfactor_pearson(0.6, 20) >>> print("Bayes Factor: %s" % bf) Bayes Factor: 8.221