shabbychef / sadists

Some Additional Distributions R package
GNU Lesser General Public License v3.0
8 stars 0 forks source link

rsumchisqpow pukes on 0 df #3

Closed shabbychef closed 8 years ago

shabbychef commented 9 years ago

This is broken:

rsumchisqpow(2,wts=1,df=0,pow=1)
[1] NaN NaN
Warning message:
In rchisq(n, df = dd, ncp = nn) : NAs produced

A 0 df chisquare should be identically 0 (or, rather, the ncp).

shabbychef commented 9 years ago

It is a little bit more complicated than that. A chi-square with 0 d.f. and non-zero ncp is not identically the ncp. Rather it has variance equal to 4 ncp^2, I believe. A central chi-square with 0 d.f. should be zero, but R's rchisq gives a warning and the wrong answer.

shabbychef commented 9 years ago

c.f. https://bugs.r-project.org/bugzilla/show_bug.cgi?id=16521

shabbychef commented 8 years ago

Fixed in R 3.2.3 : http://permalink.gmane.org/gmane.comp.lang.r.announce/168

shabbychef commented 8 years ago

Fixed by R 3.2.3, closing.