Learn R Programming

BayesPower (version 1.0.1)

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

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

hypothesis

The hypothesis being tested (e.g., two-sided "!=", right-sided ">", left-sided "<").

e

The bounds for the interval Bayes factor (used when interval = 0).

interval

Integer (1 or 0). If 1, Bayes factor with a point null against a composite alternative hypothesis; otherwise Bayes factor with interval null and alternative hypotheses.

D

The bound of compelling evidence.

target

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

alpha

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

model

Statistical model of the analysis prior under the alternative hypothesis: Normal distribution ("Normal"), Normal moment ("NLP"), or scaled t ("t-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 ("Normal"), Normal moment ("NLP"), or scaled t ("t-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 (N2 / N1).

mode_bf

Integer (1 or 0). If 1, sample size determination; if 0, N1 and N2 are used for the calculation of probabilities of compelling and misleading evidence.

direct

If "h1", controls true/false positive rates (BF10); if "h0", controls true/false negative rates (BF01).

Examples

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

Run the code above in your browser using DataLab