[R] proportions - finite population correction

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Thu Jun 15 13:48:58 CEST 2000

```RINNER Heinrich <H.RINNER at TIROL.GV.AT> writes:

> > Dear R-users!
> >
> > I am using R 1.0.0 and Windows NT 4.0.
> >
> Suppose I have a population of N=100 subjects, a binomial variable and a
> random sample of n=20 subjects from my population, giving 15 "successes". I
> am interested in obtaining a confidence interval for the proportion of
> "successes" in my population.
>
> In R, I can use
> > library(ctest)
> > binom.test(15, 20)
> to get an exact confidence interval, but under the assumption of an infinite
> population.
>
> Now I could modify binom.test so that a finite population correction is
> applied (the formulae are right here in the book before me); but maybe
> somebody has already done this, or maybe there are other (R-)functions that

I don't think we have a test as such, but the stubs must be in phyper:

uniroot(function(x)phyper(15,x,100-x,20)-0.025,,0,100)\$root
uniroot(function(x)phyper(14,x,100-x,20)-0.975,,0,100)\$root

should be about right I think.

--
O__  ---- Peter Dalgaard             Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics     2200 Cph. N
(*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

```