[R] accuracy of chi-square distribution approximations

Liaw, Andy andy_liaw at merck.com
Wed Mar 10 01:45:36 CET 2004


You have full access to the R source code, so that would be the place to
look.

In R-1.8.1, in the file .../src/nmath/qchisq.c, the function just calls
qgamma() (of course!).  In qgamma.c, it says:

 *  DESCRIPTION
 *
 *      Compute the quantile function of the gamma distribution.
 *
 *  NOTES
 *
 *      This function is based on the Applied Statistics
 *      Algorithm AS 91 ("ppchi2") and via pgamma(.) AS 239.
 *
 *  REFERENCES
 *
 *      Best, D. J. and D. E. Roberts (1975).
 *      Percentage Points of the Chi-Squared Distribution.
 *      Applied Statistics 24, page 385.  */

so you should consult those references.

Andy

> From: Victoria Stodden
> 
> Hi there,
> 
> How accurate is the aproximation R makes to the Chi-Square 
> distribution?
> For example, if I run:
> 
> > qchisq(1/1000000,6)
> [1] 0.03650857
> 
> how accurate is 0.0365 compared to the theoretical 
> percentile? What kind
> of approximations have been made in the software's algorithm? 
> It woudl be
> useful to know since I am working with tiny percentiles such as one
> one-millionth and one one-billionth, and I am not sure how R comes up
> with the percentile numbers.
> 
> Thanks for any help,
> -Victoria
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
> 
> 


------------------------------------------------------------------------------
Notice:  This e-mail message, together with any attachments,...{{dropped}}




More information about the R-help mailing list