Learn R Programming

BayesPower (version 1.0.2)

BF10.bin.test: Bayes Factor for a Bayesian One-Proportion Test

Description

Calculate the Bayes factor (BF10) for a single-proportion test, either against a point null or an interval null hypothesis.

Usage

BF10.bin.test(
  x,
  n,
  alpha,
  beta,
  h0,
  scale,
  prior_analysis,
  alternative,
  ROPE = NULL
)

Value

An object of class "BFvalue_bin" containing:

  • bf10: Bayes factor in favor of the alternative hypothesis.

  • type: Test type ("one-proportion").

  • x: Number of successes.

  • n: Sample size.

  • h0: Null proportion value.

  • analysis_h1: List describing the analysis prior, containing prior (prior distribution), alpha (alpha parameter), beta (beta parameter), and scale (scale parameter).

  • alternative: the direction of the alternative hypothesis.

  • ROPE: interval null bounds (if specified).

  • p.value: p-value.

Arguments

x

Numeric integer. Observed number of successes (non-negative integer scalar, must be \(\le n\)).

n

Numeric integer. Sample size (positive integer scalar).

alpha

Numeric scalar. Shape parameter of the analysis beta prior under the alternative hypothesis (required if prior_analysis = "beta").

beta

Numeric scalar. Shape parameter of the analysis beta prior under the alternative hypothesis (required if prior_analysis = "beta").

h0

Numeric scalar. Null proportion value (numeric scalar between 0.1 and 0.9).

scale

Numeric scalar. Scale parameter for the analysis prior (only used if prior_analysis = "Moment").

prior_analysis

character. the analysis prior under the alternative hypothesis: "beta" (stretched beta) or "Moment" (normal-moment prior).

alternative

character. Hypothesis being tested: two-sided ("two.sided"), right-sided ("greater"), or left-sided ("less").

ROPE

Numeric vector. Optional numeric vector specifying bounds for an interval null; used if interval BF is calculated.

Examples

Run this code
BF10.bin.test(
 x = 42,
 n = 52,
 h0 = 0.5,
 prior_analysis = "beta",
 alternative = "greater",
 alpha = 1,
 beta = 1)

Run the code above in your browser using DataLab