[Rd] dhyper() does not allow non-integer values for input parameters m (PR#7393)

Erik.Jorgensen at agrsci.dk Erik.Jorgensen at agrsci.dk
Wed Nov 24 13:05:08 CET 2004


dhyper() does not allow non-integer values for input parameters m and n.

this is in contrast to the other functions in the _hyper() "family",

  # OK
  dhyper(1,10,90,10)

  # NaN
  dhyper(1,10.5,90,10)

  # OK
  phyper(1,10,90,10)
  phyper(1,10.5,90,10)

  # OK
  qhyper(0.71,10,90,10)
  qhyper(0.71,10.5,90,10)

  # OK
  rhyper(1,10,90,10)
  rhyper(1,10.5,90,10)



# this "naive" version of dhyper() works

dhyperx<-function(x,m,n,k,log=FALSE){
       lp<-lchoose(m, x) + lchoose(n, k-x) - lchoose( m+n, k)
       if (log) {lp} else {exp(lp)}
       }

  # OK
  dhyperx(1,10,90,10)
  dhyperx(1,10.5,90,10)



Erik Jørgensen
Danish Institute of Agricultural Sciences



--please do not edit the information below--

Version:
  platform = i386-pc-mingw32
  arch = i386
  os = mingw32
  system = i386, mingw32
  status =
  major = 2
  minor = 0.1
  year = 2004
  month = 11
  day = 15
  language = R

Windows XP Professional (build 2600) Service Pack 1.0

Search Path:
  .GlobalEnv, package:methods, package:stats, package:graphics,
package:grDevices, package:utils, package:datasets, Autoloads, package:base



More information about the R-devel mailing list