[Rd] phyper returns 1 if x==k (PR#8499)

ripley@stats.ox.ac.uk ripley at stats.ox.ac.uk
Wed Jan 18 11:01:24 CET 2006


On Wed, 18 Jan 2006 utz.pape at molgen.mpg.de wrote:

> Full_Name: Utz J. Pape
> Version: 2.2.0
> OS: linux
> Submission from: (NULL) (141.14.23.12)
>
>
> If I use phyper and set parameter x equal to k (meaning that all balls I draw
> are white) phyper returns 1 which is not (always) correct:

I think you are confusing this with dhyper.  How can you possibly get more 
white balls than exist in the urn?  That you cannot is what p = 1 is 
telling you.

We do quite specifically ask you not to report on obselete versions of R.
Of course, as this is NOT A BUG, it is the same in the current R.

>
> pape at xxx:~> R2.2.0 --vanilla
>
> R : Copyright 2005, The R Foundation for Statistical Computing
> Version 2.2.0  (2005-10-06 r35749)
> ISBN 3-900051-07-0
>
> R is free software and comes with ABSOLUTELY NO WARRANTY.
> You are welcome to redistribute it under certain conditions.
> Type 'license()' or 'licence()' for distribution details.
>
> R is a collaborative project with many contributors.
> Type 'contributors()' for more information and
> 'citation()' on how to cite R or R packages in publications.
>
> Type 'demo()' for some demos, 'help()' for on-line help, or
> 'help.start()' for a HTML browser interface to help.
> Type 'q()' to quit R.
>
>> x <- 10; m <- 20; n <- 5; k <- 10
>> phyper(x,m,n,k)
> [1] 1
>> choose(m,x) * choose(n,k-x) / choose(m+n,k)
> [1] 0.05652174
>> version
>         _
> platform i686-pc-linux-gnu
> arch     i686
> os       linux-gnu
> system   i686, linux-gnu
> status
> major    2
> minor    2.0
> year     2005
> month    10
> day      06
> svn rev  35749
> language R
>> sessionInfo()
> R version 2.2.0, 2005-10-06, i686-pc-linux-gnu
>
> attached base packages:
> [1] "methods"   "stats"     "graphics"  "grDevices" "utils"     "datasets"
> [7] "base"
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list