Boost logo

Boost Users :

Subject: [Boost-users] [math/distributions] Problem using inv-chi**2 and quantiles
From: Paul Johnson (sa212+boost_at_[hidden])
Date: 2011-06-14 08:39:18


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?

Thanks -

Paul




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