Matlab Function for chi-square goodness of fit test added to course websiteI added a function named
GoodnessOfFit4RandDigs
that performs an alpha significance level chi-square goodness of fit test of
randomness on input vector of digits to the STA 342 website. This script essentially
implements the method demonstrated in
Example
8.5-1 on Page 524 in
Probability and Statistical Inference
7e by Hogg and Tanis.
Sample run (after storing sequence of digits in vector x):
>> GoodnessOfFit4RandDigs(x,0.05)
Sequence fails Goodness of Fit test for randomness at the 0.05 level
Frequency Expected Number
-----------------------------------------
Same 0 5
One away 8 10
Other 42 35
-----------------------------------------
Sample run (testing Matlab's builtin rand function):
>> x=floor(10*rand(51,1));
>> GoodnessOfFit4RandDigs(x,0.05)
Sequence passes Goodness of Fit test for randomness at the 0.05 level
Frequency Expected Number
-----------------------------------------
Same 5 5
One away 9 10
Other 36 35
-----------------------------------------
Posted: Monday - March 27, 2006 at 05:28 PM |
Quick Links
Statistics
Total entries in this blog:
Total entries in this category: Published On: May 23, 2008 09:10 AM |