Learn R Programming

BayesPower (version 1.0.2)

BF10.cor: Bayes factor for a Bayesian correlation test

Description

Calculate the Bayes factor (BF10) for a correlation coefficient, either against a point null or an interval null hypothesis. Supports default beta ("d_beta"), stretched beta ("beta"), and normal-moment ("Moment") priors for the alternative hypothesis.

Usage

BF10.cor(
  r,
  n,
  k,
  alpha,
  beta,
  h0,
  alternative,
  scale,
  prior_analysis,
  ROPE = NULL
)

Value

A list with class "BFvalue_r" containing:

  • type: "correlation"

  • bf10: Calculated Bayes factor BF10

  • h0: Null value of the correlation

  • r: Observed correlation coefficient

  • n: Sample size

  • analysis_h1: List with the analysis prior parameters: prior_analysis, k, alpha, beta, and scale.

  • alternative: the direction of the alternative hypothesis

  • ROPE: Interval bounds if specified

  • p.value: Numeric, p.value.

Arguments

r

Numeric scalar. Observed correlation coefficient. Must be a numeric scalar between -1 and 1.

n

Numeric integer. Sample size. Must be a numeric scalar greater than 3.

k

Numeric scalar. Parameter for the analysis default beta prior ("d_beta") under the alternative hypothesis.

alpha

Numeric scalar. Parameter for the analysis beta prior ("beta") under the alternative hypothesis.

beta

Numeric scalar. Parameter for the analysis beta prior ("beta") under the alternative hypothesis.

h0

Numeric scalar. Null value of the correlation. Must be a numeric scalar between -0.8 and 0.8.

alternative

Character. The direction of the alternative hypothesis being tested: two-sided ("two.sided"), right-sided ("greater"), or left-sided ("less").

scale

Numeric scalar. Scale parameter for the analysis normal-moment prior ("Moment"). Must be > 0.

prior_analysis

Character. Analysis prior: default beta ("d_beta"), beta ("beta"), or normal-moment ("Moment").

ROPE

Numeric vector. Optional numeric vector specifying bounds for an interval null hypothesis. For "two.sided", must be two distinct finite values between -0.5 and 0.5. For "greater" or "less", must satisfy additional bounds relative to h0.

Examples

Run this code
BF10.cor(
  r = 0.3930924,
  n = 46,
  prior_analysis = "d_beta",
  k = 1,
  h0 = 0,
  alternative = "two.sided")

Run the code above in your browser using DataLab