MODEL Procedure

Testing for Normality

The NORMAL option in the FIT statement performs multivariate and univariate tests of normality.

The three multivariate tests provided are Mardia’s skewness test and kurtosis test (Mardia 1970) and the Henze-Zirkler upper T Subscript n comma beta test (Henze and Zirkler 1990). The two univariate tests provided are the Shapiro-Wilk W test and the Kolmogorov-Smirnov test. (For more information about the univariate tests, see the "Goodness-of-Fit Tests" section of the "The UNIVARIATE Procedure" chapter in the Base SAS Procedures Guide.) The null hypothesis for all these tests is that the residuals are normally distributed.

For a random sample upper X 1 comma ellipsis comma upper X Subscript n Baseline, upper X Subscript i Baseline element-of normal upper R Superscript d, where d is the dimension of upper X Subscript i and n is the number of observations, a measure of multivariate skewness is

b Subscript 1 comma d Baseline equals StartFraction 1 Over n squared EndFraction sigma-summation Underscript i equals 1 Overscript n Endscripts sigma-summation Underscript j equals 1 Overscript n Endscripts left-bracket left-parenthesis upper X Subscript i Baseline minus mu right-parenthesis prime bold upper S Superscript negative 1 Baseline left-parenthesis upper X Subscript j Baseline minus mu right-parenthesis right-bracket cubed

where S is the sample covariance matrix of X. For weighted regression, both S and left-parenthesis upper X Subscript i Baseline minus mu right-parenthesis are computed by using the weights supplied by the WEIGHT statement or the _WEIGHT_ variable.

Mardia showed that under the null hypothesis StartFraction n Over 6 EndFraction b Subscript 1 comma d is asymptotically distributed as chi squared left-parenthesis d left-parenthesis d plus 1 right-parenthesis left-parenthesis d plus 2 right-parenthesis slash 6 right-parenthesis. For small samples, Mardia’s skewness test statistic is calculated with a small sample correction formula, given by StartFraction n k Over 6 EndFraction b Subscript 1 comma d where the correction factor k is given by k equals left-parenthesis d plus 1 right-parenthesis left-parenthesis n plus 1 right-parenthesis left-parenthesis n plus 3 right-parenthesis slash n left-parenthesis left-parenthesis left-parenthesis n plus 1 right-parenthesis left-parenthesis d plus 1 right-parenthesis right-parenthesis minus 6 right-parenthesis. Mardia’s skewness test statistic in PROC MODEL uses this small sample corrected formula.

A measure of multivariate kurtosis is given by

b Subscript 2 comma d Baseline equals StartFraction 1 Over n EndFraction sigma-summation Underscript i equals 1 Overscript n Endscripts left-bracket left-parenthesis upper X Subscript i Baseline minus mu right-parenthesis Superscript prime Baseline bold upper S Superscript negative 1 Baseline left-parenthesis upper X Subscript i Baseline minus mu right-parenthesis right-bracket squared

Mardia showed that under the null hypothesis, b Subscript 2 comma d is asymptotically normally distributed with mean d left-parenthesis d plus 2 right-parenthesis and variance 8 d left-parenthesis d plus 2 right-parenthesis slash n.

The Henze-Zirkler test is based on a nonnegative functional upper D left-parenthesis period comma period right-parenthesis that measures the distance between two distribution functions and has the property that

upper D left-parenthesis normal upper N Subscript d Baseline left-parenthesis 0 comma upper I Subscript d Baseline right-parenthesis comma upper Q right-parenthesis equals 0

if and only if

upper Q equals normal upper N Subscript d Baseline left-parenthesis 0 comma upper I Subscript d Baseline right-parenthesis

where normal upper N Subscript d Baseline left-parenthesis mu comma normal upper Sigma Subscript d Baseline right-parenthesis is a d-dimensional normal distribution.

The distance measure upper D left-parenthesis period comma period right-parenthesis can be written as

upper D Subscript beta Baseline left-parenthesis upper P comma upper Q right-parenthesis equals integral Subscript normal upper R Superscript d Baseline Superscript Baseline StartAbsoluteValue ModifyingAbove upper P With caret left-parenthesis t right-parenthesis minus ModifyingAbove upper Q With caret left-parenthesis t right-parenthesis EndAbsoluteValue squared phi Subscript beta Baseline left-parenthesis t right-parenthesis d t

