Re: Chi squared -> p-value - Any formula??



C Hanck wrote:
afaik, GAUSS has a command for that. from the reference:

cdfchinc(x,v,d)

Thanks, but I wanted something I could implement easily in Tcl (Tool Command Language)


http://www.tcl.tk/

which is an open-source interpreted programming language suitable for a number of tasks. With its cousin Tk, it is quite good for graphical applications. I'm working on a chess database


http://chessdb.sourceforge.net/

to which I wanted to add a couple of statistical functions, so using a commercial program like Mathematica (which I have access to) or GAUSS (which I don't), was not really my aim.

Ray Koopman's numerical approximation looks fine to me. Of course if someone has a more accurate one, which is easy to implement, I'd use that instead, but from a practical point of view, that is fine. A maximum absolute error in the p-value of 0.0003147 with an equation which can be typed all on one line, is pretty good I feel.

I was originally in the software only have it report one of three things.

* Note statistically significant (p > 0.05)
* Statistically significant at 5%, but not at 1% (i.e 0.05 >= p > 0.01)
* Statisticially significant at 1% level (p <= 0.01)

I then thought I'd actually report the p-value, which of course then meant I needed a method to calculate it, rather than just look up the chi-squared values corresponding to p-values of 0.01 and 0.05.


--
Dave (from the UK)

Please note my email address changes periodically to avoid spam.
It is always of the form: month-year@xxxxxxxxxxxx
Hitting reply will work for a few months only - later set it manually.

http://chessdb.sourceforge.net/ - a Free open-source Chess Database
.