ptbf01: Cumulative distribution function of the t-test Bayes factor

ptbf01R Documentation

Cumulative distribution function of the t-test Bayes factor

Description

This function computes the probability of obtaining a t-test Bayes factor (tbf01) more extreme than a threshold k with a specified sample size.

Usage

ptbf01(
  k,
  n,
  n1 = n,
  n2 = n,
  null = 0,
  plocation = 0,
  pscale = 1/sqrt(2),
  pdf = 1,
  dpm = plocation,
  dpsd = pscale,
  type = c("two.sample", "one.sample", "paired"),
  alternative = c("two.sided", "less", "greater"),
  lower.tail = TRUE,
  drange = "adaptive",
  ...
)

Arguments

k

Bayes factor threshold

n

Sample size (per group)

n1

Sample size in group 1 (only required for two-sample t-test with unequal group sizes)

n2

Sample size in group 2 (only required for two-sample t-test with unequal group sizes)

null

Standardized mean difference under the point null hypothesis. Defaults to 0

plocation

t prior location. Defaults to 0

pscale

t prior scale. Defaults to 1/sqrt(2)

pdf

t prior degrees of freedom. Defaults to 1 (a Cauchy prior)

dpm

Mean of the normal design prior assigned to the standardized mean difference. Defaults to the analysis prior location

dpsd

Standard deviation of the normal design prior assigned to the standardized mean difference. Set to 0 to obtain a point prior at the design prior mean. Defaults to the analysis prior scale

type

Type of t-test. Can be "two.sample" (default), "one.sample", or "paired"

alternative

Direction of the test. Can be either "two.sided" (default), "less", or "greater". The latter two truncate the analysis prior to negative and positive effects, respectively. If set to "less" or "greater", the power is only computed based on data with effect estimates in the direction of the alternative

lower.tail

Logical indicating whether Pr(\mathrm{BF}_{01} \leq k) (TRUE) or Pr(\mathrm{BF}_{01} > k) (FALSE) should be computed. Defaults to TRUE

drange

Standardized mean difference search range over which the critical values are searched for. Can be either set to a numerical range or to "adaptive" (default) which determines the range in an adaptive way from the other input parameters

...

Other arguments passed to stats::uniroot

Value

The probability that the Bayes factor is less or greater (depending on the specified lower.tail) than the specified threshold k

Author(s)

Samuel Pawel

See Also

tbf01, ntbf01, powertbf01

Examples

## example from Schönbrodt and Wagenmakers (2018, p. 135)
ptbf01(k = 1/6, n = 146, dpm = 0.5, dpsd = 0, alternative = "greater")
ptbf01(k = 6, n = 146, dpm = 0, dpsd = 0, alternative = "greater",
       lower.tail = FALSE)

## two-sided
ptbf01(k = 1/6, n = 146, dpm = 0.5, dpsd = 0)
ptbf01(k = 6, n = 146, dpm = 0, dpsd = 0, lower.tail = FALSE)

## one-sample test
ptbf01(k = 1/6, n = 146, dpm = 0.5, dpsd = 0, alternative = "greater", type = "one.sample")


bfpwr documentation built on June 8, 2025, 1:40 p.m.