tlumley@u.washington.edu
2004-Nov-24 16:11 UTC
(PR#7393) Re: [Rd] dhyper() does not allow non-integer values for
This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. ---1936847065-1111238301-1101309010=:193006 Content-Type: TEXT/PLAIN; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Wed, 24 Nov 2004 Erik.Jorgensen@agrsci.dk wrote:> > 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",I would argue that the bug was in the other functions. If not, there is a=20 bug in the documentation, which gives no way to tell what the result=20 should mean for non-integer m, n, k. =09-thomas> # 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=3DFALSE){ > 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=F8rgensen > Danish Institute of Agricultural Sciences > > > > --please do not edit the information below-- > > Version: > platform =3D i386-pc-mingw32 > arch =3D i386 > os =3D mingw32 > system =3D i386, mingw32 > status =3D > major =3D 2 > minor =3D 0.1 > year =3D 2004 > month =3D 11 > day =3D 15 > language =3D 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 > > ______________________________________________ > R-devel@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >Thomas Lumley=09=09=09Assoc. Professor, Biostatistics tlumley@u.washington.edu=09University of Washington, Seattle ---1936847065-1111238301-1101309010=:193006--
Peter Dalgaard
2004-Nov-24 18:34 UTC
(PR#7393) Re: [Rd] dhyper() does not allow non-integer values for
tlumley@u.washington.edu writes:> > > > 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", > > I would argue that the bug was in the other functions. If not, there is a> =20 > bug in the documentation, which gives no way to tell what the result=20 > should mean for non-integer m, n, k.My initial reaction too (and surely it is not a bug that functions behave inconsistently in regions where they are not documented to work at all), but on the other hand, noninteger m,n do appear to give a well-defined distribution, and perhaps there's a way of making sense of it? I wouldn't think it corresponds to noncentral hypergeometric distributions.> =09-thomas(who is suddenly coming across in quoted-unreadable?) -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk) FAX: (+45) 35327907