Determine sample size with Predetermined sample size with Bayes factor method
Source:R/ssp_bf_predetermined.R
ssp_bf_predetermined.Rd
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.
Usage
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.