Matthew Vernon wrote: > Hi, > > I'd like to be able to use the chi-squared test in my code. Currently, > I can output "look up [this value] in a chi-squared table with [x] > degrees of freedom", but that's obviously a little sub-optimal. I > notice that numarray has a chi_square function, but that just gives > you random numbers from a chi-squared distribution with a set number > of degrees of freedom - not really what I want. > > Does there exist python code to do this? preferably something vaguely > standard?
Yes, in Scipy. from scipy.stats import chi2 # one-sided Chi^2 test pval = 1 - chi2.cdf(value, dof) http://new.scipy.org/Wiki [This URL will be http://www.scipy.org in a week or so, I hope.] > Matthew > ps: given the "batteries included" philosphy, there's a remarkable dearth > of stats in python... I think Chi^2 tests fall distinctly in the "third-party library" category, myself. -- Robert Kern [EMAIL PROTECTED] "In the fields of hell where the grass grows high Are the graves of dreams allowed to die." -- Richard Harter -- http://mail.python.org/mailman/listinfo/python-list