Boost logo

Boost Users :

Subject: Re: [Boost-users] [math/distributions] Problem using inv-chi**2 and quantiles
From: Paul Johnson (sa212+boost_at_[hidden])
Date: 2011-06-15 16:38:16

Excellent - thanks very much to both of you. I've confirmed that the
final answer of

  lo = quantile(boost::math::chi_squared(2*events), 0.025) / 2;
  hi = quantile(boost::math::chi_squared(2*(events+1)), 0.975) / 2;

does the job. As to what it's used for, the Excel formulas are commonly
used in public health to calculate Poisson confidence levels, using a
transformation between Poisson and chi-squared (attributed to Ulm,
1990). I've also noticed that at least one of the websites that provides
an online Poisson limits calculator uses the chi-squared equivalent.
There's a short summary at, which
also points out that Excel's CHIINV is/was buggy, which seems to have
been well-known for years. Presumably the name change in Excel 2007 is
because they have a new implementation.


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at