Hello,

See the differences.


k <- 3
p <- 0.95

m <- 90; n <- 10
dhyper(0:k, m, n, k) # Prob(X = x), with x = 0:k
phyper(0:k, m, n, k) # Prob(X <= x)
# quantiles, what you want
qhyper(p, m, n, k)   # inverse of phyper


m <- 50; n <- 50
dhyper(0:k, m, n, k)
phyper(0:k, m, n, k)
qhyper(p, m, n, k)

In your original post (op) you gave the output of dhyper. I would find 
phyper much better, it shows that 0.95 is between the last two values of 
phyper. Apparently you want its inverse, qhyper, but are assuming there 
are such things as decimals. The hypergeometric is a discrete 
distribution, so, from the help page,

"The quantile is defined as the smallest value /x/ such that /F(x) ? p/, 
where /F/ is the distribution function. "

And, R is surely more competent at distribution functions than Perl. 
Stick to it and read "An Introduction to R", file R-intro.pdf in the doc 
directory of your R installation, Chapter 8. All computer languages have 
some learning time and as far as statistics is concerned, learning R pays.

Hope this helps,

Rui Barradas
Em 01-10-2012 16:28, jas4710 escreveu:
> Thanks Jeff
> The documentation pages, if I haven't missed any crucial points, illustrate
> how to get probability and cumulative probability values.
>
> I can first retrieve the data structures and use Perl (I don't know how to
> use R...) to sort the derived ratios and sum the probability values until
> the cumulative probability exceeds 95%. Well, I just don't know whether such
> seemingly routine procedures have already been implemented...
>
> Thanks again!
>
>
>
> --
> View this message in context: 
> http://r.789695.n4.nabble.com/Retrieve-95-coverage-of-results-from-a-hypergeometric-distribution-tp4644683p4644701.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@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.


        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to