CASE   STUDY 7

Plastic explosives detection.

Data Set: Training Set:  Pex23 training Testing Set:  Pex23 testing
 

The data comes from a study for the detection of plastic explosives in
suitcases using X-ray signals.

The 23 variables are the discrete xcomponents of the xray absorption spectrum.

The response is the last variable in the dataset. It takes two values:
 
 

Discriminant Analysis Examples




Suppose we have k distinct populations or groups and suppose we observe x from one of them and we wish to know which population came from.
 
 

Pop 
Pop2
. . .
Popk
Populations
p1
p2
. . .
pk
Pror Probs
m1, S1
m2, S2
. . .
mk, Sk
Pop params
 
 
 
 
 
Sample 1
Sample 2
. . .
Sample k
Sample
1, S1
2, S2,
. . .
k, Sk
sample 
estimators
L(x)1
L(x)2
. . .
L(x)k
Likelihood
p1 L(x)1
p2L(x)2
. . .
pkL(x)k
Posterior 
Probs
   2
  D (x|j) prop to -2 Log( pjLj(x))

   2         _   _       -1  _   _
  D (i|j) = (X - X )' COV   (X - X ) + ln |COV | - 2 ln prior
              i   j      j    i   j           j              j

The posterior probabilities are

                        2                    2
     Pr(j|X) = exp(-.5 D (X)) / SUM exp(-.5 D (X))
                        j        k           k
 

data crops;
   title 'Discriminant Analysis of
Remote Sensing Data on Five Crops';
   input crop $ 1-10 x1-x4 xvalues $ 11-21;
   cards;
CORN      16 27 31 33
CORN      15 23 30 30
CORN      16 27 27 26
CORN      18 20 25 23
CORN      15 15 31 32
CORN      15 32 32 15
CORN      12 15 16 73
SOYBEANS  20 23 23 25
SOYBEANS  24 24 25 32
SOYBEANS  21 25 23 24
SOYBEANS  27 45 24 12
SOYBEANS  12 13 15 42
SOYBEANS  22 32 31 43
COTTON    31 32 33 34
COTTON    29 24 26 28
COTTON    34 32 28 45
COTTON    26 25 23 24
COTTON    53 48 75 26
COTTON    34 35 25 78
SUGARBEETS22 23 25 42
SUGARBEETS25 25 24 26
SUGARBEETS34 25 16 52
SUGARBEETS54 23 21 54
SUGARBEETS25 43 32 15
SUGARBEETS26 54  2 54
CLOVER    12 45 32 54
CLOVER    24 58 25 34
CLOVER    87 54 61 21
CLOVER    51 31 31 16
CLOVER    96 48 54 62
CLOVER    31 31 11 11
CLOVER    56 13 13 71
CLOVER    32 13 27 32
CLOVER    36 26 54 32
CLOVER    53 08 06 54
CLOVER    32 32 62 16
;

proc discrim data=crops
             method=normal pool=no
             crossvalidate;
   class crop;
   priors prop;
   id xvalues;
   var x1-x4;
   title2 'Using Quadratic Discriminant Function';
run;
 
 

OUTPUT

                     Discriminant Analysis

           36 Observations        35 DF Total
            4 Variables           31 DF Within Classes
            5 Classes              4 DF Between Classes
 

                    Class Level Information

                                                         Prior
 CROP         Frequency      Weight   Proportion   Probability

 CLOVER              11     11.0000     0.305556      0.305556
 CORN                 7      7.0000     0.194444      0.194444
 COTTON               6      6.0000     0.166667      0.166667
 SOYBEANS             6      6.0000     0.166667      0.166667
 SUGARBEETS           6      6.0000     0.166667      0.166667

               Covariance      Natural Log of the Determinant
 CROP           Matrix Rank        of the Covariance Matrix

 CLOVER               4                     23.64618
 CORN                 4                     11.13472
 COTTON               4                     13.23569
 SOYBEANS             4                     12.45263
 SUGARBEETS           4                     17.76293
 

     Pairwise Generalized Squared Distances Between Groups

   2         _   _       -1  _   _
  D (i|j) = (X - X )' COV   (X - X ) + ln |COV | - 2 ln PRIOR
              i   j      j    i   j           j              j

              Generalized Squared Distance to CROP

 From CROP        CLOVER         CORN       COTTON     SOYBEANS

 CLOVER         26.01743         1320    104.18297    194.10546
 CORN           27.73809     14.40994    150.50763     38.36252
 COTTON         26.38544    588.86232     16.81921     52.03266
 SOYBEANS       27.07134     46.42131     41.01631     16.03615
 SUGARBEETS     26.80188    332.11563     43.98280    107.95676
 

              Generalized Squared Distance to CROP

 From CROP    SUGARBEETS

 CLOVER         31.40816
 CORN           25.55421
 COTTON         37.15560
 SOYBEANS       23.15920
 SUGARBEETS     21.34645
 

    Classification Summary for Calibration Data: WORK.CROPS

  Resubstitution Summary using Quadratic Discriminant Function

     Generalized Squared Distance Function:

      2         _       -1   _
     D (X) = (X-X )' COV  (X-X ) + ln |COV | - 2 ln PRIOR
      j          j      j     j           j              j

     Posterior Probability of Membership in each CROP:

                        2                    2
     Pr(j|X) = exp(-.5 D (X)) / SUM exp(-.5 D (X))
                        j        k           k

       Number of Observations and Percent Classified into CROP:

From CROP                CLOVER            CORN          COTTON

     CLOVER                   9               0               0
                          81.82            0.00            0.00

     CORN                     0               7               0
                           0.00          100.00            0.00

     COTTON                   0               0               6
                           0.00            0.00          100.00

     SOYBEANS                 0               0               0
                           0.00            0.00            0.00

     SUGARBEETS               0               0               1
                           0.00            0.00           16.67

     Total                    9               7               7
     Percent              25.00           19.44           19.44

     Priors              0.3056          0.1944          0.1667

   Classification Summary for Calibration Data: WORK.CROPS

  Resubstitution Summary using Quadratic Discriminant Function

       Number of Observations and Percent Classified into CROP:

From CROP              SOYBEANS      SUGARBEETS           Total

     CLOVER                   0               2              11
                           0.00           18.18          100.00

     CORN                     0               0               7
                           0.00            0.00          100.00

     COTTON                   0               0               6
                           0.00            0.00          100.00

     SOYBEANS                 6               0               6
                         100.00            0.00          100.00

     SUGARBEETS               1               4               6
                          16.67           66.67          100.00

     Total                    7               6              36
     Percent              19.44           16.67          100.00

     Priors              0.1667          0.1667
 

        Error Count Estimates for CROP:

          CLOVER     CORN   COTTON SOYBEANS SUGARBEETS    Total

 Rate     0.1818   0.0000   0.0000   0.0000     0.3333   0.1111

 Priors   0.3056   0.1944   0.1667   0.1667     0.1667
;