powernmbf01: Power and sample size calculations for normal moment prior...

View source: R/powernmbf01.R

powernmbf01R Documentation

Power and sample size calculations for normal moment prior Bayes factor

Description

Compute probability that normal moment prior Bayes factor is smaller than a specified threshold (the power), or determine sample size to obtain a target power.

Usage

powernmbf01(
  n = NULL,
  power = NULL,
  k = 1/10,
  sd = 1,
  null = 0,
  psd,
  type = c("two.sample", "one.sample", "paired"),
  dpm,
  dpsd,
  nrange = c(1, 10^5)
)

Arguments

n

Sample size (per group for two-sample tests). Has to be NULL if power is specified. Defaults to NULL

power

Target power. Has to be NULL if n is specified. Defaults to NULL

k

Bayes factor threshold. Defaults to 1/10, Jeffreys' threshold for 'strong evidence' against the null hypothesis

sd

Standard deviation of one observation (for type = "two.sample" or type = "one.sample") or of one difference within a pair of observations (type = "paired"). Is assumed to be known. Defaults to 1

null

Parameter value under the point null hypothesis. Defaults to 0

psd

Spread of the normal moment prior assigned to the parameter under the alternative in the analysis. The modes of the prior are located at \pm\sqrt{2}\,\code{psd}

type

The type of test. One of "two.sample", "one.sample", "paired". Defaults to "two.sample"

dpm

Mean of the normal design prior assigned to the parameter

dpsd

Standard deviation of the normal design prior assigned to the parameter. Set to 0 to obtain a point prior at the design prior mean

nrange

Sample size search range over which numerical search is performed (only taken into account when n is NULL). Defaults to c(1, 10^5)

Details

This function provides a similar interface as stats::power.t.test. It also assumes that the data are continuous and that the parameter of interest is either a mean or a (standardized) mean difference. For some users, the low-level functions nnmbf01 (to directly compute the sample size for a fixed power) and pnmbf01 (to directly compute the power for a fixed sample size) may also be useful because they can be used for other data and parameter types.

Value

Object of class "power.bftest", a list of the arguments (including the computed one) augmented with method and note elements

Author(s)

Samuel Pawel

See Also

plot.power.bftest, nnmbf01, pnmbf01, nmbf01

Examples

## determine power
powernmbf01(n = 100, psd = 1, dpm = 0.5, dpsd = 0)

## determine sample size
powernmbf01(power = 0.99, psd = 1, dpm = 0.5, dpsd = 0)


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