bayes_sim_betabin {bayesassurance}R Documentation

Bayesian Assurance Computation in the Beta-Binomial Setting

Description

Returns the Bayesian assurance corresponding to a hypothesis test for difference in two independent proportions.

Usage

bayes_sim_betabin(
  n1,
  n2,
  p1,
  p2,
  alpha_1,
  alpha_2,
  beta_1,
  beta_2,
  sig_level,
  alt,
  mc_iter
)

Arguments

n1

sample size of first group

n2

sample size of second group

p1

proportion of successes in first group. Takes on a NULL (default) assignment if unknown.

p2

proportion of successes in second group. Takes on a NULL (default) assignment if unknown.

alpha_1, beta_1

shape parameters for the distribution of p1 if p1 is unknown: p1 ~ Beta(\alpha_1, \beta_1)

alpha_2, beta_2

shape parameters for the distribution of p2 if p2 is unknown: p2 ~ Beta(\alpha_2, \beta_2)

sig_level

significance level

alt

a character string specifying the alternative hypothesis, must select one of following choices: "two.sided" (default), "greater" or "less".

mc_iter

number of MC samples evaluated under the analysis objective

Value

approximate Bayesian assurance of independent two-sample proportion test

Examples


#########################################################
# alpha1 = 0.5, beta1 = 0.5, alpha2 = 0.5, beta2 = 0.5 ##
#########################################################
n <- seq(200, 1000, 10)
assur_vals <- bayesassurance::bayes_sim_betabin(n1 = n, n2 = n, 
p1 = 0.25, p2 = 0.2, alpha_1 = 0.5, beta_1 = 0.5, alpha_2 = 0.5, 
beta_2 = 0.5, sig_level = 0.05, alt = "greater", mc_iter = 1000)

assur_vals$assurance_table
assur_vals$assurance_plot


[Package bayesassurance version 0.1.0 Index]