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

utz.pape@molgen.mpg.de utz.pape at molgen.mpg.de
Wed Jan 18 10:55:07 CET 2006


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:

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"



More information about the R-devel mailing list