[Rd] error in qbeta (PR#1201)

z.yang@ucl.ac.uk z.yang@ucl.ac.uk
Sun, 9 Dec 2001 13:57:05 +0100 (MET)


Full_Name: Ziheng Yang
Version: 1.3.1
OS: Windows 98
Submission from: (NULL) (172.136.54.89)


I noticed that qbeta is sometimes wrong and the error is not even due to the
beta parameters being too extreme.  I am calculating the quantiles corresponding
to cdf = 0.05, 0.15, ..., 0.95.  The value corresponding to cdf=0.25 is wrong
while all other values are correct.  

qbeta(0.05, 0.143891, 0.05) = 1.040850e-05   correct
qbeta(0.15, 0.143891, 0.05) = 0.021161       correct
qbeta(0.25, 0.143891, 0.05) = 3e-308         wrong (correct value is 0.457227)
qbeta(0.25, 0.143891, 0.05) = 0.945217       correct

I also used your source file qbeta.c to do the same calculation, and it seems
that something might be wrong in the "initial approximation", before the
newton-raphson iteration.  Also I notice that the 5/6 in the following line is
probably supposed to mean 5./6., although this does not seem to be the source of
the problem.

	w = y * sqrt(h + r) / h - (t - s) * (r + 5 / 6 - 2 / (3 * h));

Could you possibly let me know how to fix the problem.  I will appreciate any
help you might provide.  I am using the Windows version 1.3.1 (2001).

Best wishes,


Ziheng Yang
Professor of Statistical Genetics 
Department of Biology               
University College London           Phone: (+44) (0)20 7679 4379
Darwin Building                     Fax:   (+44) (0)20 7679 7096
Gower Street                        Email: z.yang@ucl.ac.uk
London WC1E 6BT
England
http://abacus.gene.ucl.ac.uk/


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel 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-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._