This is the mail archive of the
gsl-discuss@sourceware.org
mailing list for the GSL project.
Re: accuracy of gsl_cdf_binomial_P
- From: Well Howell <whowell at superlink dot net>
- To: gsl-discuss at sourceware dot org
- Date: Sun, 05 Jun 2011 09:03:30 -0400
- Subject: Re: accuracy of gsl_cdf_binomial_P
- References: <459650.92078.qm@web110504.mail.gq1.yahoo.com>
- Reply-to: well at wheatstone-analytics dot com
An interesting (but "homework-like" ~;) question - and fun to answer too.
Anyway, I'd probably compare GSL results with those from other sources.
I had easy access to gsl_cdf_binomial_P (v 1.14), R pbinom(k,n,p),
binomCDF
(Excel 2007) and dcdflib (Fortran - Brown, Lovato & Russel; U. Texas;
November, 1997).
For a sample size of n=1000, a trial probability of p=0.01 and number of
successes of
s=1 thru 40, the CDF values from dcdclib and the R 2.13.0 stats package
pbinom()
function (http://cran.r-project.org/) show no difference.
Mean absolute deviations for these 40 tests, comparing pbinom with
gsl_cdf_binomial_P and with binomCDF, show MAD of 2.319E-15 and 3.296E-15
respectively.
My "commend"? Looks as if we all have to decide when to STOP
accumulating small terms, and some stop earlier than others. While I always
test functions in Excel against other sources before release in a report,
anything showing a MAD below 4E-15 sure beats using my slide rule
(which didn't have an incomplete beta function anyway ~;).
Well Howell
On 6/2/2011 12:49 AM, Z F wrote:
Hello everybody,
I was wondering if someone could comment on the accuracy of gsl_cdf_binomial_P() function gsl implementation for large n (n is about a few thousand).
for different values of p and when the result of cdf is in the tails ( small less then 0.05 and large -- above 0.95)
Thank you very much
ZF