I am trying to use the chi-square test for identifying random data. I have 256 categories, i.e. 255 degrees of freedom and count the occurrence of byte-values (0-255). As suggested by Knuth, the observed sequence of bytes is random, if the chi-square value is between the chi-square-values of p=5% and p=95% (I read these value from the table). the test works but I am trying to understand why :)

I have no idea about statistics, this is my problem right now. I am trying to understand what the p-value actually is and its relation to alpha. It is said that the null-hypothesis is rejected if the computed chi-statistic is above the chi-square value depending on alpha.

Knuth has a table where all chi-square-values are listed depending on the p-value. can anybody explain to me why? Why does he say that the calculated chi-square-statistic MUST be between p=5% and p=95% if data is random?

Thank you guys very much for any answer!

  • $\begingroup$ Which of Knuth's works are you quoting specifically? $\endgroup$ – whuber Oct 1 '12 at 14:07
  • $\begingroup$ Donald E. Knuth, The Art of Computer Programming, Seminumerical Algorithms $\endgroup$ – tom Oct 1 '12 at 14:14
  • $\begingroup$ In my copy (1998, Addison-Wesley) Knuth discusses the chi-squared test in section 3.3.1. Nowhere does he insist the p-value must lie between 5% and 95%. I recommend you read that section with more care. $\endgroup$ – whuber Oct 1 '12 at 14:18
  • 1
    $\begingroup$ ok thank you so far, i will do that. only one more thing: everywhere i see the chi-square table according to alpha, knuth has the table according to the p-value. is it possible for you to explain the relation in easy words? or better said: why i need the p-value if the alpha is everything for performing this test? thank you very much! $\endgroup$ – tom Oct 1 '12 at 14:38
  • 2
    $\begingroup$ Knuth discusses this: you worry about the distribution being uneven (detected by a large chi-squared value) and about being too even (which is a subtle but potentially important departure from randomness): that's detected by a chi-squared value which is too small. $\endgroup$ – whuber Oct 1 '12 at 17:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.