PROCEDURE ROBSKEW MYSERIES NBEG NEND QS

* GIVEN A SAMPLE FROM A UNIVARIATE DISTRIBUTION, ROBSKEW
* COMPUTES THE QUARTILE SKEWNESS (QS), A ROBUST MEASURE OF
* ASYMMETRY. CLASSICAL SKEWNESS MEASURES (INCLUDING THOSE
* REPORTED BY THE RATS COMMAND 'STATISTICS') ARE BASED ON
* THE SAMPLE MOMENTS AND ARE THEREFORE QUITE VULNERABLE TO
* OUTLIERS. A FEW ANOMALOUS OBSERVATIONS CAN MAKE A SYMMETRIC
* DISTRIBUTION LOOK SKEW OR VICE VERSA. QS IS LESS AFFECTED
* BY CONTAMINATED DATA. IT HAS THE FOLLOWING PROPERTIES:
*
*	(1) -1 <= QS <= 1 (A NEGATIVE QS INDICATES A LONGER
*	    LEFT TAIL, WHILE A POSITIVE QS INDICATES A LONGER
*	    RIGHT TAIL);
*	(2) QS IS LOCATION AND SCALE INVARIANT;
*	(3) QS HAS A 25-PERCENT BREAKDOWN POINT (IT CAN RESIST GROSS
*	    ERRORS IN AS MUCH AS ONE FOURTH OF THE DATA);
*	(4) FOR A SAMPLE OF SIZE N FROM A STANDARD NORMAL DISTRIBUTION,
*	    QS IS NORMALLY DISTRIBUTED WITH MEAN = 0 AND
*	    STANDARD DEVIATION = 1.36/SQRT(N) IF N IS LARGE, SO IT
*	    IS STRAIGHTFORWARD TO TEST THE SYMMETRY HYPOTHESIS
*	    QS = 0 IN LARGE GAUSSIAN SAMPLES.
*
* MYSERIES IS THE SAMPLE FOR WHICH QS IS TO BE COMPUTED. THE
* FIRST OBSERVATION IS NBEG AND THE LAST IS NEND. ROBSKEW COMPUTES
* AND RETURNS QS.
*
TYPE SERIES MYSERIES
TYPE INTEGER NBEG NEND
TYPE REAL *QS
LOCAL REAL NUM DEN
STATISTICS(NOMOMENTS,FRACTILES,NOPRINT) MYSERIES NBEG NEND
COMPUTE NUM = (%FRACT75-%MEDIAN) - (%MEDIAN-%FRACT25)
COMPUTE DEN = %FRACT75 - %FRACT25
COMPUTE QS = NUM/DEN
END ROBSKEW


