Learn R Programming

BayesPower (version 1.0.1)

BFpower.props: 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
)

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.

Arguments

D

The bound of compelling evidence.

target

The targeted true positive rate (if direct = "h1") or true negative rate (if direct = "h0").

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 ("beta"), Point prior ("Point", or same as analysis prior "same")

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 ("beta"), or Point prior ("Point", or same as analysis prior "same")

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 1, sample size determination; if 2, n1 and n2 are used for the calculation of probabilities of compelling and misleading evidence.

n1

Sample size for group 1.

n2

Sample size for group 2.

direct

If "h1", BF10; if "h0", BF01.

Examples

Run this code
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"
)

Run the code above in your browser using DataLab