CVMNRM
Performs a Cramer‑von Mises test for normality.
Required Arguments
X — Array of length NOBS containing the observations. (Input)
W — Cramer‑von Mises statistic. (Output)
P — p‑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 CVMNRM (X, W, P [, …])
Specific: The specific interface names are S_CVMNRM and D_CVMNRM.
Description
Given a data sample {Xi, i=1 .. n}, where n = NOBS and Xi = X(I), routine CVMNRM computes the Cramer‑von Mises (CvM) normality statistic W and the corresponding p‑value P = {probability that a normally distributed n element sample would have a CvM statistic > W}. If P is sufficiently small (e.g. P < .05), then the CvM test indicates that the null hypothesis that the data sample is normally‑distributed should be rejected. W is calculated as:
where is the cumulative distribution function of standard normal N(0,1) distribution, , and and s are the sample mean and standard deviation respectively. P is calculated by first transforming W to an “n‑adjusted” statistic W*:
and then calculating P in terms of W* using a parabolic approximation taken from Table 4.9 in Stephens (1986).
Comments
Informational errors
Type |
Code |
Description |
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 CvM test fails to reject the null hypothesis of normality at the .05 level of significance.
USE CVMNRM_INT
USE UMACH_INT
IMPLICIT NONE
INTEGER, PARAMETER :: NOBS=50
INTEGER NMISS, NOUT
REAL P, W, 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 CVMNRM (X, W, P, NMISS=NMISS)
! Write out results
CALL UMACH(2, NOUT)
WRITE(NOUT,5) W, P, NMISS
5 FORMAT(/ ' W = ', F6.4 / ' P = ', F6.4 / &
' NMISS = ',I3)
END
Output
W = 0.0520
P = 0.4747
NMISS = 0