Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » sci.math.* » sci.stat.math.independent

Topic: The Lilliefors Test Power towards Cosine samples
Replies: 2   Last Post: Sep 25, 2012 1:12 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Luis A. Afonso

Posts: 4,615
From: LIsbon (Portugal)
Registered: 2/16/05
The Lilliefors Test Power towards Cosine samples
Posted: Sep 3, 2011 11:54 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

The Lilliefors Test Power towards Cosine samples size n


__________ Significance Level______crit. values*_____

____________1%_______5%_____
___n=5_____0.715_____0.626______.3427___.3959___
____10_____0.917_____0.851______.2616___.3037___
____15_____0.977_____0.950______.2196___.2545___
____20_____0.995_____0.987______.1920___.2226___
____25_____1.000_____0.998______.1726___.2010___
____30_____1.000_____0.999______.1590___.1848___

* from H.Abdi & P.Molin (1998).

Luis Amaral Afonso


REM "LILLINEW"
PRINT
CLS
REM DEFDBL A-Z
LOCATE 4, 1
PRINT " COSINE distrib. UNDER LILLIEFORS TEST "
INPUT " n= "; N
INPUT " Crit. val. 5% = "; crit5
INPUT " 1% = "; crit1
DIM sam(N)
DIM samp(N + 4)
DIM F(N)
DIM x(N)
FOR ty = 1 TO N: F(ty) = ty / N: NEXT ty
INPUT " all= "; all
pi = 4 * ATN(1): c = 1 / SQR(pi)
DEF fng (z, j) = -.5 * z ^ 2 * (2 * j + 1) / ((j + 1) * (2 * j + 3))
cc = 1 / (2 * pi)
DEF fnW (x) = cc * (pi + x + SIN(x))

REM
FOR sample = 1 TO all: REM all samples size n
RANDOMIZE TIMER
REM
LOCATE 7, 50
PRINT USING "#########"; all - sample
REM
mmajor = 0
FOR ii = 1 TO N: REM sample COSINE
bovi = RND: h = .01
FOR x1 = -pi TO pi STEP h
x11 = x1: Fw = fnW(x11)
IF Fw >= bovi THEN GOTO 1
NEXT x1
1 u = x11 - 1.0005 * h: v = x11 + 1.0005 * h
hh = .01 * h
FOR x2 = u TO v STEP hh
x22 = x2: Fw = fnW(x22)
IF Fw >= bovi THEN GOTO 2
NEXT x2
2 u = x22 - 1.0005 * hh: v = x22 + 1.0005 * hh
hhh = .01 * hh
FOR x3 = u TO v STEP hhh
x33 = x3: Fw = fnW(x33)
IF Fw >= bovi THEN GOTO 3
NEXT x3
3 sam(ii) = x33 - .5 * hhh
NEXT ii
REM
REM samp = sam IN ORDER
FOR ui = 1 TO N
uu = sam(ui): kk = 1
FOR ij = 1 TO N
IF sam(ij) < uu THEN kk = kk + 1
NEXT ij
samp(kk) = uu
NEXT ui
REM
mean = 0: sumsq = 0
FOR p = 1 TO N: uv = samp(p)
mean = mean + uv / N
sumsq = sumsq + uv * uv
NEXT p
sqdev = sumsq - N * mean * mean
stdev = sqdev / (N - 1)
FOR jw = 1 TO N
samp(jw) = (samp(jw) - mean) / stdev
REM PRINT USING "##.### "; samp(jw);
NEXT jw
REM phi calc.
FOR t = 1 TO N: zi = samp(t)
IF zi > 0 THEN kw = 0
IF zi <= 0 THEN kw = 1
zu = ABS(zi): s = c * zu: ante = c * zu
FOR ju = 0 TO 1000000
xx = ante * fng(ju, zu)
s = s + xx
ante = xx
IF ABS(xx) < .0005 THEN GOTO 20
NEXT ju
20 IF kw = 0 THEN FF = .5 + s
IF kw = 1 THEN FF = .5 - s
b = ABS(FF - F(t - 1))
bb = ABS(F(t) - FF)
major = b
IF bb > b THEN major = bb
IF major > mmajor THEN mmajor = major
NEXT t
IF mmajor > crit5 THEN outt5 = outt5 + 1 / all
IF mmajor > crit1 THEN outt1 = outt1 + 1 / all
NEXT sample
LOCATE 10, 40: COLOR 14: PRINT " POWER ";
PRINT USING "##.#### "; outt5; outt1
END



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.