statsmodels.stats.proportion.multinomial_proportions_confint¶
-
statsmodels.stats.proportion.multinomial_proportions_confint(counts, alpha=
0.05, method='goodman')[source]¶ Confidence intervals for multinomial proportions.
- Parameters:¶
- Returns:¶
confint – Array of [lower, upper] confidence levels for each category, such that overall coverage is (approximately) 1-alpha.
- Return type:¶
ndarray, 2-D
- Raises:¶
ValueError – If alpha is not in (0, 1) (bounds excluded), or if the values in counts are not all positive or null.
NotImplementedError – If method is not kown.
Exception – When
method == 'sison-glaz', if for some reason c cannot be computed; this signals a bug and should be reported.
Notes
The goodman method [2] is based on approximating a statistic based on the multinomial as a chi-squared random variable. The usual recommendation is that this is valid if all the values in counts are greater than or equal to 5. There is no condition on the number of categories for this method.
The sison-glaz method [3] approximates the multinomial probabilities, and evaluates that with a maximum-likelihood estimator. The first approximation is an Edgeworth expansion that converges when the number of categories goes to infinity, and the maximum-likelihood estimator converges when the number of observations (
sum(counts)) goes to infinity. In their paper, Sison & Glaz demo their method with at least 7 categories, solen(counts) >= 7with all values in counts at or above 5 can be used as a rule of thumb for the validity of this method. This method is less conservative than the goodman method (i.e. it will yield confidence intervals closer to the desired significance level), but produces confidence intervals of uniform width over all categories (except when the intervals reach 0 or 1, in which case they are truncated), which makes it most useful when proportions are of similar magnitude.Aside from the original sources ([1], [2], and [3]), the implementation uses the formulas (though not the code) presented in [4] and [5].
References