SOMMAIRE
.V1.2
|
|
|
|
Tests préalables |
|
|
|
Matrice de corrélation |
|
|
|
Test de sphéricité |
|
|
|
Mesure d’adéquation de l’échantillon
KMO-MSA |
|
|
|
Mesure d’adéquation de l’échantillon
MSA |
|
|
Analyse exploratoire tableau à 2 dimensions |
|
|
|
Ind x Quantitatives |
Analyse en composantes principales |
|
|
Ind x Quantitatives standardisées
(moy=0, std=1) |
|
|
|
Ind x Quantitatives |
|
|
|
Nominale x Nominale (2 variables) |
|
|
|
Nominales x Nominales (plusieurs
variables) |
AFC sur tableau de contingence (BURT) |
|
|
Ind x Nominales |
AFC sur tableau disjonctif complet |
|
Analyse exploratoire tableau à 3 dimensions |
|
|
|
Ind x Quantitatives x Quantitatives |
|
|
|
Ind x Nominales x Nominales |
|
|
|
Ind x Nominales x Quantitatives
[Données Mixtes] |
AF multiple duale |
|
|
Ind x Nominales x (Temps – Espace) |
|
|
|
Ind x (Nom/Quanti) x (Nom/Quanti)
[hiérarchisées] |
AF multiple hiérarchique |
|
|
Ind [hiérarchisées] x Quanti
[hiérarchisées] |
AF multiple Duale |
|
Analyse confirmatoire |
|
|
|
Alpha de Crobach |
Alpha et Erreur de mesure |
|
|
Rho de
Joreskog |
|
|
Analyses multi-dimensionnelles |
|
|
|
Perceptions(unfolding) |
Multidimensional scaling |
|
|
Préférences |
|
|
Divers |
|
|
|
Macro de graphique x*y |
|
|
|
Transformation d’une var quali en var
quanti |
|
Sources :
- Base des exemples SAS :
http://www.stat.ucl.ac.be/SMCS/serveur/SAS/samples/stat/samp_stat.html
. PROGRAMME .
http://support.sas.com/techsup/technote/ts722k.pdf;
**************************************************;
%plotit (data=data
set,
plotvars = var1 var2, /* noms des variables */
labelvar = varname, /* nom de l’identifiant (défaut la dernière var alpha*/
symvar = group_var, /* symbole de représentation*/
typevar = group_var, /* variable de groupage (couleur différente)*/
symsize = option, /* taille de la police */
symlen = option); /* nombre de caractère de l’identifiant */
*****************************************************************;
data in ; input
ID $ genre x y @@;
cards ;
Pierre
1 50 40 Jean 1 24 32 Julie 2 10 50 Kai 1 50 10 Helene 2 2 2
;
%plotit();
%plotit(data=in, plotvars= y x,
labelvar=ID, typevar=genre, symsize=0.6);
* ne pas faire l’AF si de nombreuses corrélations
sont <0.30 ;
*************************************************************;
proc CORR data=in ;
* l’erreur de mesure représente
100*(1-alpha*alpha) ;
* exemple : : si alpha =0.8, 36%
de la variance des items provient d’une erreur de mesure ;
* voir PETT M. Making sense of facor analysis, SAGE, 2003.
*************************************************************************************;
proc corr
data=in
alpha ;
var x1-x10 ;
* la matrice des corrélations est-elle une
matrice identité ?
* une variable n’est pas corrélée avec les autres : 1 sur diagonale et 0
ailleurs ;
* effet du ratio nb de variables/nb individus. Si élevé Bartlett
significatif ;
***********************************************************************************;
*
KMO 0.8 correct, >0.7 est acceptable, 0.6 limite ;
* a t on suffisamment d’observations par rapport au nombre de
variables ? ;
* minimum 10-15 obs / item. Sinon enlever des items ou augmenter n ;
*************************************************************************;
proc factor
data=in msa /* msa pour obtenir le
KMO*/
out=coord outstat=stat;
var x1-x10 ;
run;
* évaluation de Kaiser : minimum 0.6 pour
factoriser ;
* la corrélation entre les variables est-elle suffisante ?;
**********************************************************;
* avoir les corrélations sur la diagonale les
plus fortes possible ;
* les corrélations partielles (après élimination des effets des autres
variables) hors diagonale ;
* les plus faibles possibles ;
********************************************;
*
Maximiser la reconstitution de la diagonale d’une matrice de variances
-covariances;
************************************************************************;
*
variables quantitatives;
*
Matrice de covariance : le « poids » des variables dépend de
leur variance ;
********************************************;
* si weight =0 : individus "passifs"
ou illustratifs ;
* coordonnées calculées sur les
axes mais ne participe pas aux calculs ;
********************************************;
proc princomp data=in COV *COV possible mais préférer les
corrélations aux covariances*/
out=coord
outstat=stat;
var
x1-x10 ;
weight
poids;
run;
proc
transpose
data=stat
out=t_stat
;
run;
proc
plot
data=t_stat;
plot
prin2*prin1=_name_ $ _name_;
run;
/* OU */
proc
princomp
data=in out=scores
(keep=prin1 prin2 ID);
run;
%plotit
();
*
Maximiser la reconstitution de la diagonale d’une matrice des corrélations;
*
Matrice de corrélation : le « poids » des variables est
identique (=1) ;
****************************************************************************;
proc princomp data=in /*
COV possible mais préférer les corrélations aux covariances*/
out=coord
outstat=stat;
var
x1-x10 ;
weight
poids;
run;
proc
transpose
data=stat
out=t_stat
;
run;
proc
plot
data=t_stat;
plot
prin2*prin1=_name_ $ _name_;
run;
/* OU */
proc
princomp
data=in out=scores
(keep=prin1 prin2 ID);
run;
%plotit
();
*
Rotation orthogonale facilite l’interprétation en maximisant ;
*
VARIMAX la corrélation d’une variable avec un seul axe ;
*
Matrice de covariance
* Matrice de corrélation
********************************************;
* si weight =0 : individus
"passifs" ou illustratifs ;
* coordonnées calculées sur les
axes mais ne participe pas aux calculs ;
********************************************;
proc
factor
data=in /*
COV */
out=coord
outstat=stat;
var
x1-x10 ;
weight
poids;
run;
proc
transpose
data=stat
out=t_stat
;
run;
proc
plot
data=t_stat;
plot
prin2*prin1=_name_ $ _name_;
run;
*
lecture directe ind x var;
* précaution : sélections variables actives pertinentes ;
* regroupement des modalités rares avec d’autres (sinon trop de poids);
********************************************;
proc
corresp
data=in
all out=sortie;
var q1_1 q1_2 q1_3 ;* modalités variable en
colonne ;
id
qual2 ;
* variable en ligne (modalités sont
des individus) ;
run;
%plotit(data=
out_corresp,datatype=corresp, plotvars=dim2 dim1);
* tableau de contingence : croisement de 2
variables catégorielles ;
* dans le tableau, les effectifs ;
* possibilité de créer des interactions par CROSS ;
**************************************************;
proc corresp data=cars
all out= out_corresp ;
tables
marital, origin ; /* attention à la
virgule */
run;
%plotit(data= out_corresp,datatype=corresp, plotvars=dim2 dim1);
* tableau de contingence : croisement de 2
variables catégorielles ;
* dans le tableau, les effectifs ;
********************************************;
proc corresp data=in
all out= out_corresp
dimens=3
;
tables q01-q05 qual_sup
, q_06-q_10 qual_sup; /* attention à la
virgule */
supplementary qual_sup;
run;
%plotit(data= out_corresp,datatype=corresp, plotvars=dim2 dim1);
proc corresp mca
observed data=Cars
outc=Coor;
tables Origin Size Type Income Home Marital
Sex;
run;
%plotit(data=Coor, datatype=corresp, HREF=0, vref=0)
* enchaînement sur une typologie hiérarchique
(méthode Ward) ;
**************************************************************;
Proc cluster data=out_corresp
(where=(_type_="VAR")) outtree=arbre
method=ward ;
var Dim1-Dim3; id _name_;
run;
Proc tree data=arbre
n=5 out=tree
graphics;
id _name_;copy dim1-dim3;
run;
* (1) tableau de contingence
multiple (Burt);
*
tableau de tous les tableaux croisés 2x2 ;
********************************************;
proc corresp data=in all out=out_corresp
mca dimens=3
;
tables
q_1-q_10 qual_sup;
supplementary qual_sup;
run;
%plotit(data= out_corresp, datatype=corresp, plotvars=dim2
dim1) ;
%plotit(data= out_corresp, datatype=mca) ;
* (2) tableau disjonctif complet ;
* variables catégorielles éclatées en
modalités ;
*
pour chaque modalité réponse 0/1 ;
* permet de récupérer les coordonnées individuelles ;
****************************************************;
proc corresp
data=in all out=
out_corresp
binary dimens=3 ;
tables q1-q10
qual_sup;
supplementary qual_sup;
run;
%plotit(data= out_corresp, datatype=corresp, plotvars=dim2 dim1);
* fait aussi un graphique
individuel ;
data graph_ind set out_corresp
(where type=’OBS’;
run;
%plotit(data= graph_ind, datatype=corresp, plotvars=dim2 dim1);
*
traitement direct d’un data des modalités des variables ;
**********************************************************;
proc corresp
data=in all out=
out_corresp
binary
dimens=3
;
var
q1_1 q1_2 q2_1 q2_2 q2_3;
id ID_obs ;
/* identifiant observations */
run;
%plotit(data=
out_corresp, datatype=corresp, plotvars=dim2 dim1);
* Option 1 : reprendre les coordonnées des
var sur les axes ACM ;
* Option 2 : Procédure Prinqual, transformation de la variable qui
optimise un critère ;
* ACP sur les variables transformées ;
****************************************************;
/* Transform to a better fit to a
2-component model */
proc prinqual data=carpref
out=results n=2
replace standard
scores correlations;
id model;
transform monotone(juge1-juge25);
title2 'Multidimensional Preference (MDPREF) Analysis';
/*---Final Principal Component
Analysis---*/
proc factor data=results
nfactors=2
scree;
var juge1-juge25;
where _type_='SCORE';
title3 'Principal Components of Monotonically Transformed
Data';
run;
********************************************;
* analyse de variables organisées de manière
structurée hiérarchique ;
(thème /
sous-thème);
********************************************;
********************************************;
* indiv et variables sont structurés en
groupes ;
***********************************************;
* variables quantitatives et qualitatives;
* Option 1 : discrétiser les quanti puis ACM ;
* option 2 : (si faible effectifs et nb
variables quali << nb variables quanti : AFDM ;
* ACP + ACM ;
********************************************;
*
http://math2007.univ-rennes1.fr/irmar/rapport_activite.pdf;
***********************************************************;
* rotation procustéenne sur AFM ;
***********************************************************;
* analyse
de dissimilarités et ajout de caractéristiques produit ;
* données individuelles incomplètes (et les
data ici incomplètes);
*******************************************************************;
Data Dissim;
Do i = 1 to
3; Drop
i;
Input
(coke orangeso lkoolaid milk hottea
icetea
hotcofee icecofee water applejui grapejui rum
beer
wine scotch postum
sevenup drpepper
lemonade pepsicol orangecr v8juice) (1.) @@;
Output; End;
Input;
cards;
.8...5...4...8...2....8.3...8...5...9...2....3.9...6...9...8...5..
..9.9...7...9...8...8....9.6...6...8...4...75...6.5...6...9...4...
.8...5.6...8...2...8....6...6.5...5...8...8....7...5.8...8...8...8
4...6...8.6...9...5....5...6...6.9...8...5....9...8...9.5...9...9.
...9...5...5.7...9...98...8...8...7.6...6....9...9...9...6.8...9..
;
Proc MDS
Data=Dissim Maxiter=40
PConfig Pfinal /* PData */
Level=Interval
Model=Indscal
Dimens=2 Header Out=MDS_out;
Run;
Data Ratings;
Input
sweet refresh healthy
good simptast alcohol
watery
sodas colas juices
opaques /
@1 _name_ $16. @26
label $16.;
Label sweet = 'Sweet'
refresh = 'Refreshing'
healthy = 'Healthy'
good = 'Good'
simptast = 'Simple Tasting';
cards;
2.84615 4.13461 7.50000 5.65385 5.86538 0 0 0 1 0 0
COKE COLA Coke
2.65385 4.50000 7.17308 5.61538 4.55769 0 0 1 0 0 0
ORANGESO SODA Orange Soda
3.33333 4.40385 7.11538 6.00000 4.15385 0 0 1 0 0 0
LKOOLAID SODA Lemon
Koolaid
6.46154 3.96154 2.36538 2.07692 4.50980 0 0 0 0 0 1
MILK WATERY Milk
;
Data Config; Set MDS_out;
If _type_ = 'CONFIG'; Run;
Proc Sort Data=Config(Keep=_name_
dim1 dim2);
By _name_; Run;
Proc Sort Data=Ratings(Keep=_name_
label sweet -- simptast);
By _name_; Run;
Data Both;
Merge Config Ratings;
By _name_; Run;
/* Compute the multiple regressions
between the ratings data
and the ordinated scores. Note that these coordinates are
not the simple correlations between ratings and the beverage
axes, but each axis is adjusted for the other. This gives
a type of preference analysis.
*/
Proc Transreg Data=Both;
Model Identity(sweet
-- simptast / reverse) = Identity(dim1 dim2);
Output Out=Coor
Coordinates Replace;
Id label; Run;
Proc Print Data=Coor;
Run;
%plotit(Data=coor,Datatype=mds vector 1.7,
Gopplot=Device=WIN
Targetdevice=PSEPSF,MONOCHRO=Black);
* MDPREF par Prinqual ;
* source : http://support.sas.com/techsup/technote/ts722k.pdf;
* objets en lignes (points) – Individus en colonne (vecteur) ;
*************************************************************;
title2 ‘MDPREF par Prinqual’;
proc prinqual cor
data=in out=out_prin
score std rep;
transform identity(sub1-sub56);
id activity;
run;
%plotit(data=out_prin ,datatype=mdpref
3);
* MDPREF par
Prinqual ;
*---Compute Coordinates for a
2-Dimensional Scatter plot of Cars---;
proc prinqual data=carpref
out=presults(drop=judge1-judge25) n=2
replace standard
scores;
title ’Preference Ratings for Automobiles Manufactured in 1980’;
id model mpg reliable ride;
transform ide(judge1-judge25);
run;
*---Compute Endpoints for Vectors---;
title2 ’Preference Mapping, Vector Model’;
proc transreg data=presults;
model ide(mpg
reliable ride)=identity(prin1 prin2);
output tstandard=center coefficients replace out=vector;
id model;
run;
%plotit(data=vector,datatype=vector
2.5)
* MDPREF par
Prinqual ;
*---Compute Ideal Point
Coordinates---;
title2 ’Preference Mapping, Ideal Point Model’;
proc transreg data=presults;
model identity(mpg
reliable ride)=point(prin1 prin2);
output tstandard=center coordinates replace out=ideal;
id model;
run;
%plotit(data=ideal,datatype=ideal,antiidea=1)
proc format;
value drivetyp 1='4WD' 2='Front' 3='Rear';
value origin 1='USA' 0='non-USA';
value airbags 1='Driver&Pass' 2='Driver only' 3='None';
title1 ’Preference Ratings for Automobiles Manufactured in 1980’;
data CarPreferences;
input Make $ 1-10 Model $ 12-22 @25 (Judge1-Judge25) (1.)
MPG Reliability
Ride;
cards;
Cadillac Eldorado
8007990491240508971093809 3 2 4
Chevrolet Chevette
0051200423451043003515698 5 3 2
Chevrolet Citation
4053305814161643544747795 4 1 5
Chevrolet Malibu
6027400723121345545668658 3 3 4
Ford Fairmont 2024006715021443530648655 3 3 4
Ford Mustang
5007197705021101850657555 3 2 2
Ford Pinto
0021000303030201500514078 4 1 1
Honda Accord
5956897609699952998975078 5 5 3
Honda Civic 4836709507488852567765075
5 5 3
Lincoln Continental
7008990592230409962091909 2 4 5
Plymouth Gran Fury
7006000434101107333458708 2 1 5
Plymouth Horizon
3005005635461302444675655 4 3 3
Plymouth Volare
4005003614021602754476555 2 1 3
Pontiac Firebird
0107895613201206958265907 1 1 5
Volkswagen Dasher 4858696508877795377895000 5 3 4
Volkswagen Rabbit 4858509709695795487885000 5 4 3
Volvo DL
9989998909999987989919000 4 5 5
; run;
* MDPREF par
Prinqual ;
title '93
Cars data – 26 variables ';
data cars93;
input #1 make $1-14 model $15-29 type $30-36
minprice midprice maxprice
citympg
hwympg airbags DriveTyp
Cylinder
Engine Horse rpm
#2 rpmile manual FuelCap Passengers Length wheel width
uturn rseat
luggage
Weight Origin;
*-- derived variables;
Price
= mean(minprice, midprice, maxprice)
MPG = mean(citympg, hwympg);
label
make
= 'Manufacturer'
minprice
= 'Price for basic
version'
midprice
= 'Midrange Price'
maxprice
= 'Price for premium
version'
citympg
= 'City miles per gallon'
hwympg
= 'Highway miles per gallon'
airbags
= 'Number of Air Bags
standard'
drivetyp
= 'Drive train type'
cylinder = 'Number of cylinders'
Engine
= 'Engine size (liters)'
Horse
= 'Horsepower (maximum)'
rpm
= 'Max Horsepwr revs per
minute'
rpmile
= 'Engine revolutions per mile'
manual
= 'Manual transmission
available'
FuelCap
= 'Fuel tank capacity
(gallons)'
Passengers
= 'Passenger capacity'
length
= 'Length (in.)'
wheel
= 'Wheelbase (in.)'
width
= 'Width (in.)'
uturn
= 'U-turn space (ft)'
rseat
= 'Rear seat room (in.)'
luggage
= 'Luggage capacity (cu.
ft.)'
weight
= 'Weight (pounds)'
Origin
= 'Domestic';
cards;
Acura Integra Small 12.9 15.9 18.8
25 31 0 1 4 1.8 140 6300 2890 1 13.2 5 177 102 68 37 26.5 11 2705 0
Acura Legend Midsize 29.2 33.9 38.7
18 25 2 1 6 3.2 200 5500 2335 1 18.0 5 195 115 71 38 30.0 15 3560 0
Audi 90 Compact 25.9 29.1 32.3 20
26 1 1 6 2.8 172 5500 2280 1 16.9 5 180 102 67 37 28.0 14 3375 0
Audi 100 Midsize 30.8 37.7 44.6 19
26 2 1 6 2.8 172 5500 2535 1 21.1 6 193 106 70 37 31.0 17 3405 0
BMW 535i Midsize 23.7 30.0 36.2 22
30 1 0 4 3.5 208 5700 2545 1 21.1 4 186 109 69 39 27.0 13 3640 0
Buick Century Midsize 14.2 15.7
17.3 22 31 1 1 4 2.2 110 5200 2565 0 16.4 6 189 105 69 41 28.0 16 2880 1
Buick LeSabre Large 19.9 20.8 21.7
19 28 1 1 6 3.8 170 4800 1570 0 18.0 6 200 111 74 42 30.5 17 3470 1
Buick Roadmaster Large 22.6 23.7
24.9 16 25 1 0 6 5.7 180 4000 1320 0 23.0 6 216 116 78 45 30.5 21 4105 1
Buick Riviera Midsize 26.3 26.3
26.3 19 27 1 1 6 3.8 170 4800 1690 0 18.8 5 198 108 73 41 26.5 14 3495 1
Cadillac
DeVille Large 33.0 34.7 36.3 16 25 1 1 8 4.9 200 4100 1510 0 18.0 6 206 114 73
43 35.0 18 3620 1
Cadillac
Seville Midsize 37.5 40.1 42.7 16 25 2 1 8 4.6 295 6000 1985 0 20.0 5 204 111
74 44 31.0 14 3935 1
Chevrolet
Cavalier Compact 8.5 13.4 18.3 25 36 0 1 4 2.2 110 5200 2380 1 15.2 5 182 101
66 38 25.0 13 2490 1
Chevrolet
Corsica Compact 11.4 11.4 11.4 25 34 1 1 4 2.2 110 5200 2665 1 15.6 5 184 103
68 39 26.0 14 2785 1
Chevrolet
Camaro Sporty 13.4 15.1 16.8 19 28 2 0 6 3.4 160 4600 1805 1 15.5 4 193 101 74
43 25.0 13 3240 1
Chevrolet
Lumina Midsize 13.4 15.9 18.4 21 29 0 1 4 2.2 110 5200 2595 0 16.5 6 198 108 71
40 28.5 16 3195 1
Chevrolet
Lumina_APV Van 14.7 16.3 18.0 18 23 0 1 6 3.8 170 4800 1690 0 20.0 7 178 110 74
44 30.5 . 3715 1
Chevrolet Astro Van 14.7 16.6 18.6 15
20 0 2 6 4.3 165 4000 1790 0 27.0 8 194 111 78 42 33.5 . 4025
1
Chevrolet
Caprice Large 18.0 18.8 19.6 17 26 1 0 8 5.0 170 4200 1350 0 23.0 6 214 116 77
42 29.5 20 3910 1
Chevrolet
Corvette Sporty 34.6 38.0 41.5 17 25 1 0 8 5.7 300 5000 1450 1 20.0 2 179 96 74
43 . . 3380 1
Chrylser
Concorde Large 18.4 18.4 18.4 20 28 2 1 6 3.3 153 5300 1990 0 18.0 6 203 113 74
40 31.0 15 3515 1
Chrysler LeBaron Compact 14.5 15.8
17.1 23 28 2 1 4 3.0 141 5000 2090 0 16.0 6 183 104 68 41 30.5 14 3085 1
Chrysler Imperial Large 29.5 29.5
29.5 20 26 1 1 6 3.3 147 4800 1785 0 16.0 6 203 110 69 44 36.0 17 3570 1
Dodge Colt Small 7.9 9.2 10.6 29 33
0 1 4 1.5 92 6000 3285 1 13.2 5 174 98 66 32 26.5 11 2270 1
Dodge Shadow Small 8.4 11.3 14.2 23
29 1 1 4 2.2 93 4800 2595 1 14.0 5 172 97 67 38 26.5 13 2670 1
Dodge Spirit Compact 11.9 13.3 14.7
22 27 1 1 4 2.5 100 4800 2535 1 16.0 6 181 104 68 39 30.5 14 2970 1
Dodge Caravan Van 13.6 19.0 24.4 17
21 1 2 6 3.0 142 5000 1970 0 20.0 7 175 112 72 42 26.5 . 3705 1
Dodge Dynasty Midsize 14.8 15.6
16.4 21 27 1 1 4 2.5 100 4800 2465 0 16.0 6 192 105 69 42 30.5 16 3080 1
Dodge Stealth Sporty 18.5 25.8 33.1
18 24 1 2 6 3.0 300 6000 2120 1 19.8 4 180 97 72 40 20.0 11 3805 1
Eagle Summit Small 7.9 12.2 16.5 29
33 0 1 4 1.5 92 6000 2505 1 13.2 5 174 98 66 36 26.5 11 2295 1
Eagle Vision Large 17.5 19.3 21.2
20 28 2 1 6 3.5 214 5800 1980 0 18.0 6 202 113 74 40 30.0 15 3490 1
Ford Festiva Small 6.9 7.4 7.9 31
33 0 1 4 1.3 63 5000 3150 1 10.0 4 141 90 63 33 26.0 12 1845 1
Ford Escort Small 8.4 10.1 11.9 23
30 0 1 4 1.8 127 6500 2410 1 13.2 5 171 98 67 36 28.0 12 2530 1
Ford Tempo Compact 10.4 11.3 12.2
22 27 0 1 4 2.3 96 4200 2805 1 15.9 5 177 100 68 39 27.5 13 2690 1
Ford Mustang Sporty 10.8 15.9 21.0
22 29 1 0 4 2.3 105 4600 2285 1 15.4 4 180 101 68 40 24.0 12 2850 1
Ford Probe Sporty 12.8 14.0 15.2 24
30 1 1 4 2.0 115 5500 2340 1 15.5 4 179 103 70 38 23.0 18 2710 1
Ford Aerostar Van 14.5 19.9 25.3 15
20 1 2 6 3.0 145 4800 2080 1 21.0 7 176 119 72 45 30.0 . 3735 1
Ford Taurus Midsize 15.6 20.2 24.8
21 30 1 1 6 3.0 140 4800 1885 0 16.0 5 192 106 71 40 27.5 18 3325 1
Ford Crown_Victoria Large 20.1 20.9
21.7 18 26 1 0 8 4.6 190 4200 1415 0 20.0 6 212 114 78 43 30.0 21 3950 1
Geo Metro Small 6.7 8.4 10.0 46 50
0 1 3 1.0 55 5700 3755 1 10.6 4 151 93 63 34 27.5 10 1695 0
Geo Storm Sporty 11.5 12.5 13.5 30
36 1 1 4 1.6 90 5400 3250 1 12.4 4 164 97 67 37 24.5 11 2475 0
Honda Prelude Sporty 17.0 19.8 22.7
24 31 2 1 4 2.3 160 5800 2855 1 15.9 4 175 100 70 39 23.5 8 2865 0
Honda Civic Small 8.4 12.1 15.8 42
46 1 1 4 1.5 102 5900 2650 1 11.9 4 173 103 67 36 28.0 12 2350 0
Honda Accord Compact 13.8 17.5 21.2
24 31 2 1 4 2.2 140 5600 2610 1 17.0 4 185 107 67 41 28.0 14 3040 0
Hyundai Excel Small 6.8 8.0 9.2 29
33 0 1 4 1.5 81 5500 2710 1 11.9 5 168 94 63 35 26.0 11 2345 0
Hyundai Elantra Small 9.0 10.0 11.0
22 29 0 1 4 1.8 124 6000 2745 1 13.7 5 172 98 66 36 28.0 12 2620 0
Hyundai
Scoupe Sporty 9.1 10.0 11.0 26 34 0 1 4 1.5 92 5550 2540 1 11.9 4 166 94 64 34
23.5 9 2285 0
Hyundai
Sonata Midsize 12.4 13.9 15.3 20 27 0 1 4 2.0 128 6000 2335 1 17.2 5 184 104 69
41 31.0 14 2885 0
Infiniti
Q45 Midsize 45.4 47.9 50.4 17 22 1 0 8 4.5 278 6000 1955 0 22.5 5 200 113 72 42
29.0 15 4000 0
Lexus
ES300 Midsize 27.5 28.0 28.4 18 24 1 1 6 3.0 185 5200 2325 1 18.5 5 188 103 70
40 27.5 14 3510 0
Lexus
SC300 Midsize 34.7 35.2 35.6 18 23 2 0 6 3.0 225 6000 2510 1 20.6 4 191 106 71
39 25.0 9 3515 0
Lincoln
Continental Midsize 33.3 34.3 35.3 17 26 2 1 6 3.8 160 4400 1835 0 18.4 6 205
109 73 42 30.0 19 3695 1
Lincoln
Town_Car Large 34.4 36.1 37.8 18 26 2 0 8 4.6 210 4600 1840 0 20.0 6 219 117 77
45 31.5 22 4055 1
Mazda 323 Small 7.4 8.3 9.1 29 37 0
1 4 1.6 82 5000 2370 1 13.2 4 164 97 66 34 27.0 16 2325 0
Mazda Protege Small 10.9 11.6 12.3
28 36 0 1 4 1.8 103 5500 2220 1 14.5 5 172 98 66 36 26.5 13 2440 0
Mazda 626 Compact 14.3 16.5 18.7 26
34 1 1 4 2.5 164 5600 2505 1 15.5 5 184 103 69 40 29.5 14 2970 0
Mazda MPV Van 16.6 19.1 21.7 18 24
0 2 6 3.0 155 5000 2240 0 19.6 7 190 110 72 39 27.5 . 3735 0
Mazda RX-7 Sporty 32.5 32.5 32.5 17
25 1 0 . 1.3 255 6500 2325 1 20.0 2 169 96 69 37 . . 2895 0
Mercedes-Benz 190E Compact 29.0
31.9 34.9 20 29 1 0 4 2.3 130 5100 2425 1 14.5 5 175 105 67 34 26.0 12 2920 0
Mercedes-Benz 300E Midsize 43.8
61.9 80.0 19 25 2 0 6 3.2 217 5500 2220 0 18.5 5 187 110 69 37 27.0 15 3525 0
Mercury Capri Sporty 13.3 14.1 15.0
23 26 1 1 4 1.6 100 5750 2475 1 11.1 4 166 95 65 36 19.0 6 2450 1
Mercury Cougar Midsize 14.9 14.9
14.9 19 26 0 0 6 3.8 140 3800 1730 0 18.0 5 199 113 73 38 28.0 15 3610 1
Mitsubishi Mirage Small 7.7 10.3 12.9
29 33 0 1 4 1.5 92 6000 2505 1 13.2 5 172 98 67 36 26.0 11 2295 0
Mitsubishi Diamante Midsize 22.4 26.1
29.9 18 24 1 1 6 3.0 202 6000 2210 0 19.0 5 190 107 70 43 27.5 14 3730 0
Nissan Sentra Small 8.7 11.8 14.9
29 33 1 1 4 1.6 110 6000 2435 1 13.2 5 170 96 66 33 26.0 12 2545 0
Nissan
Altima Compact 13.0 15.7 18.3 24 30 1 1 4 2.4 150 5600 2130 1 15.9 5 181 103 67
40 28.5 14 3050 0
Nissan
Quest Van 16.7 19.1 21.5 17 23 0 1 6 3.0 151 4800 2065 0 20.0 7 190 112 74 41
27.0 . 4100 0
Nissan Maxima Midsize 21.0 21.5 22.0
21 26 1 1 6 3.0 160 5200 2045 0 18.5 5 188 104 69 41 28.5 14 3200 0
Oldsmobile Achieva Compact 13.0
13.5 14.0 24 31 0 1 4 2.3 155 6000 2380 0 15.2 5 188 103 67 39 28.0 14 2910 1
Oldsmobile Cutlass_Ciera Midsize
14.2 16.3 18.4 23 31 1 1 4 2.2 110 5200 2565 0 16.5 5 190 105 70 42 28.0 16
2890 1
Oldsmobile
Silhouette Van 19.5 19.5 19.5 18 23 0 1 6 3.8 170 4800 1690 0 20.0 7 194 110 74
44 30.5 . 3715 1
Oldsmobile Eighty-Eight Large 19.5
20.7 21.9 19 28 1 1 6 3.8 170 4800 1570 0 18.0 6 201 111 74 42 31.5 17 3470 1
Plymouth Laser Sporty 11.4 14.4
17.4 23 30 0 2 4 1.8 92 5000 2360 1 15.9 4 173 97 67 39 24.5 8 2640 1
Pontiac LeMans Small 8.2 9.0 9.9 31
41 0 1 4 1.6 74 5600 3130 1 13.2 4 177 99 66 35 25.5 17 2350 1
Pontiac Sunbird Compact 9.4 11.1
12.8 23 31 0 1 4 2.0 110 5200 2665 1 15.2 5 181 101 66 39 25.0 13 2575 1
Pontiac Firebird Sporty 14.0 17.7
21.4 19 28 2 0 6 3.4 160 4600 1805 1 15.5 4 196 101 75 43 25.0 13 3240 1
Pontiac
Grand_Prix Midsize 15.4 18.5 21.6 19 27 0 1 6 3.4 200 5000 1890 1 16.5 5 195
108 72 41 28.5 16 3450 1
Pontiac
Bonneville Large 19.4 24.4 29.4 19 28 2 1 6 3.8 170 4800 1565 0 18.0 6 177 111
74 43 30.5 18 3495 1
Saab 900 Compact 20.3 28.7 37.1 20
26 1 1 4 2.1 140 6000 2910 1 18.0 5 184 99 67 37 26.5 14 2775 0
Saturn SL Small 9.2 11.1 12.9 28 38
1 1 4 1.9 85 5000 2145 1 12.8 5 176 102 68 40 26.5 12 2495 1
Subaru Justy Small 7.3 8.4 9.5 33
37 0 2 3 1.2 73 5600 2875 1 9.2 4 146 90 60 32 23.5 10 2045 0
Subaru Loyale Small 10.5 10.9 11.3
25 30 0 2 4 1.8 90 5200 3375 1 15.9 5 175 97 65 35 27.5 15 2490 0
Subaru Legacy Compact 16.3 19.5
22.7 23 30 1 2 4 2.2 130 5600 2330 1 15.9 5 179 102 67 37 27.0 14 3085 0
Suzuki Swift Small 7.3 8.6 10.0 39
43 0 1 3 1.3 70 6000 3360 1 10.6 4 161 93 63 34 27.5 10 1965 0
Toyota Tercel Small 7.8 9.8 11.8 32
37 1 1 4 1.5 82 5200 3505 1 11.9 5 162 94 65 36 24.0 11 2055 0
Toyota Celica Sporty 14.2 18.4 22.6
25 32 1 1 4 2.2 135 5400 2405 1 15.9 4 174 99 69 39 23.0 13 2950 0
Toyota Camry Midsize 15.2 18.2 21.2
22 29 1 1 4 2.2 130 5400 2340 1 18.5 5 188 103 70 38 28.5 15 3030 0
Toyota Previa Van 18.9 22.7 26.6 18 22
1 2 4 2.4 138 5000 2515 1 19.8 7 187 113 71 41 35.0 . 3785 0
Volkswagen Fox Small 8.7 9.1 9.5 25 33
0 1 4 1.8 81 5500 2550 1 12.4 4 163 93 63 34 26.0 10 2240 0
Volkswagen Eurovan Van 16.6 19.7 22.7
17 21 0 1 5 2.5 109 4500 2915 1 21.1 7 187 115 72 38 34.0 . 3960 0
Volkswagen Passat Compact 17.6 20.0
22.4 21 30 0 1 4 2.0 134 5800 2685 1 18.5 5 180 103 67 35 31.5 14 2985 0
Volkswagen Corrado Sporty 22.9 23.3
23.7 18 25 0 1 6 2.8 178 5800 2385 1 18.5 4 159 97 66 36 26.0 15 2810 0
Volvo 240 Compact 21.8 22.7 23.5 21
28 1 0 4 2.3 114 5400 2215 1 15.8 5 190 104 67 37 29.5 14 2985 0
Volvo 850 Midsize 24.8 26.7 28.5 20
28 2 1 5 2.4 168 6200 2310 1 19.3 5 184 105 69 38 30.0 15 3245 0
run;
* http://www.tau.ac.il/cc/pages/docs/sas8/stat/chap24/sect28.htm
;
title 'Car
Owners and Car Origin';
proc format;
value Origin 1 = 'American' 2 = 'Japanese' 3 = 'European';
value Size 1 = 'Small' 2
= 'Medium'
3 = 'Large';
value Type 1 = 'Family' 2
= 'Sporty'
3 = 'Work';
value Home 1 = 'Own' 2
= 'Rent';
value Sex 1 = 'Male' 2
= 'Female';
value Income 1 = '1 Income' 2 = '2 Incomes';
value Marital 1
= 'Single with Kids' 2
= 'Married with Kids'
3 = 'Single' 4 = 'Married';
run;
data Cars;
missing a;
input (Origin Size Type Home Income
Marital Kids Sex) (1.) @@;
* Check for End of Line;
if n(of Origin -- Sex) eq 0
then do;
input; return;
end;
marital = 2
* (kids le 0) + marital;
format
Origin Origin. Size Size.
Type Type. Home Home.
Sex Sex. Income Income.
Marital Marital.;
output;
datalines;
131112212121110121112201131211011211221122112121131122123211222212212201
121122023121221232211101122122022121110122112102131112211121110112311101
211112113211223121122202221122111311123131211102321122223221220221221101
122122022121220211212201221122021122110132112202213112111331226122221101
1212110231AA220232112212113112112121220212212202112111022222110212121221
211211012211222212211101313112113121220121112212121112212211222221112211
221111011112220122212201131211013121220113112222131112012131110221112211
121112212211121121112201321122311311221113112212213211013121220221221101
133211011212220233311102213111023211122121312222212212111111222121112211
133112011212112212112212212222022131222222121101111122022211220113112212
211112012232220121221102213211011131220121212201211122112331220233312202
222122012111220212112201221122112212220222212211311122012111110112212212
112222011131112221212202322211021222110121221101333211012232110132212101
223222013111220112211101211211022112110212211102221122021111220112111211
111122022121110113311122322111122221210222211101212122021211221232112202
1331110113112211213222012131221211112212221122021331220212121112121.2212
121122.22121210233112212222121011311122121211102211122112121110121212101
311212022231221112112211211211312221221213112212221122022222110131212202
213122211311221212112222113122221221220213111221121211221211221221221102
131122211211220221222101223112012111221212111102223122111311222121111102
2121110121112202133122222311122121312212112.2101312122012111122112112202
111212023121110111112221212111012211220221321101221211122121220112111112
212211022111110122221101121112112122110122122232221122212211221212112202
213122112211110212121201113211012221110232111102212211012112220121212202
221112011211220121221101211211022211221112121101111112212121221111221201
211122122122111212112221111122312132110113121101121122222111220222121102
221211012122110221221102312111012122220121121101121122221111222212221102
212122021222120113112202121122212121110113111101123112212111220113111101
221112211321210131212211121211011222110122112222123122023121223112212202
311211012131110131221102112211021131220213122201222111022121221221312202
131.22523221110122212221131112412211220221121112131222022122220122122201
212111011311220221312202221122123221210121222202223122121211221221111112
211111121211221221212201113122122131220222112222211122011311110112312211
211222013221220121211211312122122221220122112201111222011211110122311112
312111021231220122121101211112112.22110222112212121122122211110121112101
121211013211222121112222321112112112110121321101113111012221220121312201
213211012212220221211101321122121111220221121101122211021122110213112212
212122011211122131221101121211022212220212121101
;
* http://www.lion1906.com/Pages/francais/recherche/orthodromie/orthodromie.html
;
**
distances entre deux villes à vol d’oiseau Orthodromie ********;
*
voir aussi http://www.stat.lsu.edu/faculty/moser/exst7037/towns.html extraction coordonnées;
data ville;
title
'Distances inter villes françaises à vol d"oiseau ';
input (lille brest Bordeaux Toulouse chambery
reims rouen mulhouse nice marseille) (5.)
@56
ville $15.;
cards;
0 Lille
597
0 Brest
697
494 0
Bordeaux
790
702 212 0 Toulouse
600
849 515 416
0
Chambery
168
631 602 659
433 0 Reims
192
424 526 649
562 213 0 Rouen
446
880 687 648
265 295 496
0 Mulhouse
832 1044
635 468 232
664 792 449
0 Nice
834
951 507 320
256 670 758
517 157 0
Marseille
;
proc
print data=ville
; run ;
title2
"Distances ABSOLUTE ";
proc
MDS data=ville
out=MDS_out
level=ABSOLUTE /* niveau de mesure
"absolu" voir ci dessous*/
Dimension=2
PData PConfig PFinal;
id
ville; run;
%plotit(data=MDS_out,
datatype=mds, labelvar=ville, vtoh=1.75,
labfont=swissb);run;
title2 "Distances
ORDINAL";
%Include "mst.sas" / NoSource;
proc MDS data=ville out=MDS_out
level=ORDINAL
Dimension=2 PData PConfig PFinal;
id ville; run;
%plotit(data=MDS_out,
datatype=mds, labelvar=ville, vtoh=1.75,
labfont=swissb);run;
/*
LEVEL=ABSOLUTE no optimal transformations.
LEVEL=RATIO fits a regression model in which the distances are
multiplied by a slope parameter in each partition
LEVEL=INTERVAL fits a regression model in which the
distances are multiplied by a slope parameter and added to an intercept
parameter in each partition (an affine transformation). In this case, the
regression and measurement models differ if there is more than one partition.
LEVEL=LOGINTERVAL fits a regression model in which the
distances are raised to a power and multiplied by a slope parameter in each
partition (a power transformation).
LEVEL=ORDINAL fits a measurement model in which a least-squares monotone
increasing transformation is applied to the data in each partition. At the
ordinal measurement level, the regression and measurement models differ.
*/
- des macros :
http://www.math.yorku.ca/SCS/vcd/macros.html