Car Preferences Analysis
Principal Components and Biplots

******************************************************;                         
* carprin.sas - PRINCIPAL COMPONENTS ANALYSIS OF CAR *;
* PREFERENCES.  Adapted from the SAS Sample Library. *;
******************************************************;                         
Options PS=55 LS=78 PageNo=1 NoDate;                                                  
GOptions Reset=ALL TargetDevice=PDF
    NoPrompt HText=1 FText=Swiss HTitle=1 FTitle=Swiss;

/*
 * PDF code
 *
ODS Listing Close;
Filename GSASFile Dummy;
GOptions Device=PDF FText=Helvetica FTitle=Helvetica;
Options TopMargin=1 BottomMargin=1 LeftMargin=1.0 RightMargin=1.0;
ODS PDF File="CarPrin.pdf";
 */

/*
 * HTML code
 * Remove length specifications in axes statements.
 *
ODS Listing Close;
ODS HTML body="CarPrin.html" 
         headtext="<title>Car Preferences Biplot Analyses</title>"
         gpath="CarPrin"
         anchor="CarPrin";
GOptions Device=GIF Transparency NoBorder
         HText=1 FText=Swiss HTitle=1 FTitle=Swiss;
 */
Title1 'Preference Analysis of Cars';                                    
%Let Ratings=MPG Reliable Accel Braking Handling Ride Visible Comfort Quiet Cargo;                                                                                
Data Cars;                                                                      
  Length Origin $8;                                                             
  Input Make $1-10 Model $12-22 @24 (&Ratings) (1.) Origin $35                  
        @37 (Pref1-Pref25) (1.);                                                
  If Origin='E' | Origin='J' Then Import='YES';                                 
                           Else Import='NO';                                    
  If Origin='A' Then Origin='AMC     ';                                         
   Else If Origin='C' Then Origin='CHRYSLER';                                   
   Else If Origin='F' Then Origin='FORD    ';                                   
   Else If Origin='G' Then Origin='GMC     ';                                   
   Else If Origin='E' Then Origin='EUROPE  ';                                   
   Else If Origin='J' Then Origin='JAPAN   ';                                   
   Else Origin='UNKNOWN';                                                       
DataLines;                                                                          
CADILLAC   ELDORADO    3234543533 G 0807990491240508971093809                   
CHEVROLET  CHEVETTE    5335425223 G 0051200423451043003515698                   
CHEVROLET  CITATION    4155555525 G 0453305814161643544747795                   
CHEVROLET  MALIBU      3333444544 G 0627400723121345545668658                   
FORD       FAIRMONT    3324345434 F 0224006715021443530648655                   
FORD       MUSTANG     3244323222 F 0507197705021101850657555                   
FORD       PINTO       4134313222 F 0021000303030201500514078                   
HONDA      ACCORD      5554533433 J 9556897609699952998975078                   
HONDA      CIVIC       5545435434 J 8436709507488852567765075                   
LINCOLN    CONTINENTAL 2453353555 F 0708990592230409962091909                   
PLYMOUTH   GRAN FURY   2134353535 C 0706000434101107333458708                   
PLYMOUTH   HORIZON     4345535235 C 0305005635461302444675655                   
PLYMOUTH   VOLARE      2153333424 C 0405003614021602754476555                   
PONTIAC    FIREBIRD    1153551231 G 1007895613201206958265907                   
VOLKSWAGEN DASHER      5355545435 E 8458696508877795377895000                   
VOLKSWAGEN RABBIT      5454535424 E 8458509709695795487885000                   
VOLVO      DL          4524555555 E 9989998909999987989919000                   
;                   

Title2 "Judges' Preference Scores"; 
Proc Print Data=Cars;                                                                     
 Var Make Model Origin Import Pref1-Pref25;
Run;          

Title2 "Car Attributes";
Proc Print Data=Cars Label;                                                                     
 Var Model MPG Reliable Accel Braking Handling 
     Ride Visible Comfort Quiet Cargo;
 Label Reliable="Rel" Braking="Brake" Handling="Hand"
     Visible="Vis" Comfort="Comf";
