| Title: | Sample Size and Power Calculation for Bayesian Testing with Bayes Factor | 
| Version: | 1.0.1 | 
| Description: | The goal of 'BayesPower' is to provide tools for Bayesian sample size determination and power analysis across a range of common hypothesis testing scenarios using Bayes factors. The main function, BayesPower_BayesFactor(), launches an interactive 'shiny' application for performing these analyses. The application also provides command-line code for reproducibility. Details of the methods are described in the tutorial by Wong, Pawel, and Tendeiro (2025) <doi:10.31234/osf.io/pgdac_v1>. | 
| BugReports: | https://github.com/tkWong3004/BayesPower/issues | 
| License: | GPL (≥ 3) | 
| Encoding: | UTF-8 | 
| RoxygenNote: | 7.3.3 | 
| Imports: | rlang, shiny, gsl, Rcpp, ExtDist, ggplot2, patchwork, rmarkdown, glue, hypergeo, rootSolve, shinyWidgets | 
| LinkingTo: | Rcpp, BH | 
| NeedsCompilation: | yes | 
| Packaged: | 2025-10-26 08:54:28 UTC; u971096 | 
| Author: | Tsz Keung Wong [aut, cre], Samuel Pawel [aut], Jorge Tendeiro [aut] | 
| Maintainer: | Tsz Keung Wong <t.k.wong3004@gmail.com> | 
| Repository: | CRAN | 
| Date/Publication: | 2025-10-29 20:10:17 UTC | 
Bayes factor for a Bayesian one-proportion test
Description
Calculate the Bayes factor (BF10) for a test of a single proportion, either against a point null or an interval null hypothesis.
Usage
BF10.bin.test(x, n, alpha, beta, location, scale, model, hypothesis, e = NULL)
Arguments
x | 
 Observed number of successes.  | 
n | 
 Sample size.  | 
alpha | 
 Parameter for the analysis beta prior under the alternative hypothesis.  | 
beta | 
 Parameter for the analysis beta prior under the alternative hypothesis.  | 
location | 
 Null proportion value.  | 
scale | 
 Scale parameter for the analysis prior (if applicable, e.g., for Moment prior).  | 
