[R] Accuracy problem in dchisq for non-central chi-squared

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Thu Dec 14 12:11:03 CET 2000

Uffe Høgsbro Thygesen <uht at dfu.min.dk> writes:

> Any comments on this one?

Ahem. I went to look at the code and it stared me right in the face:

    const static int maxiter = 100;

That needs to be keyed to the actual value of lambda! At lambda=225,
we're not even at the mode of the weighting Poisson distibution which
has mean lambda/2.

I think we can sneak a fix for that one in before the release of 1.2.0
tomorrow.  (pnchisq.c has 

    const static int itrmax = 10000;

which I should probably clone for now, but there must be a better
long-term solution for both of them. Anyone need a small exercise for
their students?)

   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list