Footnote1 "Attributes: Reliability Acceleration Braking Handling";
Footnote2 "            Ride Visibility Comfort Quiet Cargo-Space";
Run;          
FootNote1;

/*
 * Use the macros of Michael Friendly to construct
 * the biplots.
 */
%Include "biplot.sas"; 
%Include "equate.sas";

Title2 "Car Makes - Symmetric Biplot (Alpha=1/2)";
%Biplot(Data=Cars,Var=Pref1-Pref25,Id=Make,FacType=SYM);
Title2 "Car Import? - Symmetric Biplot (Alpha=1/2)";
%Biplot(Data=Cars,Var=Pref1-Pref25,Id=Import,FacType=SYM);
Title2 "Car Models - Symmetric Biplot (Alpha=1/2)";
%Biplot(Data=Cars,Var=Pref1-Pref25,Id=Model,FacType=SYM);
/*
 * Put the car data and the biplot results together
 * for additional analysis. Specifically, we'll compute
 * the correlations between car attributes and the
 * principal component scores of the cars.
 */
Data Components;
 Merge Cars
       Biplot(Where=(_TYPE_="OBS"));
Run;


/*
 * Compute Correlations.
 */
Title3 "Correlations Between Component Scores and Car Attributes";
Proc Corr Data=Components NoSimple NoProb OutP=Attributes;                                
  Var Dim1 Dim2;                                                              
  With MPG Reliable Accel Braking Handling Ride Visible Comfort Quiet Cargo;                                                                
Run;                                                                            

/*
 * Plot these correlations as supplementary information in the
 * previous biplot. The correlations will be inserted through
 * the annotate data set.
 */
Data BiAnno2;
 Set BiAnno
     Attributes(In=In1 Where=(_TYPE_="CORR"));
 If In1 Then
  Do;
   %Let Multiplier=3.0;
   XSys="2"; YSys="2"; X=Dim1*&Multiplier; Y=Dim2*&Multiplier; Color="GREEN";
   Function="LABEL"; Text=_NAME_; Position="5"; Size=1; Output;
   Function="MOVE"; Output;
   X=0; Y=0; Function="DRAW"; Output;
  End;
 Else Output;
Run;

/*
 * Now regenerate the biplot, but with the new annotations.
 * I used the MPRINT option to generate the code below from
 * the original call to the biplot macro.
 */
Title3 "Includes Correlations Of Components With Car Attributes";
Title4 "Correlations Are Multiplied By &Multiplier";
Symbol1 V=NONE C=BLUE I=NONE L=33;
Symbol2 V=NONE C=RED  I=VEC  L=20;
Proc GPlot Data=BIPLOT;
plot dim2 * dim1 = _type_
  / Annotate=BIANNO2 Frame NoLegend 
    VAxis=Axis98 HAxis=Axis99 VMinor=1 HMinor=1;
Run;
Quit;


*ODS PDF Close;
*ODS HTML Close;
ODS Listing;


 
Preference Analysis of Cars
Judges' Preference Scores

Obs Make Model Origin Import Pref1 Pref2 Pref3 Pref4 Pref5 Pref6 Pref7 Pref8 Pref9 Pref10 Pref11 Pref12 Pref13 Pref14 Pref15 Pref16 Pref17 Pref18 Pref19 Pref20 Pref21 Pref22 Pref23 Pref24 Pref25
1 CADILLAC ELDORADO GMC NO 0 8 0 7 9 9 0 4 9 1 2 4 0 5 0 8 9 7 1 0 9 3 8 0 9
2 CHEVROLET CHEVETTE GMC NO 0 0 5 1 2 0 0 4 2 3 4 5 1 0 4 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L EUROPE YES 9 9 8 9 9 9 8 9 0 9 9 9 9 9 8 7 9 8 9 9 1 9 0 0 0

 


 
Preference Analysis of Cars
Car Attributes

