You are on page 1of 5

GOODNESS OF FIT

Goodness of fit for continuous variate


Kolmogorov-Smirnov test
Assume sample is 0.1, 0.7, 0.6, 0.1 (4
observations, n=4)
Empirical probability function is the
steps with upward jumps 1/n at
points 0.1,0.6,0.7 (sort the
observations!)
At 0.1 the jump is ! (Why?)
Assume uniform theoretical distribution: F(x)=x.
D is the maximal distance between F(x) and the steps (D=0.4). Number of
freedoms is n-1.
If D is greater than the critical D (see further): the hypothesis that sample
came from the theoretical distribution F is rejected

Calculation of F(x)
When the jump-points are x then in F(x) is easily
calculated in Excel using the functions:
Distribution

Probability Function

Exponential

EXPONDIST(x,1/expectedTime,TRUE)=

Gamma

GAMMADIST(x,shape,scale,TRUE)=

Normal

NORMDIST(x,mean,stdDev,TRUE)=

Beta

BETADIST(x,shape1,shape2,A,B)=
5

Goodness of fit for discrete variate X2 (Chi


square) test (Example) i.

Assume 30 integers in range [0,10].


Test H : each integer has equal probability.
Collect the observations to bins (number of
0

observation in a bin is O) so that each bin has


expected number of observations (=E) > 5.

If CHIDIST( (O-E) /E) over all bins,

number of
bins (number of parameters computed from
sample +1)) < then reject H0. (CHIDIST is an
Excel function)
2

Goodness of fit for discrete variate X2 (Chi square) test


(Example) ii.

Values
0,1,2
3,4
5,6
7,8
9,10
Sum

Observed Expected
Frequency
(O-E)2/E
O
E
8
0.004
303/11
5
0.038
302/11
2
2.188
302/11
5
0.038
302/11
10
3.788
302/11
30
30
6.056
7

You might also like