5
$\begingroup$

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

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

Return:

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

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

$\endgroup$
4
  • $\begingroup$ 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. $\endgroup$ Oct 3, 2013 at 11:09
  • $\begingroup$ Yes, i think it's ok. But my teacher told me to set DoF to 4 or 5. To confirm the hypothesis. $\endgroup$
    – Medvedev
    Oct 3, 2013 at 11:19
  • $\begingroup$ 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. $\endgroup$
    – Michael E2
    Oct 3, 2013 at 11:46
  • $\begingroup$ May be someone else know hot to implement Pearson Chi Squire test (without function PearsonChiSquareTest)? $\endgroup$
    – Medvedev
    Oct 3, 2013 at 13:33

1 Answer 1

6
$\begingroup$

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.

$\endgroup$
4
  • $\begingroup$ Thanks you! But how to set in your answer degrees of freedom? $\endgroup$
    – Medvedev
    Oct 3, 2013 at 14:33
  • $\begingroup$ 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. $\endgroup$
    – Andy Ross
    Oct 3, 2013 at 14:41
  • $\begingroup$ What is obs_List? And what is exp_Lis? $\endgroup$
    – Medvedev
    Oct 3, 2013 at 14:54
  • $\begingroup$ Observed and expected counts in each bin. $\endgroup$
    – Andy Ross
    Oct 3, 2013 at 15:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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