Obs Model MPG Rel Accel Brake Hand Ride Vis Comf Quiet Cargo
1 ELDORADO 3 2 3 4 5 4 3 5 3 3
2 CHEVETTE 5 3 3 5 4 2 5 2 2 3
3 CITATION 4 1 5 5 5 5 5 5 2 5
4 MALIBU 3 3 3 3 4 4 4 5 4 4
5 FAIRMONT 3 3 2 4 3 4 5 4 3 4
6 MUSTANG 3 2 4 4 3 2 3 2 2 2
7 PINTO 4 1 3 4 3 1 3 2 2 2
8 ACCORD 5 5 5 4 5 3 3 4 3 3
9 CIVIC 5 5 4 5 4 3 5 4 3 4
10 CONTINENTAL 2 4 5 3 3 5 3 5 5 5
11 GRAN FURY 2 1 3 4 3 5 3 5 3 5
12 HORIZON 4 3 4 5 5 3 5 2 3 5
13 VOLARE 2 1 5 3 3 3 3 4 2 4
14 FIREBIRD 1 1 5 3 5 5 1 2 3 1
15 DASHER 5 3 5 5 5 4 5 4 3 5
16 RABBIT 5 4 5 4 5 3 5 4 2 4
17 DL 4 5 2 4 5 5 5 5 5 5

Attributes: Reliability Acceleration Braking Handling
Ride Visibility Comfort Quiet Cargo-Space

 


 
Preference Analysis of Cars
Car Makes - Symmetric Biplot (Alpha=1/2)

Standardization Type: MEAN (VARDEF = N - 1 )
 
Singular values and variance accounted for
 
Singular Values Percent Cum % Histogram of %
40.9372 45.70 45.70 ****************************************
29.6861 24.03 69.73 *********************
15.0533 6.18 75.91 *****
14.8005 5.97 81.89 *****
12.6845 4.39 86.27 ****
11.5476 3.64 89.91 ***
10.3740 2.93 92.84 ***
9.3794 2.40 95.24 **
7.5872 1.57 96.81 *
6.4207 1.12 97.94 *
5.5715 0.85 98.78 *
4.2083 0.48 99.27 *
3.7332 0.38 99.65 *
2.4011 0.16 99.80 *
2.1026 0.12 99.92 *
1.6691 0.08 100.00 *
0.0000 0.00 100.00 *
0.0000 0.00 100.00 *
0.0000 0.00 100.00 *
0.0000 0.00 100.00 *
0.0000 0.00 100.00 *
0.0000 0.00 100.00 *
0.0000 0.00 100.00 *
0.0000 0.00 100.00 *
0.0000 0.00 100.00 *
 
OBS / VARS ratio: 1.184863 Scale: 1
 
Biplot Factor Type
 
Symmetric
 
Biplot coordinates
 
  DIM1 DIM2
OBS CADILLAC -1.0890 2.8099
OBS CHEVROLET -1.2400 -1.6682
OBS CHEVROLET -0.3487 -1.1789
OBS CHEVROLET -0.8458 -0.1667
OBS FORD -0.8535 -1.1648
OBS FORD -0.6958 0.0810
OBS FORD -1.5640 -1.6802
OBS HONDA 2.2930 0.2011
OBS HONDA 1.6175 -0.9371
OBS LINCOLN -1.1538 2.8987
OBS PLYMOUTH -1.5383 0.1045
OBS PLYMOUTH -0.7050 -0.7334
OBS PLYMOUTH -0.9415 -0.5016
OBS PONTIAC -0.6369 1.5712
OBS VOLKSWAGEN 2.3160 0.3295
OBS VOLKSWAGEN 2.1976 -0.5758
OBS VOLVO 3.1881 0.6108
VAR Pref1 2.3876 -0.0198
VAR Pref2 0.4785 1.1259
VAR Pref3 1.2194 -0.6201
VAR Pref4 0.7679 1.1883
VAR Pref5 1.2301 1.8909
VAR Pref6 0.9281 2.5777
VAR Pref7 1.6738 -0.5045
VAR Pref8 0.4474 -0.0706
VAR Pref9 -0.8273 1.5006
VAR Pref10 1.4685 -0.4855
VAR Pref11 1.5722 0.1970
VAR Pref12 1.6258 -0.3870
VAR Pref13 1.9949 -0.1488
VAR Pref14 1.4989 0.2107
VAR Pref15 1.7717 -0.5971
VAR Pref16 0.0467 1.4606
VAR Pref17 0.2342 1.3605
VAR Pref18 1.1957 1.0137
VAR Pref19 1.4881 0.1623
VAR Pref20 1.2338 -1.2318
VAR Pref21 0.1949 1.1493
VAR Pref22 0.2044 -0.6558
VAR Pref23 -1.6633 1.0337
VAR Pref24 -0.4416 -1.8515
VAR Pref25 -1.4031 0.4893

 


 

 


 
Preference Analysis of Cars
Car Import? - Symmetric Biplot (Alpha=1/2)

