Example 31.3 Normal-Theory Discriminant Analysis of Iris Data
In this example, PROC DISCRIM uses normal-theory methods to classify the iris data used in Example 31.1. The POOL=TEST option tests the homogeneity of the within-group covariance matrices (Output 31.3.3). Since the resulting test statistic is significant at the 0.10 level, the within-group covariance matrices are used to derive the quadratic discriminant criterion. The WCOV and PCOV options display the within-group covariance matrices and the pooled covariance matrix (Output 31.3.2). The DISTANCE option displays squared distances between classes (Output 31.3.4). The ANOVA and MANOVA options test the hypothesis that the class means are equal, by using univariate statistics and multivariate statistics; all statistics are significant at the 0.0001 level (Output 31.3.5). The LISTERR option lists the misclassified observations under resubstitution (Output 31.3.6). The CROSSLISTERR option lists the observations that are misclassified under cross validation and displays cross validation error-rate estimates (Output 31.3.7). The resubstitution error count estimate, 0.02, is not larger than the cross validation error count estimate, 0.0267, as would be expected because the resubstitution estimate is optimistically biased. The OUTSTAT= option generates a TYPE=MIXED (because POOL=TEST) output data set containing various statistics such as means, covariances, and coefficients of the discriminant function (Output 31.3.8).
The following statements produce Output 31.3.1 through Output 31.3.8:
title 'Discriminant Analysis of Fisher (1936) Iris Data';
title2 'Using Quadratic Discriminant Function';
proc discrim data=iris outstat=irisstat
wcov pcov method=normal pool=test
distance anova manova listerr crosslisterr;
class Species;
var SepalLength SepalWidth PetalLength PetalWidth;
run;
proc print data=irisstat;
title2 'Output Discriminant Statistics';
run;
Output 31.3.1
Quadratic Discriminant Analysis of Iris Data
Setosa |
50 |
50.0000 |
0.333333 |
0.333333 |
Versicolor |
50 |
50.0000 |
0.333333 |
0.333333 |
Virginica |
50 |
50.0000 |
0.333333 |
0.333333 |
Output 31.3.2
Covariance Matrices
The DISCRIM Procedure
Within-Class Covariance Matrices
Sepal Length in mm. |
12.42489796 |
9.92163265 |
1.63551020 |
1.03306122 |
Sepal Width in mm. |
9.92163265 |
14.36897959 |
1.16979592 |
0.92979592 |
Petal Length in mm. |
1.63551020 |
1.16979592 |
3.01591837 |
0.60693878 |
Petal Width in mm. |
1.03306122 |
0.92979592 |
0.60693878 |
1.11061224 |
Sepal Length in mm. |
26.64326531 |
8.51836735 |
18.28979592 |
5.57795918 |
Sepal Width in mm. |
8.51836735 |
9.84693878 |
8.26530612 |
4.12040816 |
Petal Length in mm. |
18.28979592 |
8.26530612 |
22.08163265 |
7.31020408 |
Petal Width in mm. |
5.57795918 |
4.12040816 |
7.31020408 |
3.91061224 |
Sepal Length in mm. |
40.43428571 |
9.37632653 |
30.32897959 |
4.90938776 |
Sepal Width in mm. |
9.37632653 |
10.40040816 |
7.13795918 |
4.76285714 |
Petal Length in mm. |
30.32897959 |
7.13795918 |
30.45877551 |
4.88244898 |
Petal Width in mm. |
4.90938776 |
4.76285714 |
4.88244898 |
7.54326531 |
The DISCRIM Procedure
Sepal Length in mm. |
26.50081633 |
9.27210884 |
16.75142857 |
3.84013605 |
Sepal Width in mm. |
9.27210884 |
11.53877551 |
5.52435374 |
3.27102041 |
Petal Length in mm. |
16.75142857 |
5.52435374 |
18.51877551 |
4.26653061 |
Petal Width in mm. |
3.84013605 |
3.27102041 |
4.26653061 |
4.18816327 |
4 |
5.35332 |
4 |
7.54636 |
4 |
9.49362 |
4 |
8.46214 |
Output 31.3.3
Homogeneity Test
The DISCRIM Procedure
Test of Homogeneity of Within Covariance Matrices
Since the Chi-Square value is significant at the 0.1 level, the within covariance matrices will be used in the discriminant function.
Reference: Morrison, D.F. (1976) Multivariate Statistical Methods p252.
Output 31.3.4
Squared Distances
The DISCRIM Procedure
0 |
103.19382 |
168.76759 |
323.06203 |
0 |
13.83875 |
706.08494 |
17.86670 |
0 |
5.35332 |
110.74017 |
178.26121 |
328.41535 |
7.54636 |
23.33238 |
711.43826 |
25.41306 |
9.49362 |
Output 31.3.5
Tests of Equal Class Means
The DISCRIM Procedure
Sepal Length in mm. |
8.2807 |
5.1479 |
7.9506 |
0.6187 |
1.6226 |
119.26 |
<.0001 |
Sepal Width in mm. |
4.3587 |
3.3969 |
3.3682 |
0.4008 |
0.6688 |
49.16 |
<.0001 |
Petal Length in mm. |
17.6530 |
4.3033 |
20.9070 |
0.9414 |
16.0566 |
1180.16 |
<.0001 |
Petal Width in mm. |
7.6224 |
2.0465 |
8.9673 |
0.9289 |
13.0613 |
960.01 |
<.0001 |
0.02343863 |
199.15 |
8 |
288 |
<.0001 |
1.19189883 |
53.47 |
8 |
290 |
<.0001 |
32.47732024 |
582.20 |
8 |
203.4 |
<.0001 |
32.19192920 |
1166.96 |
4 |
145 |
<.0001 |
Output 31.3.6
Misclassified Observations: Resubstitution
The DISCRIM Procedure
Classification Results for Calibration Data: WORK.IRIS
Resubstitution Results using Quadratic Discriminant Function
* |
0.0000 |
0.6050 |
0.3950 |
* |
0.0000 |
0.3359 |
0.6641 |
* |
0.0000 |
0.1543 |
0.8457 |
* Misclassified observation
The DISCRIM Procedure
Classification Summary for Calibration Data: WORK.IRIS
Resubstitution Summary using Quadratic Discriminant Function
0.0000 |
0.0400 |
0.0200 |
0.0200 |
0.3333 |
0.3333 |
0.3333 |
|
Output 31.3.7
Misclassified Observations: Cross Validation
The DISCRIM Procedure
Classification Results for Calibration Data: WORK.IRIS
Cross-validation Results using Quadratic Discriminant Function
* |
0.0000 |
0.6632 |
0.3368 |
* |
0.0000 |
0.3134 |
0.6866 |
* |
0.0000 |
0.1616 |
0.8384 |
* |
0.0000 |
0.0713 |
0.9287 |
* Misclassified observation
The DISCRIM Procedure
Classification Summary for Calibration Data: WORK.IRIS
Cross-validation Summary using Quadratic Discriminant Function
0.0000 |
0.0600 |
0.0200 |
0.0267 |
0.3333 |
0.3333 |
0.3333 |
|
Output 31.3.8
Output Statistics from Iris Data
. |
N |
|
150.00 |
150.00 |
150.00 |
150.00 |
Setosa |
N |
|
50.00 |
50.00 |
50.00 |
50.00 |
Versicolor |
N |
|
50.00 |
50.00 |
50.00 |
50.00 |
Virginica |
N |
|
50.00 |
50.00 |
50.00 |
50.00 |
. |
MEAN |
|
58.43 |
30.57 |
37.58 |
11.99 |
Setosa |
MEAN |
|
50.06 |
34.28 |
14.62 |
2.46 |
Versicolor |
MEAN |
|
59.36 |
27.70 |
42.60 |
13.26 |
Virginica |
MEAN |
|
65.88 |
29.74 |
55.52 |
20.26 |
Setosa |
PRIOR |
|
0.33 |
0.33 |
0.33 |
0.33 |
Versicolor |
PRIOR |
|
0.33 |
0.33 |
0.33 |
0.33 |
Virginica |
PRIOR |
|
0.33 |
0.33 |
0.33 |
0.33 |
Setosa |
CSSCP |
SepalLength |
608.82 |
486.16 |
80.14 |
50.62 |
Setosa |
CSSCP |
SepalWidth |
486.16 |
704.08 |
57.32 |
45.56 |
Setosa |
CSSCP |
PetalLength |
80.14 |
57.32 |
147.78 |
29.74 |
Setosa |
CSSCP |
PetalWidth |
50.62 |
45.56 |
29.74 |
54.42 |
Versicolor |
CSSCP |
SepalLength |
1305.52 |
417.40 |
896.20 |
273.32 |
Versicolor |
CSSCP |
SepalWidth |
417.40 |
482.50 |
405.00 |
201.90 |
Versicolor |
CSSCP |
PetalLength |
896.20 |
405.00 |
1082.00 |
358.20 |
Versicolor |
CSSCP |
PetalWidth |
273.32 |
201.90 |
358.20 |
191.62 |
Virginica |
CSSCP |
SepalLength |
1981.28 |
459.44 |
1486.12 |
240.56 |
Virginica |
CSSCP |
SepalWidth |
459.44 |
509.62 |
349.76 |
233.38 |
Virginica |
CSSCP |
PetalLength |
1486.12 |
349.76 |
1492.48 |
239.24 |
Virginica |
CSSCP |
PetalWidth |
240.56 |
233.38 |
239.24 |
369.62 |
. |
PSSCP |
SepalLength |
3895.62 |
1363.00 |
2462.46 |
564.50 |
. |
PSSCP |
SepalWidth |
1363.00 |
1696.20 |
812.08 |
480.84 |
. |
PSSCP |
PetalLength |
2462.46 |
812.08 |
2722.26 |
627.18 |
. |
PSSCP |
PetalWidth |
564.50 |
480.84 |
627.18 |
615.66 |
. |
BSSCP |
SepalLength |
6321.21 |
-1995.27 |
16524.84 |
7127.93 |
. |
BSSCP |
SepalWidth |
-1995.27 |
1134.49 |
-5723.96 |
-2293.27 |
. |
BSSCP |
PetalLength |
16524.84 |
-5723.96 |
43710.28 |
18677.40 |
. |
BSSCP |
PetalWidth |
7127.93 |
-2293.27 |
18677.40 |
8041.33 |
. |
CSSCP |
SepalLength |
10216.83 |
-632.27 |
18987.30 |
7692.43 |
. |
CSSCP |
SepalWidth |
-632.27 |
2830.69 |
-4911.88 |
-1812.43 |
. |
CSSCP |
PetalLength |
18987.30 |
-4911.88 |
46432.54 |
19304.58 |
. |
CSSCP |
PetalWidth |
7692.43 |
-1812.43 |
19304.58 |
8656.99 |
. |
RSQUARED |
|
0.62 |
0.40 |
0.94 |
0.93 |
Setosa |
COV |
SepalLength |
12.42 |
9.92 |
1.64 |
1.03 |
Setosa |
COV |
SepalWidth |
9.92 |
14.37 |
1.17 |
0.93 |
Setosa |
COV |
PetalLength |
1.64 |
1.17 |
3.02 |
0.61 |
Setosa |
COV |
PetalWidth |
1.03 |
0.93 |
0.61 |
1.11 |
Versicolor |
COV |
SepalLength |
26.64 |
8.52 |
18.29 |
5.58 |
Versicolor |
COV |
SepalWidth |
8.52 |
9.85 |
8.27 |
4.12 |
Versicolor |
COV |
PetalLength |
18.29 |
8.27 |
22.08 |
7.31 |
Versicolor |
COV |
PetalWidth |
5.58 |
4.12 |
7.31 |
3.91 |
Virginica |
COV |
SepalLength |
40.43 |
9.38 |
30.33 |
4.91 |
Virginica |
COV |
SepalWidth |
9.38 |
10.40 |
7.14 |
4.76 |
Virginica |
COV |
PetalLength |
30.33 |
7.14 |
30.46 |
4.88 |
Virginica |
COV |
PetalWidth |
4.91 |
4.76 |
4.88 |
7.54 |
. |
PCOV |
SepalLength |
26.501 |
9.2721 |
16.751 |
3.840 |
. |
PCOV |
SepalWidth |
9.272 |
11.5388 |
5.524 |
3.271 |
. |
PCOV |
PetalLength |
16.751 |
5.5244 |
18.519 |
4.267 |
. |
PCOV |
PetalWidth |
3.840 |
3.2710 |
4.267 |
4.188 |
. |
BCOV |
SepalLength |
63.212 |
-19.9527 |
165.248 |
71.279 |
. |
BCOV |
SepalWidth |
-19.953 |
11.3449 |
-57.240 |
-22.933 |
. |
BCOV |
PetalLength |
165.248 |
-57.2396 |
437.103 |
186.774 |
. |
BCOV |
PetalWidth |
71.279 |
-22.9327 |
186.774 |
80.413 |
. |
COV |
SepalLength |
68.569 |
-4.2434 |
127.432 |
51.627 |
. |
COV |
SepalWidth |
-4.243 |
18.9979 |
-32.966 |
-12.164 |
. |
COV |
PetalLength |
127.432 |
-32.9656 |
311.628 |
129.561 |
. |
COV |
PetalWidth |
51.627 |
-12.1639 |
129.561 |
58.101 |
Setosa |
STD |
|
3.525 |
3.7906 |
1.737 |
1.054 |
Versicolor |
STD |
|
5.162 |
3.1380 |
4.699 |
1.978 |
Virginica |
STD |
|
6.359 |
3.2250 |
5.519 |
2.747 |
. |
PSTD |
|
5.148 |
3.3969 |
4.303 |
2.047 |
. |
BSTD |
|
7.951 |
3.3682 |
20.907 |
8.967 |
. |
STD |
|
8.281 |
4.3587 |
17.653 |
7.622 |
Setosa |
CORR |
SepalLength |
1.000 |
0.7425 |
0.267 |
0.278 |
Setosa |
CORR |
SepalWidth |
0.743 |
1.0000 |
0.178 |
0.233 |
Setosa |
CORR |
PetalLength |
0.267 |
0.1777 |
1.000 |
0.332 |
Setosa |
CORR |
PetalWidth |
0.278 |
0.2328 |
0.332 |
1.000 |
Versicolor |
CORR |
SepalLength |
1.000 |
0.5259 |
0.754 |
0.546 |
Versicolor |
CORR |
SepalWidth |
0.526 |
1.0000 |
0.561 |
0.664 |
Versicolor |
CORR |
PetalLength |
0.754 |
0.5605 |
1.000 |
0.787 |
Versicolor |
CORR |
PetalWidth |
0.546 |
0.6640 |
0.787 |
1.000 |
Virginica |
CORR |
SepalLength |
1.000 |
0.4572 |
0.864 |
0.281 |
Virginica |
CORR |
SepalWidth |
0.457 |
1.0000 |
0.401 |
0.538 |
Virginica |
CORR |
PetalLength |
0.864 |
0.4010 |
1.000 |
0.322 |
Virginica |
CORR |
PetalWidth |
0.281 |
0.5377 |
0.322 |
1.000 |
. |
PCORR |
SepalLength |
1.000 |
0.5302 |
0.756 |
0.365 |
. |
PCORR |
SepalWidth |
0.530 |
1.0000 |
0.378 |
0.471 |
. |
PCORR |
PetalLength |
0.756 |
0.3779 |
1.000 |
0.484 |
. |
PCORR |
PetalWidth |
0.365 |
0.4705 |
0.484 |
1.000 |
. |
BCORR |
SepalLength |
1.000 |
-0.7451 |
0.994 |
1.000 |
. |
BCORR |
SepalWidth |
-0.745 |
1.0000 |
-0.813 |
-0.759 |
. |
BCORR |
PetalLength |
0.994 |
-0.8128 |
1.000 |
0.996 |
. |
BCORR |
PetalWidth |
1.000 |
-0.7593 |
0.996 |
1.000 |
. |
CORR |
SepalLength |
1.000 |
-0.1176 |
0.872 |
0.818 |
. |
CORR |
SepalWidth |
-0.118 |
1.0000 |
-0.428 |
-0.366 |
. |
CORR |
PetalLength |
0.872 |
-0.4284 |
1.000 |
0.963 |
. |
CORR |
PetalWidth |
0.818 |
-0.3661 |
0.963 |
1.000 |
Setosa |
STDMEAN |
|
-1.011 |
0.8504 |
-1.301 |
-1.251 |
Versicolor |
STDMEAN |
|
0.112 |
-0.6592 |
0.284 |
0.166 |
Virginica |
STDMEAN |
|
0.899 |
-0.1912 |
1.016 |
1.085 |
Setosa |
PSTDMEAN |
|
-1.627 |
1.0912 |
-5.335 |
-4.658 |
Versicolor |
PSTDMEAN |
|
0.180 |
-0.8459 |
1.167 |
0.619 |
Virginica |
PSTDMEAN |
|
1.447 |
-0.2453 |
4.169 |
4.039 |
. |
LNDETERM |
|
8.462 |
8.462 |
8.462 |
8.462 |
Setosa |
LNDETERM |
|
5.353 |
5.353 |
5.353 |
5.353 |
Versicolor |
LNDETERM |
|
7.546 |
7.546 |
7.546 |
7.546 |
Virginica |
LNDETERM |
|
9.494 |
9.494 |
9.494 |
9.494 |
Setosa |
QUAD |
SepalLength |
-0.095 |
0.062 |
0.023 |
0.024 |
Setosa |
QUAD |
SepalWidth |
0.062 |
-0.078 |
-0.006 |
0.011 |
Setosa |
QUAD |
PetalLength |
0.023 |
-0.006 |
-0.194 |
0.090 |
Setosa |
QUAD |
PetalWidth |
0.024 |
0.011 |
0.090 |
-0.530 |
Setosa |
QUAD |
_LINEAR_ |
4.455 |
-0.762 |
3.356 |
-3.126 |
Setosa |
QUAD |
_CONST_ |
-121.826 |
-121.826 |
-121.826 |
-121.826 |
Versicolor |
QUAD |
SepalLength |
-0.048 |
0.018 |
0.043 |
-0.032 |
Versicolor |
QUAD |
SepalWidth |
0.018 |
-0.099 |
-0.011 |
0.097 |
Versicolor |
QUAD |
PetalLength |
0.043 |
-0.011 |
-0.099 |
0.135 |
Versicolor |
QUAD |
PetalWidth |
-0.032 |
0.097 |
0.135 |
-0.436 |
Versicolor |
QUAD |
_LINEAR_ |
1.801 |
1.596 |
0.327 |
-1.471 |
Versicolor |
QUAD |
_CONST_ |
-76.549 |
-76.549 |
-76.549 |
-76.549 |
Virginica |
QUAD |
SepalLength |
-0.053 |
0.017 |
0.050 |
-0.009 |
Virginica |
QUAD |
SepalWidth |
0.017 |
-0.079 |
-0.006 |
0.042 |
Virginica |
QUAD |
PetalLength |
0.050 |
-0.006 |
-0.067 |
0.014 |
Virginica |
QUAD |
PetalWidth |
-0.009 |
0.042 |
0.014 |
-0.097 |
Virginica |
QUAD |
_LINEAR_ |
0.737 |
1.325 |
0.623 |
0.966 |
Virginica |
QUAD |
_CONST_ |
-75.821 |
-75.821 |
-75.821 |
-75.821 |
Copyright © SAS Institute, Inc. All Rights Reserved.