/* SAS Example 4c: Discriminant Analysis on HATCO data */ /* Dependent Variable: X11 */ /* Independent Variables: Factor Scores of Value and Image */ OPTIONS PS=52; OPTIONS LS=78; OPTIONS NODATE; OPTIONS PAGENO=1; DATA PERCEPTION; INFILE 'A:/HATCO_SET.PRN'; INPUT X1-X14; LABEL X1 = 'Delivery Speed'; LABEL X2 = 'Price Level'; LABEL X3 = 'Price Flexibility'; LABEL X4 = 'Manufacturer Image'; LABEL X5 = 'Service'; LABEL X6 = 'Salesforce Image'; LABEL X7 = 'Product Quality'; LABEL X8 = 'Firm Size'; LABEL X9 = 'Usage Level'; LABEL X10 = 'Satisfaction Level'; LABEL X11 = 'Specification Buying'; LABEL X12 = 'Structure of Procurement'; LABEL X13 = 'Type of Industry'; LABEL X14 = 'Type of Buying Situation'; RUN; /* If you recall our initial run of the factor analysis program on the HATCO dataset, we excluded X5 from the solution. We obtain our solution for the other six perception variables as follows. */ PROC FACTOR CORR MSA SCREE ROTATE = VARIMAX; TITLE 'Factor Analysis on remaining six HATCO Perception Variables'; VAR X1-X4 X6 X7; RUN; /* We will first perform a discriminant analysis on the analysis sample, after constructing factor scores. We should also examine X5, which was not part of our factor solution, but may add something to our discriminating function. */ DATA PERCEPTION; INFILE 'A:/HATCO2.TXT'; INPUT X1-X14; LABEL X1 = 'Delivery Speed'; LABEL X2 = 'Price Level'; LABEL X3 = 'Price Flexibility'; LABEL X4 = 'Manufacturer Image'; LABEL X5 = 'Service'; LABEL X6 = 'Salesforce Image'; LABEL X7 = 'Product Quality'; LABEL X8 = 'Firm Size'; LABEL X9 = 'Usage Level'; LABEL X10 = 'Satisfaction Level'; LABEL X11 = 'Specification Buying'; LABEL X12 = 'Structure of Procurement'; LABEL X13 = 'Type of Industry'; LABEL X14 = 'Type of Buying Situation'; X2T = 10 - X2; X3T = 10 - X3; X4T = 10 - X4; X6T = 10 - X6; X7T = 10 - X7; V1 = (0.78736*X1 + 0.71388*X2T + 0.80351*X3 + 0.10206*X4T + 0.02537*X6T + 0.76393*X7T)/3.19611; V2 = (0.19414*X1 + 0.26557*X2 + 0.01058*X3T + 0.93334*X4 + 0.933364*X6 + 0.17900*X7)/2.51627; RUN; PROC SORT; BY X11; RUN; PROC MEANS; TITLE "Examination of Differences in Group Means"; CLASS X11; VAR V1 V2 X5; RUN; PROC GLM; CLASS X11; MODEL V1 V2 X5=X11; RUN; /* We will perform the discriminant analysis on the classification variable X11, using explanatory variable V1. This choice of explanatory variables was the result of a performing a stepwise search procedure (by hand). The PRIORS PROPORTIONAL statement sets the probabilities of group membership proportional to the sample sizes */ PROC DISCRIM METHOD=NORMAL POOL=YES MANOVA LIST; TITLE "Discriminant Analysis on Factor Scores for Analysis Sample"; CLASS X11; PRIORS PROPORTIONAL; VAR V1; RUN; /* We will now check our classification functions on our holdout sample. */ DATA HOLDOUT; INFILE 'A:/HATCO3.TXT'; INPUT X1-X14; LABEL X1 = 'Delivery Speed'; LABEL X2 = 'Price Level'; LABEL X3 = 'Price Flexibility'; LABEL X4 = 'Manufacturer Image'; LABEL X5 = 'Service'; LABEL X6 = 'Salesforce Image'; LABEL X7 = 'Product Quality'; LABEL X8 = 'Firm Size'; LABEL X9 = 'Usage Level'; LABEL X10 = 'Satisfaction Level'; LABEL X11 = 'Specification Buying'; LABEL X12 = 'Structure of Procurement'; LABEL X13 = 'Type of Industry'; LABEL X14 = 'Type of Buying Situation'; X2T = 10 - X2; X3T = 10 - X3; X4T = 10 - X4; X6T = 10 - X6; X7T = 10 - X7; V1 = (0.78736*X1 + 0.71388*X2T + 0.80351*X3 + 0.10206*X4T + 0.02537*X6T + 0.76393*X7T)/3.19611; V2 = (0.19414*X1 + 0.26557*X2 + 0.01058*X3T + 0.93334*X4 + 0.933364*X6 + 0.17900*X7)/2.51627; Z0 = -31.46279 + 13.46742*V1; Z1 = -59.18577 + 18.64814*V1; IF Z0 > Z1 THEN Z = 0; IF Z1 > Z0 THEN Z = 1; RUN; /* This PROC PRINT will allow us to examine any misclassifications */ PROC PRINT; TITLE "Discriminant Analysis on Factor Scores for Holdout Sample"; VAR V1 X11 Z; RUN; /* We can also print a classification table for our holdout sample */ PROC FREQ; TITLE "Classification Results for Holdout Sample"; TABLE X11*Z; RUN; PROC PLOT; PLOT X11*V1=Z; RUN;