[R] Retrieve hypergeometric results in large scale

jas4710 watashi at post.com
Mon Oct 1 15:48:15 CEST 2012


I'm going to use 

dhyper(x, m, n, k)

to get a 95% coverage. Let me use an example to explain my problem:

Suppose I have a urn containing 90 red and 10 black balls.
Now I wanna remove 3 from the urn. By the following codes:

m<-90;n<-10;k<-3;
x<-0:3
dhyper(x,m,n,k)

I can obtain the probability that 0,1,2,3 red balls will be removed.
 0.000742115 0.025046382 0.247680891 0.726530612

So >95% time, 2 to 3 red balls will be removed and the resultant composition
will be changed to 
87:10 or 88:9, the original percent of red balls will be changed from 90 to
89.69 to 90.72 then.

If now I have 50:50 and again to remove 3 balls, I will obtain the
probability as:
0.1212 0.3788 0.3788 0.1212

To get the resultant range of red balls for >95% time, this time all the
four cases have to consider and so the resultant change of red balls will
become 48.45 to 51.54

So my problem is, is there any convenient built-in function that helps
extract this 95% confidence interval-like data?






--
View this message in context: http://r.789695.n4.nabble.com/Retrieve-hypergeometric-results-in-large-scale-tp4644683.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list