nnmbf01: Sample size determination for normal moment prior Bayes...

nnmbf01R Documentation

Sample size determination for normal moment prior Bayes factor

Description

This function computes the required sample size to obtain a normal moment prior Bayes factor (nbf01) more extreme than a threshold k with a specified target power.

Usage

nnmbf01(
  k,
  power,
  usd,
  null = 0,
  psd,
  dpm,
  dpsd,
  nrange = c(1, 10^5),
  lower.tail = TRUE,
  integer = TRUE,
  ...
)

Arguments

k

Bayes factor threshold

power

Target power

usd

Unit standard deviation, the (approximate) standard error of the parameter estimate based on \code{n}=1, see details

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}

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. Defaults to c(1, 10^5)

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

integer

Logical indicating whether only integer valued sample sizes should be returned. If TRUE the required sample size is rounded to the next larger integer. Defaults to TRUE

...

Other arguments passed to stats::uniroot

Details

It is assumed that the standard error of the future parameter estimate is of the form \code{se} =\code{usd}/\sqrt{\code{n}}. For example, for normally distributed data with known standard deviation sd and two equally sized groups of size n, the standard error of an estimated standardized mean difference is \code{se} = \code{sd}\sqrt{2/n}, so the corresponding unit standard deviation is \code{usd} = \code{sd}\sqrt{2}. See the vignette for more information.

Value

The required sample size to achieve the specified power

Author(s)

Samuel Pawel

See Also

nmbf01, pnmbf01, powernmbf01

Examples

nnmbf01(k = 1/10, power = 0.9, usd = 1, null = 0, psd = 0.5/sqrt(2), dpm = 0.5, dpsd = 0)

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