model | 
 Statistical model of the analysis prior under the alternative hypothesis: beta prior (  | 
hypothesis | 
 The hypothesis being tested: two-sided (  | 
e | 
 Optional numeric vector specifying bounds for an interval null; used if interval BF is calculated.  | 
Value
The Bayes factor (BF10) for the one-proportion test.
Examples
BF10.bin.test(
  x = 12,
  n = 50,
  alpha = 2,
  beta = 3,
  location = 0.5,
  scale = 1,
  model = "beta",
  hypothesis = "!="
)
Bayes factor for a Bayesian correlation test
Description
Calculate the Bayes factor (BF10) for a correlation, either against a point null or an interval null hypothesis.
Usage
BF10.cor(
  r,
  n,
  k,
  alpha,
  beta,
  h0,
  hypothesis,
  location,
  scale,
  dff,
  model,
  e = NULL
)
Arguments
r | 
 Observed correlation coefficient.  | 
n | 
 Sample size.  | 
k | 
 Parameter for the analysis default beta prior under the alternative hypothesis.  | 
alpha | 
 Parameter for the analysis beta prior under the alternative hypothesis.  | 
beta | 
 Parameter for the analysis beta prior under the alternative hypothesis.  | 
h0 | 
 Null value of the correlation.  | 
hypothesis | 
 The hypothesis being tested: two-sided (  | 
location | 
 Location parameter for the analysis prior under the alternative hypothesis.  | 
scale | 
 Scale parameter for the analysis normal moment prior under the alternative hypothesis.  | 
dff | 
 Degrees of freedom for the analysis prior under the alternative hypothesis (if applicable).  | 
model | 
 Statistical model of the analysis prior under the alternative hypothesis: default beta (  | 
e | 
 Optional numeric vector specifying bounds for an interval null; used if interval BF is calculated.  | 
Value
The Bayes factor (BF10) for the correlation test.
Examples
BF10.cor(
  r = 0.3,
  n = 50,
  k = 1,
  alpha = 0.05,
  beta = 0.2,
  h0 = 0,
  hypothesis = "!=",
  location = 0,
  scale = 1,
  dff = 49,
  model = "d_beta"
)
Bayes factor for a Bayesian F-test
Description
Calculate the Bayes factor (BF10) for an F-test, either against a point null or an interval null hypothesis.
Usage
BF10.f.test(fval, df1, df2, dff, rscale, f_m, model, e = NULL)
Arguments
fval | 
 Observed F-value from the F-test.  | 
df1 | 
 Degrees of freedom for the numerator of the F-test.  | 
df2 | 
 Degrees of freedom for the denominator of the F-test.  | 
dff | 
 Degrees of freedom for the analysis prior under the alternative hypothesis (if applicable).  | 
rscale | 
 Scaling parameter for the analysis effect size prior.  | 
f_m | 
 Cohen's f effect size parameter for the analysis prior.  | 
model | 
 Statistical model of the analysis prior under the alternative hypothesis: effect size prior (  | 
e | 
 Optional numeric vector specifying bounds for an interval null; used if interval BF is calculated.  | 
Value
The Bayes factor (BF10) for the F-test.
Examples
BF10.f.test(
  fval = 4.5,
  df1 = 2,
  df2 = 12,
  dff = 12,
  rscale = 0.707,
  f_m = .1,
  model = "effectsize"
)
Bayes factor for a Bayesian test of two proportions
Description
Calculate the Bayes factor (BF10) for comparing two proportions using a Bayesian framework.
Usage
BF10.props(a0, b0, a1, b1, a2, b2, n1, n2, x1, x2)
Arguments
a0 | 
 Alpha parameter of the beta distribution under the null hypothesis.  | 
b0 | 
 Beta parameter of the beta distribution under the null hypothesis.  | 
a1 | 
 Alpha parameter of the analysis beta prior distribution for group 1 under the alternative hypothesis.  | 
b1 | 
 Beta parameter of the analysis beta prior distribution for group 1 under the alternative hypothesis.  | 
a2 | 
 Alpha parameter of the analysis beta prior distribution for group 2 under the alternative hypothesis.  | 
b2 | 
 Beta parameter of the analysis beta prior distribution for group 2 under the alternative hypothesis.  | 
n1 | 
 Sample size for group 1.  | 
n2 | 
 Sample size for group 2.  | 
x1 | 
 Observed number of successes for group 1.  | 
x2 | 
 Observed number of successes for group 2.  | 
Value
The Bayes factor (BF10) for comparing two proportions.
Examples
BF10.props(
  a0 = 2, b0 = 3,
  a1 = 2, b1 = 3,
  a2 = 2, b2 = 3,
  n1 = 50, n2 = 60,
  x1 = 25, x2 = 30
)
Bayes factor for one-sample Bayesian t-test
Description
Calculate the Bayes factor (BF10) for a one-sample Bayesian t-test, either against a point null or an interval null hypothesis.
Usage
BF10.t.test.one_sample(
  tval,
  df,
  model,
  location,
  scale,
  dff,
  hypothesis,
  e = NULL
)
Arguments
tval | 
 Observed t-value from the one-sample t-test.  | 
df | 
 Degrees of freedom for the t-test.  | 
model | 
 Statistical model of the analysis prior under the alternative hypothesis: Normal distribution (  | 
location | 
 Location parameter for the analysis prior under the alternative hypothesis.  | 
scale | 
 Scale parameter for the analysis prior under the alternative hypothesis.  | 
dff | 
 Degrees of freedom for the analysis prior under the alternative hypothesis (if applicable).  | 
hypothesis | 
 The hypothesis being tested: two-sided (  | 
e | 
 Optional numeric vector specifying bounds for an interval null; used if interval BF is calculated.  | 
Value
The Bayes factor (BF10) for the one-sample t-test.
Examples
BF10.t.test.one_sample(
  tval = 2.31,
  df = 29,
  model = "t-distribution",
  location = 0,
  scale = 0.707,
  dff = 1,
  hypothesis = "!="
)
Bayes factor for two-sample Bayesian t-test
Description
Calculate the Bayes factor (BF10) for a two-sample Bayesian t-test, either against a point null or an interval null hypothesis.
Usage
BF10.t.test.two_sample(
  tval,
  N1,
  N2,
  model,
  location,
  scale,
  dff,
  hypothesis,
  e = NULL
)
Arguments
tval | 
 Observed t-value from the two-sample t-test.  | 
N1 | 
 Sample size of group 1.  | 
N2 | 
 Sample size of group 2.  | 
model | 
 Statistical model of the analysis prior under the alternative hypothesis: Normal distribution (  | 
location | 
 Location parameter for the analysis prior under the alternative hypothesis.  | 
scale | 
 Scale parameter for the analysis prior under the alternative hypothesis.  | 
dff | 
 Degrees of freedom for the analysis prior under the alternative hypothesis (if applicable).  | 
hypothesis | 
 The hypothesis being tested: two-sided (  | 
e | 
 Optional numeric vector specifying bounds for an interval null; used if interval BF is calculated.  | 
Value
The Bayes factor (BF10) for the two-sample t-test.
Examples
BF10.t.test.two_sample(
  tval = 2.1,
  N1 = 30,
  N2 = 30,
  model = "t-distribution",
  location = 0,
  scale = 0.707,
  dff = 1,
  hypothesis = "!="
)
Sample size determination for Bayesian one-proportion test
Description
Perform sample size determination or the calculation of compelling and misleading evidence for a Bayesian test of a single proportion.
Usage
BFpower.bin(
  hypothesis = NULL,
  interval = NULL,
  D = NULL,
  target = NULL,
  FP = NULL,
  location = NULL,
  model = NULL,
  alpha = NULL,
  beta = NULL,
  scale = NULL,
  model_d = NULL,
  alpha_d = NULL,
  beta_d = NULL,
  location_d = NULL,
  scale_d = NULL,
  de_an_prior = NULL,
  N = NULL,
  mode_bf = NULL,
  e = NULL,
  direct = NULL,
  h0 = NULL
)
Arguments
hypothesis | 
 The hypothesis being tested (e.g., two-sided   | 
interval | 
 Character or integer (0 or 1). If   | 
D | 
 The bound of compelling evidence.  | 
target | 
 The targeted true positive rate (if   | 
FP | 
 The targeted false positive rate (if   | 
location | 
 Null proportion value.  | 
model | 
 Statistical model of the analysis prior under the alternative hypothesis: beta prior  (  | 
alpha | 
 Parameter for the analysis prior under the alternative hypothesis.  | 
beta | 
 Parameter for the analysis prior under the alternative hypothesis.  | 
scale | 
 Scale parameter for the analysis prior under the alternative hypothesis.  | 
model_d | 
 Statistical model of the design prior under the alternative hypothesis:beta prior  (  | 
alpha_d | 
 Parameter for the design prior under the alternative hypothesis.  | 
beta_d | 
 Parameter for the design prior under the alternative hypothesis.  | 
location_d | 
 The proportion value for the design point prior.  | 
scale_d | 
 Scale parameter for the design prior under the alternative hypothesis.  | 
de_an_prior | 
 Integer (0 or 1). If 1, analysis and design priors under the alternative are the same; if 0, they are not.  | 
N | 
 Sample size.  | 
mode_bf | 
 Integer (0 or 1). If   | 
e | 
 The bounds for the interval Bayes factor (used when   | 
direct | 
 If   | 
h0 | 
 Null value  | 
Value
A data frame with the following columns:
-  
p(BF10 > D | H1): Probability of obtaining compelling evidence in favor of the alternative hypothesis when the alternative is true. -  
p(BF01 > D | H1): Probability of obtaining misleading evidence in favor of the null hypothesis when the alternative is true. -  
p(BF01 > D | H0): Probability of obtaining compelling evidence in favor of the null hypothesis when the null is true. -  
p(BF10 > D | H0): Probability of obtaining misleading evidence in favor of the alternative hypothesis when the null is true. -  
Required N: The required sample size or the sample size input by the users. 
If sample size determination fails, the function returns NULL.
Examples
BFpower.bin(
  hypothesis = "!=",
  interval = "1",
  D = 3,
  target = 0.8,
  FP = 0.05,
  location = 0.5,
  model = "beta",
  alpha = 1,
  beta = 1,
  de_an_prior = 1,
  mode_bf = 1,
  direct = "h1"
)
Sample size determination for Bayesian correlation test
Description
Perform sample size determination or the calculation of compelling and misleading evidence for a Bayesian correlation test.
Usage
BFpower.cor(
  hypothesis = NULL,
  h0 = NULL,
  e = NULL,
  interval = NULL,
  D = NULL,
  target = NULL,
  FP = NULL,
  model = NULL,
  k = NULL,
  alpha = NULL,
  beta = NULL,
  scale = NULL,
  model_d = NULL,
  alpha_d = NULL,
  beta_d = NULL,
  location_d = NULL,
  k_d = NULL,
  scale_d = NULL,
  de_an_prior = NULL,
  N = NULL,
  mode_bf = NULL,
  direct = NULL
)
Arguments
hypothesis | 
 The hypothesis being tested (e.g., two-sided   | 
h0 | 
 Null value of the correlation.  | 
e | 
 The bounds for the interval Bayes factor (used when   | 
interval | 
 Character or integer (0 or 1). If   | 
D | 
 The bound of compelling evidence.  | 
target | 
 The targeted true positive rate (if   | 
FP | 
 The targeted false positive rate (if   | 
model | 
 Statistical model of the analysis prior under the alternative hypothesis: default beta (  | 
k | 
 Parameter for the analysis default beta prior under the alternative hypothesis.  | 
alpha | 
 Parameter for the analysis beta prior under the alternative hypothesis.  | 
beta | 
 Parameter for the analysis beta prior under the alternative hypothesis.  | 
scale | 
 Scale parameter for the analysis normal moment prior under the alternative hypothesis.  | 
model_d | 
 Statistical model of the design prior under the alternative hypothesis:default beta (  | 
alpha_d | 
 Parameter for the design beta prior under the alternative hypothesis.  | 
beta_d | 
 Parameter for the design beta prior under the alternative hypothesis.  | 
location_d | 
 Location parameter for the design point prior under the alternative hypothesis.  | 
k_d | 
 Parameter for the design default beta prior under the alternative hypothesis.  | 
scale_d | 
 Scale parameter for the design normal moment prior under the alternative hypothesis.  | 
de_an_prior | 
 Integer (0 or 1). If 1, analysis and design priors under the alternative are the same; if 0, they are not.  | 
N | 
 Sample size.  | 
mode_bf | 
 Integer (0 or 1). If   | 
direct | 
 If   | 
Value
A data frame with the following columns:
-  
p(BF10 > D | H1): Probability of obtaining compelling evidence in favor of the alternative hypothesis when the alternative is true. -  
p(BF01 > D | H1): Probability of obtaining misleading evidence in favor of the null hypothesis when the alternative is true. -  
p(BF01 > D | H0): Probability of obtaining compelling evidence in favor of the null hypothesis when the null is true. -  
p(BF10 > D | H0): Probability of obtaining misleading evidence in favor of the alternative hypothesis when the null is true. -  
Required N: The required sample size or the sample size input by the users. 
If sample size determination fails, the function returns NULL.
Examples
BFpower.cor(
  hypothesis = "!=",
  h0 = 0,
  e = NULL,
  interval = "1",
  D = 3,
  target = 0.8,
  FP = 0.05,
  model = "d_beta",
  k = 1,
  de_an_prior = 1,
  mode_bf = 1,
  direct = "h1"
)
Sample size determination for Bayesian F-test
Description
Perform sample size determination or the calculation of compelling and misleading evidence for a Bayesian F-test.
Usage
BFpower.f(
  interval = NULL,
  D = NULL,
  target = NULL,
  FP = NULL,
  p = NULL,
  k = NULL,
  model = NULL,
  dff = NULL,
  rscale = NULL,
  f_m = NULL,
  model_d = NULL,
  dff_d = NULL,
  rscale_d = NULL,
  f_m_d = NULL,
  de_an_prior = NULL,
  N = NULL,
  mode_bf = NULL,
  direct = NULL,
  e = NULL
)
Arguments
interval | 
 Character or integer (0 or 1). If   | 
D | 
 The bound of compelling evidence.  | 
target | 
 The targeted true positive rate (if   | 
FP | 
 The targeted false positive rate (if   | 
p | 
 Number of predictors in the reduced model.  | 
k | 
 Number of predictors in the full model.  | 
model | 
 Statistical model of the analysis prior under the alternative hypothesis: effect size prior  (  | 
dff | 
 Degrees of freedom for the analysis prior under the alternative hypothesis.(must be >3 if moment prior is used)  | 
rscale | 
 Scaling parameter for the analysis effect size prior.  | 
f_m | 
 Cohen's f effect size parameter for the analysis prior.  | 
model_d | 
 Statistical model of the design prior under the alternative hypothesis:: effect size prior  (  | 
dff_d | 
 Degrees of freedom for the design prior under the alternative hypothesis. (must be >3 if moment prior is used)  | 
rscale_d | 
 Scaling parameter for the design effect size prior.  | 
f_m_d | 
 Cohen's f effect size parameter for the design prior or the point design prior.  | 
de_an_prior | 
 Integer (0 or 1). If 1, analysis and design priors under the alternative are the same; if 0, they are not.  | 
N | 
 Sample size.  | 
mode_bf | 
 Integer (0 or 1). If   | 
direct | 
 If   | 
e | 
 The bounds for the interval Bayes factor (used when   | 
Value
A data frame with the following columns:
-  
p(BF10 > D | H1): Probability of obtaining compelling evidence in favor of the alternative hypothesis when the alternative is true. -  
p(BF01 > D | H1): Probability of obtaining misleading evidence in favor of the null hypothesis when the alternative is true. -  
p(BF01 > D | H0): Probability of obtaining compelling evidence in favor of the null hypothesis when the null is true. -  
p(BF10 > D | H0): Probability of obtaining misleading evidence in favor of the alternative hypothesis when the null is true. -  
Required N: The required sample size or the sample size input by the users. 
If sample size determination fails, the function returns NULL.
Examples
BFpower.f(
 inter = "1",
 D = 3,
 target = 0.8,
 p = 1,
 k = 2,
 model = "Moment",
 dff = 1,
 f_m = 0.1,
 de_an_prior = 1,
 mode_bf = 1,
 direct = "h1"
)
Sample size determination for Bayesian test of two proportions
Description
Perform sample size determination or the calculation of compelling and misleading evidence for a Bayesian comparison of two proportions.
Usage
BFpower.props(
  D = NULL,
  target = NULL,
  a0 = NULL,
  b0 = NULL,
  a1 = NULL,
  b1 = NULL,
  a2 = NULL,
  b2 = NULL,
  model1 = NULL,
  a1d = NULL,
  b1d = NULL,
  dp1 = NULL,
  model2 = NULL,
  a2d = NULL,
  b2d = NULL,
  dp2 = NULL,
  mode_bf = NULL,
  n1 = NULL,
  n2 = NULL,
  direct = NULL
)
Arguments
D | 
 The bound of compelling evidence.  | 
target | 
 The targeted true positive rate (if   | 
a0 | 
 Alpha parameter of the beta distribution under the null .  | 
b0 | 
 Beta parameter of the beta distribution under the null.  | 
a1 | 
 Alpha parameter of the analysis beta prior distribution for group 1 under the alternative hypothesis.  | 
b1 | 
 Beta parameter of the analysis beta prior distribution for group 1 under the alternative hypothesis.  | 
a2 | 
 Alpha parameter of the analysis beta prior distribution for group 2 under the alternative hypothesis.  | 
b2 | 
 Beta parameter of the analysis beta prior distribution for group 2 under the alternative hypothesis.  | 
model1 | 
 Statistical model of the design prior for group 1: beta (  | 
a1d | 
 Alpha parameter for the design prior of group 1.  | 
b1d | 
 Beta parameter for the design prior of group 1.  | 
dp1 | 
 True proportion for group 1 in the design prior.  | 
model2 | 
 Statistical model of the design prior for group 1: beta (  | 
a2d | 
 Alpha parameter for the design prior of group 2.  | 
b2d | 
 Beta parameter for the design prior of group 2.  | 
dp2 | 
 True proportion for group 2 in the design prior.  | 
mode_bf | 
 Integer (0 or 1). If   | 
n1 | 
 Sample size for group 1.  | 
n2 | 
 Sample size for group 2.  | 
direct | 
 If   | 
Value
A data frame with the following columns:
-  
p(BF10 > D | H1): Probability of obtaining compelling evidence in favor of the alternative hypothesis when the alternative is true. -  
p(BF01 > D | H1): Probability of obtaining misleading evidence in favor of the null hypothesis when the alternative is true. -  
p(BF01 > D | H0): Probability of obtaining compelling evidence in favor of the null hypothesis when the null is true. -  
p(BF10 > D | H0): Probability of obtaining misleading evidence in favor of the alternative hypothesis when the null is true. -  
Required N1: The required sample size for group 1 or the sample size input by the user. -  
Required N2: The required sample size for group 1 or the sample size input by the user. 
If sample size determination fails, the function returns NULL.
Examples
BFpower.props(
  D = 3,
  target = 0.8,
  a0 = 1,
  b0 = 1,
  model1 = "same",
  a1 = 1,
  b1 = 1,
  a2 = 1,
  b2 = 1,
  model2 = "same",
  mode_bf = 1,
  direct = "h1"
)
Sample size determination for one-sample Bayesian t-test
Description
Perform sample size determination or the calculation of compelling and misleading evidence.
Usage
BFpower.t.test_one_sample(
  hypothesis = NULL,
  e = NULL,
  interval = NULL,
  D = NULL,
  target = NULL,
  alpha = NULL,
  model = NULL,
  location = NULL,
  scale = NULL,
  dff = NULL,
  model_d = NULL,
  location_d = NULL,
  scale_d = NULL,
  dff_d = NULL,
  de_an_prior = NULL,
  N = NULL,
  mode_bf = NULL,
  direct = NULL
)
Arguments
hypothesis | 
 The hypothesis being tested (e.g., two-sided   | 
e | 
 The bounds for the interval Bayes factor (used when   | 
interval | 
 Integer (1 or 0). If   | 
D | 
 The bound of compelling evidence.  | 
target | 
 The targeted true positive rate (if   | 
alpha | 
 The targeted false positive rate (if   | 
model | 
 Statistical model of the analysis prior under the alternative hypothesis: Normal distribution (  | 
location | 
 Location parameter for the analysis prior under the alternative hypothesis.  | 
scale | 
 Scale parameter for the analysis prior under the alternative hypothesis.  | 
dff | 
 Degrees of freedom for the analysis prior under the alternative hypothesis (if applicable).  | 
model_d | 
 Statistical model of the design prior under the alternative hypothesis: Normal distribution (  | 
location_d | 
 Location parameter for the design prior under the alternative hypothesis.  | 
scale_d | 
 Scale parameter for the design prior under the alternative hypothesis.  | 
dff_d | 
 Degrees of freedom parameter for the design prior under the alternative hypothesis.  | 
de_an_prior | 
 Integer (0 or 1). If 1, analysis and design priors under the alternative are the same; if 0, they are not.  | 
N | 
 Sample size.  | 
mode_bf | 
 Integer (1 or 2). If   | 
direct | 
 If   | 
Value
A data frame with the following columns:
-  
p(BF10 > D | H1): Probability of obtaining compelling evidence in favor of the alternative hypothesis when the alternative is true. -  
p(BF01 > D | H1): Probability of obtaining misleading evidence in favor of the null hypothesis when the alternative is true. -  
p(BF01 > D | H0): Probability of obtaining compelling evidence in favor of the null hypothesis when the null is true. -  
p(BF10 > D | H0): Probability of obtaining misleading evidence in favor of the alternative hypothesis when the null is true. -  
Required N: The required sample size or the sample size input by the users. 
If sample size determination fails, the function returns NULL.
Examples
BFpower.t.test_one_sample(
  hypothesis = "!=",
  interval = 1,
  D = 3,
  target = 0.8,
  alpha = 0.05,
  model = "t-distribution",
  location = 0,
  scale = 0.707,
  dff = 1,
  de_an_prior = 1,
  N = NULL,
  mode_bf = 1,
  direct = "h1"
)
Sample size determination for two-sample Bayesian t-test
Description
Perform sample size determination or the calculation of compelling and misleading evidence for a two-sample Bayesian t-test.
Usage
BFpower.t.test_two_sample(
  hypothesis = NULL,
  e = NULL,
  interval = NULL,
  D = NULL,
  target = NULL,
  alpha = NULL,
  model = NULL,
  location = NULL,
  scale = NULL,
  dff = NULL,
  model_d = NULL,
  location_d = NULL,
  scale_d = NULL,
  dff_d = NULL,
  de_an_prior = NULL,
  N1 = NULL,
  N2 = NULL,
  r = NULL,
  mode_bf = NULL,
  direct = NULL
)
Arguments
hypothesis | 
 The hypothesis being tested (e.g., two-sided   | 
e | 
 The bounds for the interval Bayes factor (used when   | 
interval | 
 Integer (1 or 0). If   | 
D | 
 The bound of compelling evidence.  | 
target | 
 The targeted true positive rate (if   | 
alpha | 
 The targeted false positive rate (if   | 
model | 
 Statistical model of the analysis prior under the alternative hypothesis: Normal distribution (  | 
location | 
 Location parameter for the analysis prior under the alternative hypothesis.  | 
scale | 
 Scale parameter for the analysis prior under the alternative hypothesis.  | 
dff | 
 Degrees of freedom for the analysis prior under the alternative hypothesis (if applicable).  | 
model_d | 
 Statistical model of the design prior under the alternative hypothesis: Normal distribution (  | 
location_d | 
 Location parameter for the design prior under the alternative hypothesis.  | 
scale_d | 
 Scale parameter for the design prior under the alternative hypothesis.  | 
dff_d | 
 Degrees of freedom parameter for the design prior under the alternative hypothesis.  | 
de_an_prior | 
 Integer (0 or 1). If 1, analysis and design priors under the alternative are the same; if 0, they are not.  | 
N1 | 
 Sample size of group 1.  | 
N2 | 
 Sample size of group 2.  | 
r | 
 Ratio of the sample size of group 2 over group 1 (  | 
mode_bf | 
 Integer (1 or 0). If   | 
direct | 
 If   | 
Value
A data frame with the following columns:
-  
p(BF10 > D | H1): Probability of obtaining compelling evidence in favor of the alternative hypothesis when the alternative is true. -  
p(BF01 > D | H1): Probability of obtaining misleading evidence in favor of the null hypothesis when the alternative is true. -  
p(BF01 > D | H0): Probability of obtaining compelling evidence in favor of the null hypothesis when the null is true. -  
p(BF10 > D | H0): Probability of obtaining misleading evidence in favor of the alternative hypothesis when the null is true. -  
Required N1: The required sample size for group 1 or the sample size input by the user. -  
Required N2: The required sample size for group 1 or the sample size input by the user. 
If sample size determination fails, the function returns NULL.
Examples
BFpower.t.test_two_sample(
  hypothesis = "!=",
  e = NULL,
  interval = 1,
  D = 3,
  target = 0.8,
  alpha = 0.05,
  model = "t-distribution",
  location = 0,
  scale = 0.707,
  dff = 1,
  de_an_prior = 1,
  r = 1,
  mode_bf = 1,
  direct = "h1"
)
Launch the BayesPower Shiny Application
Description
This function starts the interactive Shiny application for Bayesian power analysis using Bayes factors. The app provides a graphical user interface built with shiny.
Usage
BayesPower_BayesFactor()
Details
The application includes both the UI and server components, which are defined internally in the package. When run, a browser window or RStudio viewer pane will open to display the interface.
Value
No return value, called for its side effects.
Examples
if (interactive()) {
  # Launch the Shiny application
  BayesPower_BayesFactor()
}