Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.
|
|
Math Forum
»
Discussions
»
sci.math.*
»
sci.stat.math
Notice: We are no longer accepting new posts, but the forums will continue to be readable.
Topic:
Kolmogorov-Smirnov-Lilliefors Test statistics
Replies:
10
Last Post:
Jun 8, 2013 7:39 PM
|
 |
|
Luis A. Afonso
Posts:
4,758
From:
LIsbon (Portugal)
Registered:
2/16/05
|
|
Re: Kolmogorov-Smirnov-Lilliefors Test statistics
Posted:
Sep 20, 2012 1:49 PM
|
|
In testing for normality using the Lilliefors (Kolmagorov-Smirnov) tough we get an anomalous high test statistics, D max, we stay pretty sure that data the null Hypotheses should be rejected. This obvious decision will be illustrated numerically trough a few examples where simulated Fish samples, ______cdf = 1/( 1- x^(-2)) were tested. Recording the max among the tested samples. We had found:
Size n=100/400000____Fisk______Normal_ __________________ 728.36_____0.239__ _________/40000___ 504.98_____0.221 __________________ 412.05_____0.226 __________________ 487.50_____0.230
It can be added that in [.2, .3) the frequencies for Normal data are very low, sometimes 0.0000, or 0.0005 say: in fact almost all test statistics are contained in [0, .2). No surprise . . . at all.
Luis A. Afonso
REM "FIG" CLS PRINT " ************** FIG " PRINT " ********************" DEFDBL A-Z PRINT " " PRINT " " REM INPUT " SAMPLE SIZE "; N INPUT " HOW MANY "; ali INPUT " 0= N or 1= Fisk "; wnm DIM x(N), xx(N), f(N), diff(N), h(20) DEF fng (z, j) = -.5 * z ^ 2 * (2 * j + 1) / ((j + 1) * (2 * j + 2)) f(0) = 0 suptest = 0: infra = 1E+20 FOR ji = 1 TO N: f(ji) = ji / N: NEXT ji REM THE CHI2 TEST: REM REM pi = 4 * ATN(1): c = 1 / SQR(2 * pi) REM FOR SAMPLE = 1 TO ali RANDOMIZE TIMER mmajor = 0 LOCATE 8, 50: PRINT USING "########"; ali - SAMPLE md = 0: sum2 = 0 FOR item = 1 TO N 14 h = RND IF h < 1E-14 THEN GOTO 14 IF wnm = 0 THEN GOTO 1 COLOR 14: u = 1 / SQR(1 / h - 1) GOTO 2 1 COLOR 3: aa = SQR(-2 * LOG(h)) u = 0 + 1 * aa * COS(2 * pi * RND) 2 x(item) = u md = md + u / N sum2 = sum2 + u * u NEXT item sqd = sum2 - N * (md ^ 2) sd = SQR(sqd / (N - 1)) FOR ii = 1 TO N: x(ii) = (x(ii) - md) / sd: NEXT ii REM Ordering FOR i1 = 1 TO N: u = x(i1): w = 1 FOR i2 = 1 TO N IF x(i2) < u THEN w = w + 1 NEXT i2: xx(w) = u NEXT i1 REM "**********************" REM PHI FOR tt = 1 TO N: z = xx(tt) IF z >= 0 THEN kw = 0 IF z < 0 THEN kw = 1 zu = ABS(z): s = c * zu: antes = c * zu FOR j = 1 TO 10000 xx = antes * fng(zu, j) s = s + xx antes = xx IF ABS(xx) < .00005 THEN GOTO 20 NEXT j 20 IF kw = 0 THEN FF = .5 + s IF kw = 1 THEN FF = .5 - s b = ABS(FF - f(tt - 1)) bb = ABS(f(tt) - FF) REM MAJOR = b IF bb > b THEN MAJOR = bb REM IF MAJOR > mmajor THEN mmajor = MAJOR IF mmajor > suptest THEN suptest = mmajor IF mmajor < infra THEN infra = mmajor NEXT tt FOR tu = 1 TO N IF mmajor > 0 AND mmajor < .1 THEN h(1) = h(1) + 1 IF mmajor >= .1 AND mmajor < .2 THEN h(2) = h(2) + 1 IF mmajor >= .2 AND mmajor < .3 THEN h(3) = h(3) + 1 IF mmajor >= .3 AND mmajor < .4 THEN h(4) = h(4) + 1 IF mmajor >= .4 AND mmajor < .5 THEN h(5) = h(5) + 1 IF mmajor >= .5 AND mmajor < .6 THEN h(6) = h(6) + 1 IF mmajor >= .6 AND mmajor < .7 THEN h(7) = h(7) + 1 IF mmajor >= .7 AND mmajor < .8 THEN h(8) = h(8) + 1 IF mmajor >= .8 AND mmajor < .9 THEN h(9) = h(9) + 1 IF mmajor >= .9 AND mmajor < 1 THEN h(10) = h(10) + 1 NEXT tu NEXT SAMPLE FOR ty = 1 TO 10 LOCATE 10 + ty, 7 PRINT USING "#.####"; h(ty) / (ali * N) NEXT ty PRINT " suptest "; suptest, infra 100 END
|
|
|
|