[R] Accuracy problem in dchisq for non-central chi-squared
Peter Dalgaard BSA
p.dalgaard at biostat.ku.dk
Thu Dec 14 14:01:46 CET 2000
Peter Dalgaard BSA <p.dalgaard at biostat.ku.dk> writes:
> 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?)
Hmm. I did this and it did help, but the function is still getting in
trouble already for mean=37. I believe this is due to underflow in the
calculation of dchisq used to start the recursion. This'll need some
redesign (including a little theoretical analysis) to function
properly I think.
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