[SciPy-User] An extra parameter to stats.chisquare ?

josef.pktd at gmail.com josef.pktd at gmail.com
Sun Aug 2 17:18:41 EDT 2009


On Sun, Aug 2, 2009 at 4:05 PM, Pierre GM<pgmdevlist at gmail.com> wrote:
> All,
> stats.chisquare requires a mandatory parameter (frequency of
> observations) and an optional argument (theoretical frequencies). In
> that second case, I think we have to introduce yet another parameter,
> p, corresponding to the number of parameters of the theoretical
> distribution: the number of degrees-of-freedom for the chisqprob would
> then be k-p (with k the sample size), instead of the current k-1. Of
> course, we can set p=1 by default.
> Comments ?
> P.

No disagreement with adding e.g. "ddof" as additional keyword
parameter. This might be also relevant for other tests where the data
can be based on prior estimation. (The same problem shows up with
tests after regression.)

For the chisquare test, I'm not sure about the theory, since I only
used chisquare without estimating parameters. Wikipedia seems a bit
ambiguous:

"The chi-square statistic can then be used to calculate a p-value by
comparing the value of the statistic to a chi-square distribution. The
number of degrees of freedom is equal to the number of cells n, minus
the reduction in degrees of freedom, p.
More generally however, when maximum likelihood estimation does not
coincide with minimum chi-square estimation, the distribution will lie
somewhere between a chi-square distribution with n - 1 - p and n - 1
degrees of freedom (See for instance Chernoff and Lehmann 1954)."
(http://en.wikipedia.org/wiki/Pearson%27s_chi-square_test)


If you need goodness-of-fit tests, then you could also try my
implementation of a more general class of gof statistics (power
discrepancy). I sent it to the mailing list a while ago.

Josef


> _______________________________________________
> SciPy-User mailing list
> SciPy-User at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>



More information about the SciPy-User mailing list