Université Pierre et Marie Curie

Analyse de données - Ordinations et groupements

Chapitre 1. Introduction
Chapitre 2. L'Analyse en Composantes Principales (ACP)
2.1. Présentation
2.2. Formulaire
2.3. Exemple
2.4. Exemple programme Matlab
Chapitre 3. L'Analyse des Correspondances (AFC)
Chapitre 4. L'Analyse des Correspondances Multiples(AFCM)
Chapitre 5. Méthodes de classifications
Chapitre 6. Autres types de groupements.
Chapitre 7. Références
Page d'accueilTable des matièresNiveau supérieurPage précédenteBas de la pagePage suivante

2.4. Exemple programme Matlab

Exemple de calcul d'une ACP avec MATLAB.
MATLAB
Résultats
x= [38.01 ---------43.78 ];
[nligne ncol] =size(x);

Lecture du tableau et calcul des dimensions
nligne =25
ncol =5

moy = mean(x)'

vecteur des moyennes
moy =
40.9544
108.0376
42.0076
268.3640
91.5688

ect=std(x)'

vecteur des ecarts-types
ect =
12.1300
170.7207
33.5872
151.5456
19.2988

vunit=linspace(1,1,nligne)'
y=x-vunit*moy';

Centrage des données
y =
-2.9444 -103.5476 -14.4576 -97.8140 -0.3588
-3.0644 -96.3076 32.2624 -119.2740 15.2712
-1.2844 -95.2076 -9.2476 -83.7340 7.1612
-4.3744 -81.9476 0.7624 -96.1740 -13.3988
-7.4944 -104.1776 3.0724 -85.2540 3.2412
-10.2744 -101.2376 -1.4576 -59.6040 -2.0888
-10.3744 395.1424 -16.3776 -98.0940 -14.8188
-6.3944 -105.3776 26.0224 -38.8840 7.3512
-11.4144 -101.4676 0.2024 -81.6040 -3.8888
-7.8744 -98.4076 -30.6576 -29.1540 -27.9988
-3.4244 -96.7576 120.3724 -81.3240 40.3812
-7.7144 175.0824 -7.6776 -114.3440 -2.3688
0.9656 -88.0376 -36.0576 -85.3540 -26.7388
-4.5744 -76.8876 6.0624 -40.3640 6.3212
-9.5844 191.4324 8.5824 -45.1140 24.6712
10.2756 -80.2776 -27.0176 -31.5240 9.7812
25.3656 -52.4976 68.8924 63.7860 29.3012
-4.3144 -52.4976 -9.7776 1.7660 -10.3188
23.6556 -70.1376 -25.8576 222.5860 0.0412
13.7056 13.6024 -24.4276 386.7760 -12.2888
4.7756 283.7924 -14.4476 150.6360 14.3812
11.4656 -72.9876 -6.9076 426.1660 -12.5688
26.7456 507.1724 -8.2676 92.4360 22.2712
-1.3944 -21.8176 -7.9576 25.9360 -5.5488
-20.4544 -66.6476 -25.6376 -182.4740 -47.7888

 


ds=diag(ect)^-1

Matrice diagonale des 1/ect
ds =
0.0824 0 0 0 0
0 0.0059 0 0 0
0 0 0.0298 0 0
0 0 0 0.0066 0
0 0 0 0 0.0518

z=y*ds

