Bf_samplesize: Calculate Sample Size for Bayes Factor

View source: R/Bf_samplesize.R

Bf_samplesizeR Documentation

Calculate Sample Size for Bayes Factor

Description

This function calculates the minimum sample size required to obtain evidence for H1 or H0 using Bayes factors. It supports different likelihood and prior distributions and assumes equal group sizes for between-subject designs.

Usage

Bf_samplesize(
  distribution_likelihood = c("normal", "t"),
  distribution_prior = c("normal", "cauchy", "uniform"),
  sd_of_theory,
  tail = c(1, 2),
  n_start,
  n_end,
  step,
  sd1,
  sd2 = NULL,
  threshold = c(3, 6, 10),
  tpr = c(0.5, 0.8, 0.9, 0.95)
)

Arguments

distribution_likelihood

Distribution for the likelihood function ("normal" or "t").

distribution_prior

Distribution for the prior ("normal", "cauchy", or "uniform").

sd_of_theory

The standard deviation of the theoretical distribution.

tail

The number of tails (1 or 2).

n_start

Starting sample size.

n_end

Maximum sample size.

step

Step size for sample size increments.

sd1

Standard deviation of the first sample.

sd2

Standard deviation of the second sample (for between-subject designs).

threshold

Bayes factor threshold for stopping.

tpr

True positive rate.

Value

A list with required sample sizes for H1 and H0.


BencePalfi/SampleSizeBF documentation built on April 3, 2025, 2:01 p.m.