Standardization Type: MEAN (VARDEF = N - 1 )
 
Singular values and variance accounted for
 
Singular Values Percent Cum % Histogram of %
40.9372 45.70 45.70 ****************************************
29.6861 24.03 69.73 *********************
15.0533 6.18 75.91 *****
14.8005 5.97 81.89 *****
12.6845 4.39 86.27 ****
11.5476 3.64 89.91 ***
10.3740 2.93 92.84 ***
9.3794 2.40 95.24 **
7.5872 1.57 96.81 *
6.4207 1.12 97.94 *
5.5715 0.85 98.78 *
4.2083 0.48 99.27 *
3.7332 0.38 99.65 *
2.4011 0.16 99.80 *
2.1026 0.12 99.92 *
1.6691 0.08 100.00 *
0.0000 0.00 100.00 *
0.0000 0.00 100.00 *
0.0000 0.00 100.00 *
0.0000 0.00 100.00 *
0.0000 0.00 100.00 *
0.0000 0.00 100.00 *
0.0000 0.00 100.00 *
0.0000 0.00 100.00 *
0.0000 0.00 100.00 *
 
OBS / VARS ratio: 1.184863 Scale: 1
 
Biplot Factor Type
 
Symmetric
 
Biplot coordinates
 
  DIM1 DIM2
OBS NO -1.0890 2.8099
OBS NO -1.2400 -1.6682
OBS NO -0.3487 -1.1789
OBS NO -0.8458 -0.1667
OBS NO -0.8535 -1.1648
OBS NO -0.6958 0.0810
OBS NO -1.5640 -1.6802
OBS YES 2.2930 0.2011
OBS YES 1.6175 -0.9371
OBS NO -1.1538 2.8987
OBS NO -1.5383 0.1045
OBS NO -0.7050 -0.7334
OBS NO -0.9415 -0.5016
OBS NO -0.6369 1.5712
OBS YES 2.3160 0.3295
OBS YES 2.1976 -0.5758
OBS YES 3.1881 0.6108
VAR Pref1 2.3876 -0.0198
VAR Pref2 0.4785 1.1259
VAR Pref3 1.2194 -0.6201
VAR Pref4 0.7679 1.1883
VAR Pref5 1.2301 1.8909
VAR Pref6 0.9281 2.5777
VAR Pref7 1.6738 -0.5045
VAR Pref8 0.4474 -0.0706
VAR Pref9 -0.8273 1.5006
VAR Pref10 1.4685 -0.4855
VAR Pref11 1.5722 0.1970
VAR Pref12 1.6258 -0.3870
VAR Pref13 1.9949 -0.1488
VAR Pref14 1.4989 0.2107
VAR Pref15 1.7717 -0.5971
VAR Pref16 0.0467 1.4606
VAR Pref17 0.2342 1.3605
VAR Pref18 1.1957 1.0137
VAR Pref19 1.4881 0.1623
VAR Pref20 1.2338 -1.2318
VAR Pref21 0.1949 1.1493
VAR Pref22 0.2044 -0.6558
VAR Pref23 -1.6633 1.0337
VAR Pref24 -0.4416 -1.8515
VAR Pref25 -1.4031 0.4893

 


 

 


 
Preference Analysis of Cars
Car Models - Symmetric Biplot (Alpha=1/2)

Standardization Type: MEAN (VARDEF = N - 1 )
 