Matrice des données centrées et reduites
z =
-0.2427 -0.6065 -0.4305 -0.6454 -0.0186
-0.2526 -0.5641 0.9606 -0.7871 0.7913
-0.1059 -0.5577 -0.2753 -0.5525 0.3711
-0.3606 -0.4800 0.0227 -0.6346 -0.6943
-0.6178 -0.6102 0.0915 -0.5626 0.1679
-0.8470 -0.5930 -0.0434 -0.3933 -0.1082
-0.8553 2.3146 -0.4876 -0.6473 -0.7679
-0.5272 -0.6173 0.7748 -0.2566 0.3809
-0.9410 -0.5943 0.0060 -0.5385 -0.2015
-0.6492 -0.5764 -0.9128 -0.1924 -1.4508
-0.2823 -0.5668 3.5839 -0.5366 2.0924
-0.6360 1.0255 -0.2286 -0.7545 -0.1227
0.0796 -0.5157 -1.0736 -0.5632 -1.3855
-0.3771 -0.4504 0.1805 -0.2663 0.3275
-0.7901 1.1213 0.2555 -0.2977 1.2784
0.8471 -0.4702 -0.8044 -0.2080 0.5068
2.0911 -0.3075 2.0512 0.4209 1.5183
-0.3557 -0.3075 -0.2911 0.0117 -0.5347
1.9502 -0.4108 -0.7699 1.4688 0.0021
1.1299 0.0797 -0.7273 2.5522 -0.6368
0.3937 1.6623 -0.4302 0.9940 0.7452
0.9452 -0.4275 -0.2057 2.8121 -0.6513
2.2049 2.9708 -0.2462 0.6100 1.1540
-0.1150 -0.1278 -0.2369 0.1711 -0.2875
-1.6863 -0.3904 -0.7633 -1.2041 -2.4763

v=(z'*z)/nligne

Matrice des corrélations
v =
0.9600 0.2105 0.0413 0.6568 0.3738
0.2105 0.9600 -0.1478 0.1199 0.1857
0.0413 -0.1478 0.9600 -0.1437 0.6750
0.6568 0.1199 -0.1437 0.9600 0.0437
0.3738 0.1857 0.6750 0.0437 0.9600

[f h] = eig(v)
Vecteurs propres :
f =
0.5657 -0.4505 -0.1819 -0.2948 0.5976
-0.2261 -0.1674 0.8987 -0.2246 0.2506
-0.4433 -0.5125 -0.1319 0.6516 0.3145
-0.6158 0.2641 -0.3493 -0.4911 0.4334
0.2307 0.6607 0.1410 0.4438 0.5416

Valeurs propres :
h =
0.2809 0 0 0 0
0 0.1520 0 0 0
0 0 0.9216 0 0
0 0 0 1.5603 0
0 0 0 0 1.8852

coord=z*f

Coordonnées des individus sur les axes
coord =
0.5838 0.2488 -0.2213 0.2360 -0.7222
0.2261 0.0309 -0.2012 1.5647 0.0973
0.6141 0.3814 -0.2003 0.4131 -0.3281
0.1251 -0.3952 -0.2450 0.2324 -0.9797
0.1331 0.2960 -0.2279 0.7296 -0.6462
-0.1086 0.3277 -0.2510 0.4997 -0.8975
-0.5695 -0.4306 2.4178 -0.6082 -0.7809
-0.2562 0.1276 -0.4177 1.0939 -0.1309
-0.1155 0.2450 -0.2041 0.5898 -1.0519
-0.0485 -0.1526 -0.4169 -0.8233 -1.6886
-0.8069 -0.3740 -0.4481 3.7378 1.7172
-0.0540 -0.0484 1.3137 0.1243 -0.5884
0.6647 -0.4635 -0.3350 -0.9454 -1.4138
0.0481 0.2989 -0.2207 0.6061 -0.2195
-0.3355 0.8033 1.4020 0.8612 0.4526
1.1871 0.3893 -0.3265 -0.3412 0.3198
0.4343 -0.8275 -0.8602 1.2561 2.8224
-0.1332 0.0107 -0.2527 -0.2588 -0.6657
0.6332 -0.0259 -1.1352 -1.7047 1.4580
-0.7751 0.1037 -1.0193 -2.3608 1.2277
-0.4027 0.5197 1.2369 -0.9271 1.3510
-1.1595 0.0635 -1.6031 -1.9867 1.2591
0.5753 -0.4409 2.2508 -1.2650 2.8740
-0.1028 0.0498 -0.1630 -0.3034 -0.2568
-0.3570 -0.7379 0.1280 -0.4202 -3.2086

   

 

Page d'accueilTable des matièresNiveau supérieurPage précédenteHaut de la pagePage suivante