The present method calculates the corresponding default Bayes factor for a t-test statistic with Cauchy prior distribution for several sample sizes. The function returns the optimal sample size needed to reach the TPR for a given Bayes factor threshold to detect an expected population effect size. If a range of possible population effect sizes are plausible under the given hypothesis, the function can calculate the optimal sample sizes for the given range of effect sizes and present the results in a figure by using the plot_power_curve function.

ssp_bf_predetermined(
  tpr,
  delta,
  thresh = 10,
  max_n = 5000,
  tol = 1e-04,
  granularity = 300,
  prior_scale = 1/sqrt(2)
)

super_bf(n1, delta, thresh, tol, granularity, prior_scale)

Arguments

tpr

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

delta

Numeric. The expected population effect size or a range of expected effect sizes.

thresh

Integer. Critical threshold for the Bayes factor.

max_n

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

tol

Numeric. Relative accuracy requested.

granularity

Numeric. Relative precision of the tpr estimates, higher values mean more precision.

prior_scale

Numeric. Scale of the Cauchy prior distribution.

Value

The function returns a list of three named numeric vectors. The first `delta` is the range of deltas provided for the function. The second `n1` the determined sample size per group. The third `tpr_out` is the TPR corresponding to the determined sample sizes with the given delta.

Examples

if (FALSE) { SampleSizePlanner::ssp_bf_predetermined(tpr = 0.8, delta = 0.5, thresh = 10, max_n = 5000) }