I have a maxwellian distribution observation that I fit to expected maxwellian distribution. Then I run a chi square test to find out the goodness of the fit. I get excellent results however, I also want to find out the degrees of freedom that the chi square test uses. To quote the documentation chisquare
: The p-value is computed using a chi-squared distribution with k - 1 - ddof degrees of freedom, where k is the number of observed frequencies. The default value of ddof is 0.
What is k exactly here? Is it the total number of data points (41000) that I have? Or is it the frequency per bin?
k
is the size of f_obs
, the first argument of chisquare
. It is the number of bins.
For example, in the following example from the docstring,
>>> chisquare([16, 18, 16, 14, 12, 12])
(2.0, 0.84914503608460956)
f_obs
is [16, 18, 16, 14, 12, 12]
, and k
is len(f_obs)
, or 6.
The docs follow typical statistical variable names. K-1 is the degrees of freedom. K represents the amount of samples of each size n. So in your words, frequency per bin.
Last paragraph of http://statistics.about.com/od/Inferential-Statistics/a/What-Is-A-Degree-Of-Freedom.htm reads:
Another example of a different way to count the degrees of freedom comes with an F test. In conducting an F test we have k samples each of size n. The degrees of freedom in the numerator is k - 1 and in the denominator is k(n - 1).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.