Chapter 7: Tests of Goodness of Fit and Randomness

ADNRM

Performs an Anderson-Darling test for normality.

Required Arguments

X — Array of length NOBS containing the observations.   (Input)

A — Anderson-Darling statistic.   (Output)

Pp-value for a test of normality.   (Output)

Optional Arguments

NOBS — Number of observations.   (Input)  
NOBS must be greater than or equal to 3.
Default: NOBS = size (X).

NMISS — Number of missing observations.   (Output)

FORTRAN 90 Interface

Generic:                              CALL ADNRM (X, A, P [,…])

Specific:                             The specific interface names are S_ADNRM and D_ADNRM.

Description

Given a data sample {Xii=1 .. n}, where n = NOBS and  Xi = X(I), routine ADNRM computes the Anderson-Darling (AD) normality statistic A and the corresponding p-value P = {probability that a normally distributed n element sample would have an AD statistic  > A}.  If P is sufficiently small (e.g.  P  < .05),  then the AD test indicates that the null hypothesis that the data sample is normally-distributed should be rejected.  A is calculated as:

where  and and s are the sample mean and standard deviation respectively.  P is calculated by first transforming A to an “n-adjusted” statistic A*:

and then calculating P in terms of A* using a parabolic approximation taken from Table 4.9 in Stephens (1986).

Comments

Informational errors

Type Code

3         1                  The p-value has fallen below the minimum value for which its calculation has any accuracy; zero is returned.

4         1                  After removing the missing observations only n observations remain. The test cannot proceed.

Example

The following example is taken from Conover (1980, pages 364 and 195). The data consists of 50 two digit numbers taken from a telephone book. The AD test fails to reject the null hypothesis of normality at the .05 level of significance.

 

      USE ADNRM_INT

      USE UMACH_INT

      IMPLICIT NONE

     

      INTEGER, PARAMETER :: NOBS=50

      INTEGER NMISS, NOUT

      REAL P, A, X(NOBS)

 

      DATA X/ 23, 36, 54, 61, 73, 23, 37, 54, 61, 73, 24, 40, 56, 62,&

          74, 27, 42, 57, 63, 75, 29, 43, 57, 64, 77, 31, 43, 58, 65, &

          81, 32, 44, 58, 66, 87, 33, 45, 58, 68, 89, 33, 48, 58, 68, &

          93, 35, 48, 59, 70, 97/

 

      CALL ADNRM (X, A, P, NMISS=NMISS)

     

!                               Write out results

      CALL UMACH(2, NOUT)

      WRITE(NOUT,5) A, P, NMISS

    5 FORMAT(/ ' A     = ', F6.4 / ' P     = ', F6.4 / &

           ' NMISS = ',I3)

      END

 

Output

 

 A     = 0.3339

 P     = 0.5024

 NMISS =   0

 



http://www.vni.com/
PHONE: 713.784.3131
FAX:713.781.9260