goodman_cis: Calculate Goodman's multinomial confidence intervals

View source: R/analyzing.R

goodman_cisR Documentation

Calculate Goodman's multinomial confidence intervals

Description

Calculate confidence intervals for multinomial proportions using the method described by Leo Goodman in "On Simultaneous Confidence Intervals for Multinomial Proportions" in Technometrics in 1965. This function can only handle one group of categorical counts at a time, so if you want to calculate confidence intervals for multiple groups, you need to do each separately.

Usage

goodman_cis(counts, alpha = 0.2, chisq = "best", verbose = FALSE)

Arguments

counts

Numeric vector, optionally named. The counts for each of the categories being considered. If there are unequal weights, be sure to adjust these counts by proportional weight with the formula: adjusted count for a category = total observations * sum of weights of observations in the category / sum of all weights. If these values are named, those will be included in the output data frame.

alpha

Numeric value. Must be between 0 and 1. The alpha for the confidence calculation, e.g. for 80 percent confidence, the alpha is 0.2. Defaults to 0.2.

chisq

Character string. This decides which chi squared quantile calculation to use. The accepted values are "A", "B", or "best" (use the one which minimizes the confidence intervals). Goodman describes A as his default, calculated as the upper alpha times 100th percentage point of the chi-square distribution with k - 1 degrees of freedom. He also notes the alternative B, calculated as the upper alpha / k times 100th percentage point of the chi-square distribution with one degree of freedom, which will produce tighter intervals when k > 2 and alpha is 0.1, 0.5, or 0.01. Defaults to "best"

verbose

Logical. If TRUE then the function will generate additional messages as it executes. Defaults to FALSE.


nstauffer/aim.analysis documentation built on Nov. 2, 2023, 12:52 a.m.