Singular values and variance accounted for
 
Singular Values Percent Cum % Histogram of %
40.9372 45.70 45.70 ****************************************
29.6861 24.03 69.73 *********************
15.0533 6.18 75.91 *****
14.8005 5.97 81.89 *****
12.6845 4.39 86.27 ****
11.5476 3.64 89.91 ***
10.3740 2.93 92.84 ***
9.3794 2.40 95.24 **
7.5872 1.57 96.81 *
6.4207 1.12 97.94 *
5.5715 0.85 98.78 *
4.2083 0.48 99.27 *
3.7332 0.38 99.65 *
2.4011 0.16 99.80 *
2.1026 0.12 99.92 *
1.6691 0.08 100.00 *
0.0000 0.00 100.00 *
0.0000 0.00 100.00 *
0.0000 0.00 100.00 *
0.0000 0.00 100.00 *
0.0000 0.00 100.00 *
0.0000 0.00 100.00 *
0.0000 0.00 100.00 *
0.0000 0.00 100.00 *
0.0000 0.00 100.00 *
 
OBS / VARS ratio: 1.184863 Scale: 1
 
Biplot Factor Type
 
Symmetric
 
Biplot coordinates
 
  DIM1 DIM2
OBS ELDORADO -1.0890 2.8099
OBS CHEVETTE -1.2400 -1.6682
OBS CITATION -0.3487 -1.1789
OBS MALIBU -0.8458 -0.1667
OBS FAIRMONT -0.8535 -1.1648
OBS MUSTANG -0.6958 0.0810
OBS PINTO -1.5640 -1.6802
OBS ACCORD 2.2930 0.2011
OBS CIVIC 1.6175 -0.9371
OBS CONTINENTAL -1.1538 2.8987
OBS GRAN FURY -1.5383 0.1045
OBS HORIZON -0.7050 -0.7334
OBS VOLARE -0.9415 -0.5016
OBS FIREBIRD -0.6369 1.5712
OBS DASHER 2.3160 0.3295
OBS RABBIT 2.1976 -0.5758
OBS DL 3.1881 0.6108
VAR Pref1 2.3876 -0.0198
VAR Pref2 0.4785 1.1259
VAR Pref3 1.2194 -0.6201
VAR Pref4 0.7679 1.1883
VAR Pref5 1.2301 1.8909
VAR Pref6 0.9281 2.5777
VAR Pref7 1.6738 -0.5045
VAR Pref8 0.4474 -0.0706
VAR Pref9 -0.8273 1.5006
VAR Pref10 1.4685 -0.4855
VAR Pref11 1.5722 0.1970
VAR Pref12 1.6258 -0.3870
VAR Pref13 1.9949 -0.1488
VAR Pref14 1.4989 0.2107
VAR Pref15 1.7717 -0.5971
VAR Pref16 0.0467 1.4606
VAR Pref17 0.2342 1.3605
VAR Pref18 1.1957 1.0137
VAR Pref19 1.4881 0.1623
VAR Pref20 1.2338 -1.2318
VAR Pref21 0.1949 1.1493
VAR Pref22 0.2044 -0.6558
VAR Pref23 -1.6633 1.0337
VAR Pref24 -0.4416 -1.8515
VAR Pref25 -1.4031 0.4893

 


 

 


 
Preference Analysis of Cars
Car Models - Symmetric Biplot (Alpha=1/2)
Correlations Between Component Scores and Car Attributes

The CORR Procedure

10 With Variables: MPG Reliable Accel Braking Handling Ride Visible Comfort Quiet Cargo
2 Variables: DIM1 DIM2
 
Pearson Correlation Coefficients, N = 17
  DIM1 DIM2
MPG 0.60558 -0.49903
Reliable 0.71493 0.07910
Accel 0.18750 0.18383
Braking 0.27273 -0.49041
Handling 0.58817 0.16310
Ride 0.11496 0.55193
Visible 0.40948 -0.52502
Comfort 0.24652 0.36435
Quiet 0.23513 0.58765
Cargo 0.25678 -0.03032