Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How to set degrees of freedom for PearsonChiSquareTest? I have this:

PearsonChiSquareTest[ex,  NormalDistribution[0, Sigma], {"PValue", "DegreesOfFreedom",   "ShortTestConclusion"}, SignificanceLevel -> 0.05]


{2.95529*10^-11, 12, "Reject"}

I need to set degrees of freedom to 4-5.

share|improve this question
You don't need to set the df. It's determined from the data. Since the code returns 12, I guess your idea of the number of df is wrong. – Sjoerd C. de Vries Oct 3 '13 at 11:09
Yes, i think it's ok. But my teacher told me to set DoF to 4 or 5. To confirm the hypothesis. – Medvedev Oct 3 '13 at 11:19
As I understand it, this tests a histogram of the observed data with an expected one based on the distribution. The degrees of freedom depends on the number bins used and the number of parameters of the distribution that have to be estimate (e.g. Sigma). PearsonChiSquareTest seems to do the binning automatically. You may have to construct a frequency histogram and then do a chi square test. Seems odd one cannot override the binning with an option. Perhaps someone else will know a way. – Michael E2 Oct 3 '13 at 11:46
May be someone else know hot to implement Pearson Chi Squire test (without function PearsonChiSquareTest)? – Medvedev Oct 3 '13 at 13:33
up vote 5 down vote accepted

I can say with certainty that, as of version 9, it is not possible to set the degrees of freedom for PearsonChiSquareTest. I recommend seeing my answer here for an implementation of your own test that allows you to bin your own data.

share|improve this answer
Thanks you! But how to set in your answer degrees of freedom? – Medvedev Oct 3 '13 at 14:33
Notice that it is the length of the bins minus 1. You would bin your data with 5 bins if you want 4 degrees of freedom. – Andy Ross Oct 3 '13 at 14:41
What is obs_List? And what is exp_Lis? – Medvedev Oct 3 '13 at 14:54
Observed and expected counts in each bin. – Andy Ross Oct 3 '13 at 15:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.