Skip to contents

The present method provides an expected sample size such that compelling evidence in the form of a Bayes factor can be collected given the group means.

Usage

ssp_anova_bf(
  effect,
  mu,
  tpr,
  thresh,
  prior_scale,
  iter,
  max_n = 10001,
  max_bf = 1e+08,
  sigma = 1,
  seed = NULL
)

twoway_ANOVA_bf_pwr(
  effect = effect,
  iter = iter,
  n = n1,
  mu = mu,
  sigma = sigma,
  thresh = thresh,
  max_bf = max_bf,
  prior_scale = prior_scale,
  seed = NULL
)

twowayANOVApwr(effect, iter, n1, mu, sigma, alpha, seed)

Arguments

effect

Character. The effect of interest (main effect A, main effect B, interaction effect).

mu

Numeric. The mean of the DV for each group.

tpr

Numeric. The long-run probability of obtaining a Bayes factor at least as high as the critical threshold favoring superiority, given mu.

thresh

Integer. The Bayes factor threshold for inference.

prior_scale

Numeric. Scale of the Cauchy prior distribution.

iter

Integer. The number of iterations.

max_n

Integer. The maximum number of participants per group (all groups are assumed to have equal sample size).

max_bf

Numeric. The maximum Bayes Factor value to reduce computation time. If all Bayes Factors in the first 10 iterations exceeded the max_bf, we set the TPR equal to 1 and proceeded with the next sample size.

sigma

Numeric. The standard deviation of the DV for the groups.

seed

Numeric. The seed for reproducibility.

n

Numeric. The sample size per group during the tpr optimization process.

n1

Numeric. The sample size per group during the tpr optimization process.

Value

The function returns a list of four named numeric vectors. The first `n1` is the range of determined sample sizes for the given design. The second `tpr_out` is the range of TPRs that were provided as a parameter.

Examples

if (FALSE) { # \dontrun{
SampleSizePlanner::ssp_anova_bf(
  effect = "Interaction Effect", tpr = 0.8, max_n = 10001, mu = c(1.5, 1.5, 0, 1), sigma = 2,
  seed = NULL, thresh = 10, prior_scale = 1 / sqrt(2)
 )
} # }