Package 'BlythStillCasellaCI'

Title: Blyth-Still-Casella Exact Binomial Confidence Intervals
Description: Computes Blyth-Still-Casella exact binomial confidence intervals based on a refining procedure proposed by George Casella (1986) <doi:10.2307/3314658>.
Authors: Ron Yu [aut, cre], Peiwen Wu [aut]
Maintainer: Ron Yu <[email protected]>
License: GPL-3
Version: 1.1.0
Built: 2024-12-19 06:39:57 UTC
Source: CRAN

Help Index


Blyth-Still-Casella Exact Binomial Confidence Intervals

Description

blyth.still.casella() computes Blyth-Still-Casella exact binomial confidence intervals based on a refining procedure proposed by George Casella (1986).

Usage

blyth.still.casella(
  n,
  X = NULL,
  alpha = 0.05,
  digits = 2,
  CIs.init = NULL,
  additional.info = FALSE
)

Arguments

n

number of trials

X

number of successes (optional)

alpha

confidence level = 1 - alpha

digits

number of significant digits after the decimal point

CIs.init

initial confidence intervals from which the refinement procedure begins (default starts from Clopper-Pearson confidence intervals)

additional.info

additional information about the types of interval endpoints and their possible range is provided if TRUE (default = FALSE)

Value

If X is specified, the corresponding confidence interval will be returned, otherwise a list of n + 1 confidence intervals will be returned.

If additional.info = FALSE, only a list of confidence interval(s) will be returned. For any conincidental endpoint, midpoint of its range will be displayed.

If additional.info = TRUE, the following lists will be returned:

ConfidenceInterval a list of confidence intervals
CoincidenceEndpoint indices of coincidental lower endpoints (L.Index) and their corresponding upper endpoints (U.index)
Range range for each endpoint

Examples

# to obtain 95% CIs for n = 30 and X = 0 to 30
blyth.still.casella(n = 30, alpha = 0.05, digits = 4)

# to obtain 90% CIs, endpoint types, indices of coincidental endpoints (if any),
# and range of each endpoint for n = 30 and X = 23
blyth.still.casella(n = 30, X = 23, alpha = 0.05, digits = 4, additional.info = TRUE)

# use initial confidence intervals defined by the user instead of Clopper-Pearson CIs
# CIs.input needs to be a (n + 1) x 2 matrix with sufficient coverage
CIs.input <- matrix(c(0,1), nrow = 11, ncol = 2, byrow = TRUE) # start with [0,1] intervals
blyth.still.casella(n = 10, alpha = 0.05, digits = 4, CIs.init = CIs.input, additional.info = TRUE)