Learn R Programming

bssbinom (version 1.0.0)

mss.bb: Bayesian sample size for a binomial proportion under a binomial/beta model

Description

Computes the minimum sample size for estimating a binomial proportion under a binomial/beta model using Average Coverage Criterion or Average Length Criterion.

Usage

mss.bb(
  crit,
  c,
  d,
  rho.min = NULL,
  len = NULL,
  rho = NULL,
  len.max = NULL,
  R = 1000,
  n0 = 1
)

Value

An integer representing the minimum sample size.

Arguments

crit

A character string specifying the criterion. Available criteria: "ACC", "ALC" and "ALCApprox".

c

First parameter of the beta prior distribution.

d

Second parameter of the beta prior distribution.

rho.min

A number in (0, 1) representing the minimum admissible posterior probability for the HPD interval in the ACC.

len

A positive real number representing the length of the HPD interval in the ACC.

rho

A number in (0, 1) representing the posterior probability of the HPD in the ALC.

len.max

A positive real number representing the maximum admissible length for the HPD interval in the ALC.

R

Number of replicates used in the simulation. Default is 1000.

n0

A positive integer, n0+1 is the initial sample size in which the function will check the criterion. Default is 1.

References

Costa, E. G. (2025). Bayesian Sample Size for Binomial Proportions with Applications in R. In: Awe, O.O., A. Vance, E. (eds) Practical Statistical Learning and Data Science Methods. STEAM-H: Science, Technology, Engineering, Agriculture, Mathematics & Health. Springer, Cham. tools:::Rd_expr_doi("10.1007/978-3-031-72215-8_14").

M’Lan, C.E., Joseph, L., Wolfson, D.B. (2008). Bayesian sample size determination for binomial proportions. Bayesian Analysis, 3, 269–296.

Examples

Run this code
mss.bb(crit = "ALC", c = 10, d = 2, rho = 0.9, len.max = 0.25)

mss.bb(crit = "ALCApprox", c = 10, d = 2, rho = 0.9, len.max = 0.25)

mss.bb(crit = "ACC", c = 2, d = 10, rho.min = 0.9, len = 0.25)

Run the code above in your browser using DataLab