Boost logo

Boost Users :

Subject: Re: [Boost-users] [statistics] chi-square test with boost
From: er (erwann.rogard_at_[hidden])
Date: 2010-03-30 11:13:29


Christine SINOQUET wrote:
> Hello,
>
> I have to implement chi square tests. As I already use the boost library
> boost_1_38 for other purposes, I would like to use it for this purpose
> too. However I can find no documentation relative to this or the
> information I find is not correct.
>
> Can somebody indicate me how I can to use accumulators/statistics ? Is
> the boost_1_38 appropriate ? Which file should I include and which
> function should I use ?
>
> I just need to specify the columns in a matrix I wish to test for
> independence, the data itself and a threshold alpha. I would like the
> test statistic in return, as well as the p-value.
>
> If my question is not the object of this diffusion list, please tell me.
>
> Thank you in advance.
>
> Regards.

I tend to find Boost.Accumulators most useful when you want to compute a
statistics in a sequential fashion say for n = 10, 20, 30.

In your case, Boost.Accumulators would be useful to update a contingency
table as observations are accumulated. The actual statistics would be in
a separate "feature" that depends on the former (that's the beauty of
Boost.Acc). You can find an example along those lines for the kolmogorov
statistic:

https://svn.boost.org/svn/boost/sandbox/statistics/non_parametric/boost/statistics/detail/non_parametric/

If you already have a contingency table (as seems the case from your
question) I can only suggest to compute the statistics
(std::accumulate?) and and compare it to its critical value using
http://www.boost.org/doc/libs/1_40_0/libs/math/doc/sf_and_dist/html/math_toolkit/dist/dist_ref/dists/chi_squared_dist.html

HTH, but if it's too trivial, better safe than sorry.


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