computePearsonBCor: Compute Bayes factors bf10, bfPlus0, bfMin0 based on the...

View source: R/pearson.R

computePearsonBCorR Documentation

Compute Bayes factors bf10, bfPlus0, bfMin0 based on the default stretched beta prior on (-1, 1) for Pearson's correlation coefficient rho

Description

Compute Bayes factors bf10, bfPlus0, bfMin0 based on the default stretched beta prior on (-1, 1) for Pearson's correlation coefficient rho

Usage

computePearsonBCor(
  n,
  r,
  h0 = 0,
  kappa = 1,
  ciValue = 0.95,
  hyperGeoOverFlowThreshold = 25,
  methodNumber = 1L,
  oneThreshold = 0.001
)

Arguments

n

numeric > 0, number of samples

r

numeric in (-1, 1), the observed Pearson correlation r in the sample

h0

numeric in (-1, 1), the hypothesised null value

kappa

numeric > 0, the scale of the beta distribution, i.e., beta(1/kappa, 1/kappa)

ciValue

numeric in (0, 1), the credible value

hyperGeoOverFlowThreshold

numeric > 0, the threshold function for which some computations for which the function genhypergeo in hypergeo [version 1.2-13] used for the one-sided Bayes factors lead to some instablish results.

methodNumber

numeric in reference to the computation method used to calculate Bayes factors: (1) Exact results, see Ly et al. (2018) [when log(bf10) > hyperGeoOverFlowThreshold, the one-sided Bayes factors are calculated using a numerical integrator, or a Savage Dickey method redistribution], (2) Semi-exact, see Wagenmakers et al. (2015), (3) Savage-Dickey: First fit a stretched beta to the posterior based on the exact posterior mean and variance, then compute the ratio of prior to posterior at the restriction point, that is, h0 (4) First generate posterior samples using Marsman's IMH sampler, which is the used to fit a stretched beta and again the ratio of prior and posterior is used to compute bf10, (5) use Jeffreys's approximation to bf10 based on kappa=1

oneThreshold

numeric > 0, used to determine when abs(r) is considered indistinguishable from one.

Value

Returns a list with bf10, bfPlus0, bfMin0, whether the result is plottable, the credible interval.


AlexanderLyNL/bstats documentation built on Sept. 11, 2023, 4:10 p.m.