where ModifyingAbove upper P With caret left-parenthesis t right-parenthesis and ModifyingAbove upper Q With caret left-parenthesis t right-parenthesis are the Fourier transforms of P and Q, and phi Subscript beta Baseline left-parenthesis t right-parenthesis is a weight or a kernel function. The density of the normal distribution normal upper N Subscript d Baseline left-parenthesis 0 comma beta squared upper I Subscript d Baseline right-parenthesis is used as phi Subscript beta Baseline left-parenthesis t right-parenthesis

phi Subscript beta Baseline left-parenthesis t right-parenthesis equals left-parenthesis 2 pi beta squared right-parenthesis Superscript StartFraction negative d Over 2 EndFraction Baseline normal e normal x normal p left-parenthesis StartFraction minus StartAbsoluteValue t EndAbsoluteValue squared Over 2 beta squared EndFraction right-parenthesis comma t element-of normal upper R Superscript d

where StartAbsoluteValue t EndAbsoluteValue equals left-parenthesis t Superscript prime Baseline t right-parenthesis Superscript 0.5.

The parameter beta depends on n as

beta Subscript d Baseline left-parenthesis n right-parenthesis equals StartFraction 1 Over StartRoot 2 EndRoot EndFraction left-parenthesis StartFraction 2 d plus 1 Over 4 EndFraction right-parenthesis Superscript 1 slash left-parenthesis d plus 4 right-parenthesis Baseline n Superscript 1 slash left-parenthesis d plus 4 right-parenthesis

The test statistic computed is called upper T Subscript beta Baseline left-parenthesis d right-parenthesis and is approximately distributed as a lognormal. The lognormal distribution is used to compute the null hypothesis probability,

StartLayout 1st Row 1st Column upper T Subscript beta Baseline left-parenthesis d right-parenthesis equals 2nd Column StartFraction 1 Over n EndFraction 3rd Column sigma-summation Underscript j equals 1 Overscript n Endscripts sigma-summation Underscript k equals 1 Overscript n Endscripts exp left-parenthesis minus StartFraction beta squared Over 2 EndFraction StartAbsoluteValue upper Y Subscript j Baseline minus upper Y Subscript k Baseline EndAbsoluteValue squared right-parenthesis 2nd Row 1st Column Blank 2nd Column minus 3rd Column 2 left-parenthesis 1 plus beta squared right-parenthesis Superscript negative d slash 2 Baseline sigma-summation Underscript j equals 1 Overscript n Endscripts exp left-parenthesis minus StartFraction beta squared Over 2 left-parenthesis 1 plus beta squared right-parenthesis EndFraction StartAbsoluteValue upper Y Subscript j Baseline EndAbsoluteValue squared right-parenthesis plus n left-parenthesis 1 plus 2 beta squared right-parenthesis Superscript negative d slash 2 EndLayout

where

StartAbsoluteValue upper Y Subscript j Baseline minus upper Y Subscript k Baseline EndAbsoluteValue squared equals left-parenthesis upper X Subscript j Baseline minus upper X Subscript k Baseline right-parenthesis prime bold upper S Superscript negative 1 Baseline left-parenthesis upper X Subscript j Baseline minus upper X Subscript k Baseline right-parenthesis
StartAbsoluteValue upper Y Subscript j Baseline EndAbsoluteValue squared equals left-parenthesis upper X Subscript j Baseline minus upper X overbar right-parenthesis prime bold upper S Superscript negative 1 Baseline left-parenthesis upper X Subscript j Baseline minus upper X overbar right-parenthesis

Monte Carlo simulations suggest that upper T Subscript beta Baseline left-parenthesis d right-parenthesis has good power against distributions with heavy tails.

The Shapiro-Wilk W test is computed only when the number of observations (n) is less than 2,000, while computation of the Kolmogorov-Smirnov test statistic requires at least 2,000 observations.

The following is an example of the output produced by the NORMAL option:


proc model data=test2;
   y1 = a1 * x2 * x2 - exp( d1*x1);
   y2 = a2 * x1 * x1 + b2 * exp( d2*x2);
   fit y1 y2 / normal ;
run;

Figure 40: Normality Test Output

The MODEL Procedure

Normality Test
Equation Test Statistic Value Prob
y1 Shapiro-Wilk W 0.34 <.0001
y2 Shapiro-Wilk W 0.82 <.0001
System Mardia Skewness 286.4 <.0001
  Mardia Kurtosis 31.28 <.0001
  Henze-Zirkler T 6.65 <.0001


Last updated: June 19, 2025