# Chi Square Test – Uniformity test in Randomness | BSc.CSIT | Fifth Semester

## Chi Square Test – testing uniformity in randomness Simulation and Modeling Reference Notes Fifth Semester | Third year BSc.CSIT | Tribhuvan University (TU)

Chi Square Test
The chi-square test uses the sample statistic as;

Where Oi is the observed number in the ith class, Ei is the expected number in the ith class, and n is the number of classes. For the uniform distribution, Ei the expected number in each class is given by

Ei= N/n

for equally spaced classes, where N is the total number of observations. It can be shown that the sampling distribution of χ02 is approximately the chi-square distribution with n-1 degrees of freedom.

For example;
Use the chi-square test with a= 0.05 to test whether the data shown below are uniformly distributed.

0.34   0.90   0.25   0.89   0.87   0.44   0.12   0.21   0.46   0.67
0.83   0.76   0.79   0.64   0.70   0.81   0.94   0.74   0.22   0.74
0.96   0.99   0.77   0.67   0.56   0.41   0.52   0.73   0.99   0.02
0.47   0.30   0.17   0.82   0.56   0.05   0.45   0.31   0.78   0.05
0.79   0.71   0.23   0.19   0.82   0.93   0.65   0.37   0.39   0.42
0.99   0.17   0.99   0.46   0.05   0.66   0.10   0.42   0.18   0.49
0.37   0.51   0.54   0.01   0.81   0.28   0.69   0.34   0.75   0.49
0.72   0.43   0.56   0.97   0.30   0.94   0.96   0.58   0.73   0.05
0.06   0.39   0.84   0.24   0.40   0.64   0.40   0.19   0.79   0.62
0.18   0.26   0.97   0.88   0.64   0.47   0.60   0.11   0.29   0.78

Solutions
The table for chi square statistics is

 Class interval(i) Oi Ei (Oi-Ei) (Oi-Ei)2 (Oi-Ei)2/Ei 1 8 10 -2 4 0.4 2 8 10 -2 4 0.4 3 10 10 0 0 0.0 4 9 10 -1 1 0.1 5 12 10 2 4 0.4 6 8 10 -2 4 0.4 7 10 10 0 0 0.0 8 14 10 4 16 1.6 9 10 10 0 0 0.0 10 11 10 1 1 0.1 Total N=100 N=100 0 3.4

Above Table contains the essential computations for chi square test. The test uses n = 10 intervals of equal length, namely [0.0, 0.1), [0.1, 0.2), . . . , [0.9, 1.0). The value of χ02 is 3.4.

Here degree of freedom is n-1=10-1=9 and α=0.05. The tabulated value of χ020.05, 9 =16.9. Since χ02 is much smaller than the tabulated value of chi square, the null hypothesis of a uniform distribution is not rejected.

(Visited 492 times, 5 visits today)

Posted By : | Comment RSS | Category : Fifth Semester
Subscribe Notes