[R] Retrieve hypergeometric results in large scale

Jeff Newmiller jdnewmil at dcn.davis.ca.us
Mon Oct 1 17:10:25 CEST 2012


Perhaps you should read

?dhyper

and if you have a hard time parsing that, then read

?Distributions

and then go back to

?dhyper
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.

jas4710 <watashi at post.com> wrote:

>
>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.
>
>______________________________________________
>R-help at r-project.org mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list