Boost logo

Boost Users :

Subject: Re: [Boost-users] [math/distributions] Problem using inv-chi**2 and quantiles
From: Paul A. Bristow (pbristow_at_[hidden])
Date: 2011-06-14 09:51:18


> -----Original Message-----
> From: boost-users-bounces_at_[hidden] [mailto:boost-users-bounces_at_[hidden]] On Behalf
Of
> Paul Johnson
> Sent: Tuesday, June 14, 2011 1:39 PM
> To: boost-users_at_[hidden]
> Subject: [Boost-users] [math/distributions] Problem using inv-chi**2 and quantiles
>
> I'm trying to duplicate Excel's CHIINV to calculate confidence limits for an observed number of
events. I
> think I'm nearly there, largely as a result of trial and error, but the boost results still
significantly differ
> from the Excel results, so I've presumably messed up somewhere.
> Any advice will be *greatly* appreciated.
>
> The Excel formulas I'm using are:
>
> lo limit = CHIINV((1+$C$3)/2, 2*B6)/2
> hi limit = CHIINV((1-$C$3)/2, 2*(B6+1))/2
>
> where $C$3 is the confidence level required (95%), and B6 is the number of events observed. In
Excel,
> 'CHIINV' is documented as:
>
> > CHIINV(probability,degrees_freedom)
> > Probability is a probability associated with the chi-squared distribution.
> > Degrees_freedom is the number of degrees of freedom.
>
> For 17 events, for example, Excel is producing limits of [9.90, 27.22].
>
> I've attached my complete boost test program below, which I hope does the same thing, but there
was a
> large amount of guesswork here. This program produces results of [10.67, 25.98] for 17 events.
>
> Can anyone tell me what I'm doing wrong?

Well, using EXCEL for a start ;-)

No - seriously, I can't see at a glance why they differ, and since this distribution has been added
recently, a mistake as always possible.

I'll look more closely as soon as I can, but it won't be today (but at least you know you are on my
TODO list, and can mail me privately).

Paul

PS As a very quick idea - Is the /2 in (1+$C$3)/2 the cause of the difference?

---
Paul A. Bristow,
Prizet Farmhouse, Kendal LA8 8AB  UK
+44 1539 561830  07714330204
pbristow_at_[hidden]

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net