Hi everybody
I am using a very simple dataset (serum Fe levels with an automatic
analyzer) to explain the concept of randomness and runs test:
DATA LIST FREE /Fe (F8.2).
BEGIN DATA
2.6 2.4 2.7 3.2 3.4 3.5 3.2 3.6 3.4 3.5
END DATA.
If I run the test using as cut-off the median, the test is non
significant. If I use the mean, the result is significant.
NPAR TESTS
/RUNS(MEDIAN)=Fe
/RUNS(MEAN)=Fe
/METHOD=EXACT TIMER(5).
Moreover, using Hart's (*) modification of the mean square successive
difference test (assumes normally distributed variables), the result is
also significant. Since I know the question my students will ask is:
which cut-point is better, mean or median? I'm trying to get an answer
before the class. Suggestions and comments are welcome and very
appreciated..
(*) Ref:
http://books.google.es/books?id=kZ5NoA2BwjEC&pg=PA212&dq=test+de+hart+aleatoriedad+luna+del+castillo#v=onepage&q=&f=false* Macro for Hart's randomness test *.
DEFINE HART(!POS !TOKENS(1)).
MATRIX.
PRINT/TITLE='HART (mean square successive difference) TEST'.
GET X /VAR=!1 /NAME=vname /MISSING=OMIT.
COMPUTE N=NROW(x).
COMPUTE Diff2=MAKE(N-1,1,0).
LOOP i=1 TO N-1.
. COMPUTE Diff2(i)=(x(i)-x(i+1))**2.
END LOOP.
COMPUTE SC=CSSQ(x)-(CSUM(x))**2/N.
COMPUTE H=CSUM(Diff2)/SC.
COMPUTE Sigma=2*SQRT((n-2)/(n**2-1)).
COMPUTE ZValue=(H-2)/Sigma.
COMPUTE PValue=1-CDFNORM(ABS(ZValue)).
PRINT {H,ZValue,PValue,2*PValue}
/FORMAT='F8.3'
/CLABEL='H','Z','1-tail P','2-tail P'
/RNAME=vname
/TITLE='Statistics'.
END MATRIX.
!ENDDEFINE.
HART Fe.
Best regards,
Marta GG
--
For miscellaneous SPSS related statistical stuff, visit:
http://gjyp.nl/marta/=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD