Re: [R] Retrieve hypergeometric results in large scale

2012-10-01 Thread William Dunlap
g [1] 5 6 7 8 9 10 Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf > Of jas4710 > Sent: Monday, October 01, 2012 9:59 AM > To: r-help@r-project.org &

Re: [R] Retrieve hypergeometric results in large scale

2012-10-01 Thread Rui Barradas
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)

Re: [R] Retrieve hypergeometric results in large scale

2012-10-01 Thread jas4710
Thanks Jeff~~~ In fact I do not know how to combine and extract vectors in R. ans<-sort(dhyper(x, m, n, k),decreasing=TRUE) rbind(ans,cumsum(ans) will show the first point that exceeds 95% threshold. The problem is: *information is lost* I can no longer identify where are the first few elements

Re: [R] Retrieve hypergeometric results in large scale

2012-10-01 Thread Bert Gunter
If you have not already done so, stop what you are doing and work through the Introduction to R tutorial that ships with R (or other R tutorial on the web that you may prefer). The tutorials are written to help you climb the R learning curve much more efficiently than the fooling around that you a

Re: [R] Retrieve hypergeometric results in large scale

2012-10-01 Thread jas4710
Hi Bert. This is not a homework. If I can do some basic programming in R like Perl, then I'll have a better chance to accomplish this task but the matrix concept is not quickly comprehensible... -- View this message in context: http://r.789695.n4.nabble.com/Retrieve-95-coverage-of-results-from-

Re: [R] Retrieve hypergeometric results in large scale

2012-10-01 Thread jas4710
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 th

Re: [R] Retrieve hypergeometric results in large scale

2012-10-01 Thread Bert Gunter
Homework? There's a no homework policy on this list. -- Bert On Mon, Oct 1, 2012 at 8:10 AM, Jeff Newmiller wrote: > Perhaps you should read > > ?dhyper > > and if you have a hard time parsing that, then read > > ?Distributions > > and then go back to > > ?dhyper > --

Re: [R] Retrieve hypergeometric results in large scale

2012-10-01 Thread Jeff Newmiller
Perhaps you should read ?dhyper and if you have a hard time parsing that, then read ?Distributions and then go back to ?dhyper --- Jeff NewmillerThe . . Go Live... DCN:Bas

[R] Retrieve hypergeometric results in large scale

2012-10-01 Thread jas4710
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