MultinomCI.Rd
Confidence intervals for multinomial proportions are often approximated by single binomial confidence intervals, which might in practice often yield satisfying results, but is properly speaking not correct. This function calculates simultaneous confidence intervals for multinomial proportions either according to the methods of Sison and Glaz, Goodman, Wald, Wald with continuity correction or Wilson.
A vector of positive integers representing the number of occurrences of each class. The total number of samples equals the sum of such elements.
confidence level, defaults to 0.95.
a character string specifying the side of the confidence interval, must be one of "two.sided"
(default),
"left"
or "right"
. You can specify just the initial letter. "left"
would be analogue to a hypothesis of
"greater"
in a t.test
.
character string specifing which method to use; can be one out of
"sisonglaz"
, "cplus1"
, "goodman"
, "wald"
, "waldcc"
, "wilson"
,
"qh"
, "fs"
.
Method can be abbreviated. See details. Defaults to "sisonglaz"
.
Given a vector of observations with the number of samples falling in each class of a multinomial distribution,
builds the simultaneous confidence intervals for the multinomial probabilities according to the method proposed by the mentioned authors.
The R code for Sison and Glaz (1995) has been translated from thes SAS code written by May and Johnson (2000). See the references for the other methods (qh = Quesensberry-Hurst, fs = Fitzpatrick-Scott).
Some approaches for the confidence intervals can potentially yield negative results or values beyond 1. These would be reset such as not to exceed the range of [0, 1].
A matrix with 3 columns:
estimate
lower bound of the confidence interval
upper bound of the confidence interval
The number of rows correspond to the dimension of x.
Fitzpatrick, S. and Scott, A. (1987). Quick simultaneous confidence interval for multinomial proportions. Journal of American Statistical Association 82(399): 875-878.
Glaz, J., Sison, C.P. (1999) Simultaneous confidence intervals for multinomial proportions. Journal of Statistical Planning and Inference 82:251-262.
Goodman, L. A. (1965) On Simultaneous Confidence Intervals for Multinomial Proportions Technometrics, 7, 247-254.
May, W.L., Johnson, W.D.(2000) Constructing two-sided simultaneous confidence intervals for multinomial proportions for small counts in a large number of cells. Journal of Statistical Software 5(6) . Paper and code available at https://www.jstatsoft.org/v05/i06.
Quesensberry, C.P. and Hurst, D.C. (1964). Large Sample Simultaneous Confidence Intervals for Multinational Proportions. Technometrics, 6: 191-195.
Sangeetha, U., Subbiah, M., Srinivasan, M. R. (2013) Mathematical Analysis of propensity of aberration on the methods for interval estimation of the multinomial proportions. IOSR Journal of Mathematics, e-ISSN: 2278-5728,p-ISSN: 2319-765X, Volume 7, Issue 4 (Jul. - Aug. 2013), PP 23-28
Sison, C.P and Glaz, J. (1995) Simultaneous confidence intervals and sample size determination for multinomial proportions. Journal of the American Statistical Association, 90:366-369.
Wald, A. Tests of statistical hypotheses concerning several parameters when the number of observations is large, Trans. Am. Math. Soc. 54 (1943) 426-482.
Wilson, E. B. Probable inference, the law of succession and statistical inference, J.Am. Stat. Assoc. 22 (1927) 209-212.
# Multinomial distribution with 3 classes, from which a sample of 79 elements
# were drawn: 23 of them belong to the first class, 12 to the
# second class and 44 to the third class. Punctual estimations
# of the probabilities from this sample would be 23/79, 12/79
# and 44/79 but we want to build 95% simultaneous confidence intervals
# for the true probabilities
MultinomCI(c(23, 12, 44), conf.level=0.95)
#> est lwr.ci upr.ci
#> [1,] 0.2911392 0.18987342 0.4104183
#> [2,] 0.1518987 0.05063291 0.2711778
#> [3,] 0.5569620 0.45569620 0.6762410
# single sided
MultinomCI(c(23, 12, 44), conf.level=0.95, sides="left")
#> est lwr.ci upr.ci
#> [1,] 0.2911392 0.20253165 1
#> [2,] 0.1518987 0.06329114 1
#> [3,] 0.5569620 0.46835443 1
MultinomCI(c(23, 12, 44), conf.level=0.95, sides="right")
#> est lwr.ci upr.ci
#> [1,] 0.2911392 0 0.3936896
#> [2,] 0.1518987 0 0.2544491
#> [3,] 0.5569620 0 0.6595124
x <- c(35, 74, 22, 69)
MultinomCI(x, method="goodman")
#> est lwr.ci upr.ci
#> [1,] 0.175 0.11801881 0.2516431
#> [2,] 0.370 0.28986972 0.4579951
#> [3,] 0.110 0.06611447 0.1774798
#> [4,] 0.345 0.26687843 0.4324988
MultinomCI(x, method="sisonglaz")
#> est lwr.ci upr.ci
#> [1,] 0.175 0.105 0.2512563
#> [2,] 0.370 0.300 0.4462563
#> [3,] 0.110 0.040 0.1862563
#> [4,] 0.345 0.275 0.4212563
MultinomCI(x, method="cplus1")
#> est lwr.ci upr.ci
#> [1,] 0.175 0.100 0.250
#> [2,] 0.370 0.295 0.445
#> [3,] 0.110 0.035 0.185
#> [4,] 0.345 0.270 0.420
MultinomCI(x, method="wald")
#> est lwr.ci upr.ci
#> [1,] 0.175 0.12234021 0.2276598
#> [2,] 0.370 0.30308797 0.4369120
#> [3,] 0.110 0.06663649 0.1533635
#> [4,] 0.345 0.27911853 0.4108815
MultinomCI(x, method="waldcc")
#> est lwr.ci upr.ci
#> [1,] 0.175 0.11984021 0.2301598
#> [2,] 0.370 0.30058797 0.4394120
#> [3,] 0.110 0.06413649 0.1558635
#> [4,] 0.345 0.27661853 0.4133815
MultinomCI(x, method="wilson")
#> est lwr.ci upr.ci
#> [1,] 0.175 0.12860515 0.2336443
#> [2,] 0.370 0.30612608 0.4387737
#> [3,] 0.110 0.07377244 0.1609269
#> [4,] 0.345 0.28259794 0.4132441
# compare to
BinomCI(x, n=sum(x))
#> est lwr.ci upr.ci
#> x.1 0.175 0.12860515 0.2336443
#> x.2 0.370 0.30612608 0.4387737
#> x.3 0.110 0.07377244 0.1609269
#> x.4 0.345 0.28259794 0.4132441
# example in Goodman (1965)
MultinomCI(x = c(91,49,37,43),conf.level = 0.95,method="goodman")
#> est lwr.ci upr.ci
#> [1,] 0.4136364 0.3342025 0.4978332
#> [2,] 0.2227273 0.1608587 0.2998874
#> [3,] 0.1681818 0.1145513 0.2401121
#> [4,] 0.1954545 0.1374690 0.2702358
# example from Sison, Glaz (1999) in Sangeetha (2013) - Table 2
x <- c(56, 72, 73, 59, 62, 87, 58)
do.call(cbind, lapply(c("wald", "waldcc", "wilson",
"qh", "goodman", "fs", "sisonglaz"),
function(m) round(MultinomCI(x, method=m)[,-1], 3)))
#> lwr.ci upr.ci lwr.ci upr.ci lwr.ci upr.ci lwr.ci upr.ci lwr.ci upr.ci
#> [1,] 0.090 0.149 0.089 0.150 0.094 0.153 0.076 0.183 0.085 0.166
#> [2,] 0.121 0.187 0.120 0.188 0.124 0.190 0.104 0.222 0.115 0.204
#> [3,] 0.123 0.189 0.122 0.190 0.126 0.192 0.106 0.225 0.116 0.207
#> [4,] 0.096 0.156 0.095 0.158 0.099 0.160 0.081 0.191 0.091 0.173
#> [5,] 0.102 0.164 0.101 0.165 0.105 0.167 0.087 0.198 0.096 0.181
#> [6,] 0.151 0.222 0.150 0.223 0.154 0.224 0.131 0.258 0.143 0.239
#> [7,] 0.094 0.154 0.093 0.155 0.097 0.157 0.080 0.188 0.089 0.171
#> lwr.ci upr.ci lwr.ci upr.ci
#> [1,] 0.075 0.165 0.079 0.164
#> [2,] 0.109 0.200 0.113 0.199
#> [3,] 0.111 0.202 0.116 0.201
#> [4,] 0.081 0.172 0.086 0.171
#> [5,] 0.087 0.178 0.092 0.177
#> [6,] 0.141 0.232 0.146 0.231
#> [7,] 0.079 0.170 0.084 0.169