1. Importer les données

decath <- read.table("https://r-stat-sc-donnees.github.io/decathlon.csv", 
                     sep = ";", dec = ".", header = TRUE, row.names = 1, check.names = FALSE)
summary(decath)
      100m          Longueur        Poids          Hauteur           400m           110m H     
 Min.   :10.44   Min.   :6.61   Min.   :12.68   Min.   :1.850   Min.   :46.81   Min.   :13.97  
 1st Qu.:10.85   1st Qu.:7.03   1st Qu.:13.88   1st Qu.:1.920   1st Qu.:48.93   1st Qu.:14.21  
 Median :10.98   Median :7.30   Median :14.57   Median :1.950   Median :49.40   Median :14.48  
 Mean   :11.00   Mean   :7.26   Mean   :14.48   Mean   :1.977   Mean   :49.62   Mean   :14.61  
 3rd Qu.:11.14   3rd Qu.:7.48   3rd Qu.:14.97   3rd Qu.:2.040   3rd Qu.:50.30   3rd Qu.:14.98  
 Max.   :11.64   Max.   :7.96   Max.   :16.36   Max.   :2.150   Max.   :53.20   Max.   :15.67  
     Disque          Perche         Javelot          1500m         Classement        Points    
 Min.   :37.92   Min.   :4.200   Min.   :50.31   Min.   :262.1   Min.   : 1.00   Min.   :7313  
 1st Qu.:41.90   1st Qu.:4.500   1st Qu.:55.27   1st Qu.:271.0   1st Qu.: 6.00   1st Qu.:7802  
 Median :44.41   Median :4.800   Median :58.36   Median :278.1   Median :11.00   Median :8021  
 Mean   :44.33   Mean   :4.762   Mean   :58.32   Mean   :279.0   Mean   :12.12   Mean   :8005  
 3rd Qu.:46.07   3rd Qu.:4.920   3rd Qu.:60.89   3rd Qu.:285.1   3rd Qu.:18.00   3rd Qu.:8122  
 Max.   :51.65   Max.   :5.400   Max.   :70.52   Max.   :317.0   Max.   :28.00   Max.   :8893  
   Competition
 Decastar:13  
 JO      :28  
              
              
              
              

2 et 3. Paramètres de l’ACP

library(FactoMineR)
res.pca <- PCA(decath, quanti.sup = 11:12, quali.sup = 13)

4. Choisir le nombre d’axes

barplot(res.pca$eig[,2],names=paste("Dim",1:nrow(res.pca$eig)))

5. Analyser les résultats

summary(res.pca, ncp = 2, nbelements = 3)

Call:
PCA(X = decath, quanti.sup = 11:12, quali.sup = 13) 


Eigenvalues
                       Dim.1   Dim.2   Dim.3   Dim.4   Dim.5   Dim.6   Dim.7   Dim.8   Dim.9
Variance               3.272   1.737   1.405   1.057   0.685   0.599   0.451   0.397   0.215
% of var.             32.719  17.371  14.049  10.569   6.848   5.993   4.512   3.969   2.148
Cumulative % of var.  32.719  50.090  64.140  74.708  81.556  87.548  92.061  96.030  98.178
                      Dim.10
Variance               0.182
% of var.              1.822
Cumulative % of var. 100.000

Individuals (the 3 first)
               Dist    Dim.1    ctr   cos2    Dim.2    ctr   cos2  
Sebrle     |  4.843 |  4.038 12.158  0.695 |  1.366  2.619  0.080 |
Clay       |  4.647 |  3.919 11.451  0.711 |  0.837  0.984  0.032 |
Karpov     |  5.006 |  4.620 15.911  0.852 |  0.040  0.002  0.000 |

Variables (the 3 first)
              Dim.1    ctr   cos2    Dim.2    ctr   cos2  
100m       | -0.775 18.344  0.600 |  0.187  2.016  0.035 |
Longueur   |  0.742 16.822  0.550 | -0.345  6.869  0.119 |
Poids      |  0.623 11.844  0.388 |  0.598 20.607  0.358 |

Supplementary continuous variables
              Dim.1   cos2    Dim.2   cos2  
Classement | -0.671  0.450 |  0.051  0.003 |
Points     |  0.956  0.914 | -0.017  0.000 |

Supplementary categories
               Dist    Dim.1   cos2 v.test    Dim.2   cos2 v.test  
Decastar   |  0.946 | -0.600  0.403 -1.430 | -0.038  0.002 -0.123 |
JO         |  0.439 |  0.279  0.403  1.430 |  0.017  0.002  0.123 |
plot(res.pca, choix = "ind", habillage = 13, cex = 1.1,
  select = "cos2 0.6", title = "Graphe des individus")

# axes 3 et 4
plot(res.pca, choix = "ind", habillage = 13, axes = 3:4, cex = 0.7)

plot(res.pca, choix = "var", habillage = 13, axes = 3:4, new.plot = TRUE)

6. Décrire de façon automatique les principales dimensions de variabilité

dimdesc(res.pca, proba = 0.2)
$`Dim.1`
$`Dim.1`$`quanti`
           correlation      p.value
Points       0.9561543 2.099191e-22
Longueur     0.7418997 2.849886e-08
Poids        0.6225026 1.388321e-05
Hauteur      0.5719453 9.362285e-05
Disque       0.5524665 1.802220e-04
Javelot      0.2771108 7.942460e-02
Classement  -0.6705104 1.616348e-06
400m        -0.6796099 1.028175e-06
110m H      -0.7462453 2.136962e-08
100m        -0.7747198 2.778467e-09

$`Dim.1`$quali
                    R2   p.value
Competition 0.05110487 0.1552515

$`Dim.1`$category
           Estimate   p.value
JO        0.4393744 0.1552515
Decastar -0.4393744 0.1552515


$Dim.2
$Dim.2$`quanti`
         correlation      p.value
Disque     0.6063134 2.650745e-05
Poids      0.5983033 3.603567e-05
400m       0.5694378 1.020941e-04
1500m      0.4742238 1.734405e-03
Hauteur    0.3502936 2.475025e-02
Javelot    0.3169891 4.344974e-02
110m H     0.2287933 1.501925e-01
Longueur  -0.3454213 2.696969e-02


$Dim.3
$Dim.3$`quanti`
        correlation      p.value
1500m     0.7821428 1.554450e-09
Perche    0.6917567 5.480172e-07
Hauteur  -0.2595119 1.013160e-01
Javelot  -0.3896554 1.179331e-02

7. Retour aux données brutes

round(scale(decath[,1:12]),2)
             100m Longueur Poids Hauteur  400m 110m H Disque Perche Javelot 1500m Classement
Sebrle      -0.56     1.83  2.28    1.61 -1.09  -1.18   1.30   0.85    2.53  0.08      -1.40
Clay        -2.12     2.21  0.91    0.94 -0.37  -1.01   1.71   0.49    2.36  0.25      -1.28
Karpov      -1.89     1.74  1.76    1.27 -2.43  -1.35   2.17  -0.58   -0.58 -0.08      -1.15
Macey       -0.41     0.66  1.52    1.95 -0.56  -0.10   1.19  -1.30    0.03 -1.17      -1.03
Warners     -1.44     1.52  0.00   -0.08 -1.43  -1.26  -0.18   0.49   -0.61 -0.08      -0.90
Zsivoczky   -0.33    -0.38  1.01    1.61 -0.19   0.73   0.38  -0.22    1.06 -0.81      -0.77
Hernu       -0.11    -0.22  0.21    0.60 -0.77  -0.75   0.12   0.14   -0.12 -1.26      -0.65
Nool        -0.75     0.85 -0.26   -1.09 -0.70   0.41  -0.67   2.29    0.62 -0.23      -0.52
Bernard     -1.17     0.70  0.39    1.61 -0.42  -0.92   0.13  -1.30   -0.63 -0.23      -0.39
Schwarzl    -0.07     0.73 -0.57   -0.41  0.12  -0.75  -0.56   1.21   -0.41 -0.47      -0.27
Pogorelov   -0.18     0.16  0.76    0.94  1.02  -0.84   0.08   0.85   -1.01  0.74      -0.14
Schoenbeck  -0.37     0.13  0.36   -1.09  0.59  -0.56   0.02   0.85    0.53 -0.02      -0.02
Barras       0.54    -0.85  0.53   -0.41 -0.18  -0.50   0.15  -0.58    1.29 -1.02       0.11
Smith       -0.56    -1.42  0.93   -0.75 -0.30  -1.26   1.39  -2.02    0.66 -0.54       0.24
Averyanov   -1.70     0.25 -0.04   -0.41  0.09  -0.46  -1.32   0.14   -0.79 -0.69       0.36
Ojaniemi    -1.21     0.76  0.60   -0.41 -0.43   0.86  -1.18  -0.58    0.20 -0.28       0.49
Smirnov     -0.41    -0.60 -0.72   -0.41 -0.44   0.35  -0.55  -0.22    0.53 -1.35       0.62
Qi           0.24     0.25 -1.12   -0.08  0.03   0.37   0.24  -0.94    0.51 -0.55       0.74
Drews       -0.49     0.38 -1.71   -1.09 -0.96  -1.26  -1.25   0.85   -1.41 -0.41       0.87
Parkhomenko  0.54    -2.05  1.47    0.60  1.23   0.58  -0.72   0.14    1.55 -0.09       0.99
Terek       -0.30    -1.01  0.82   -0.41 -0.05   1.09   0.38   1.93   -1.59  0.97       1.12
Gomez        0.31     0.00  0.11   -1.43 -0.87  -0.42  -1.00  -1.30    0.50 -0.80       1.25
Turi         0.31    -1.11 -1.04    0.60  1.78  -0.73  -1.33   0.14    0.21  0.94       1.37
Lorenzo      0.39    -0.73 -1.52   -1.43 -0.24   1.64  -1.22  -0.94    0.01 -1.37       1.50
Karlivans    1.26     0.00 -1.43   -0.08  0.80   0.79  -0.29  -0.94   -1.12 -0.03       1.63
Korkizoglou -0.52    -0.60  0.40   -0.41  1.34   0.75   0.52  -0.22   -1.09  3.25       1.75
Uldal        0.88    -0.85 -1.15   -1.43  1.16   1.03  -0.39  -0.94    0.35  0.23       1.88
Casarsa      1.38    -1.83  0.54   -0.41  3.11   1.66   1.28  -1.30    0.06  1.46       2.01
SEBRLE       0.16     1.01  0.43    1.05  0.17   0.18  -0.17   0.93    1.01  1.09      -1.40
CLAY        -0.91     0.44 -0.26   -1.31 -0.21  -1.18   1.89   0.57    0.38  1.93      -1.28
KARPOV       0.08     0.13  0.36    0.71 -1.08  -1.09   1.37   0.57   -1.66  1.81      -1.15
BERNARD      0.08    -0.09 -0.28   -0.64 -0.60   0.81  -1.02   2.01    0.92  0.09      -1.03
YURKOV       1.30    -0.54  0.86    1.38  0.70   1.49   0.57  -0.15    1.06 -0.22      -0.90
WARNERS      0.43     1.07 -0.20    0.04 -0.81  -0.80  -0.95   0.57   -1.36 -0.08      -0.77
ZSIVOCZKY    0.50     0.13 -1.21    0.37 -0.86  -0.92   0.40  -1.23   -0.61 -0.94      -0.65
McMULLEN    -0.64     0.16 -0.87    1.72  0.25  -0.48   0.02  -1.23   -0.40  0.52      -0.52
MARTINEAU    2.44    -1.42  0.11   -0.30  0.45   0.69   0.97   0.57   -1.24 -1.45      -0.39
HERNU        1.41     0.95 -0.08   -1.31  1.29   0.96   0.20   0.21   -0.23  0.52      -0.27
BARRAS       1.26    -0.92 -0.47   -0.30 -0.12  -0.27  -0.66  -0.15   -0.60  0.25      -0.14
NOOL         1.26     0.03 -2.18    0.04 -0.36   1.45  -1.90  -0.51   -0.18 -1.06      -0.02
BOURGUIGNON  1.38    -1.45 -1.23   -1.31  1.34   2.26  -1.14   0.93   -0.75  1.09       0.11
            Points
Sebrle        2.59
Clay          2.38
Karpov        2.10
Macey         1.19
Warners       0.99
Zsivoczky     0.82
Hernu         0.68
Nool          0.67
Bernard       0.64
Schwarzl      0.28
Pogorelov     0.23
Schoenbeck    0.21
Barras        0.18
Smith         0.05
Averyanov     0.05
Ojaniemi      0.00
Smirnov      -0.04
Qi           -0.21
Drews        -0.23
Parkhomenko  -0.26
Terek        -0.33
Gomez        -0.41
Turi         -0.87
Lorenzo      -1.21
Karlivans    -1.23
Korkizoglou  -1.26
Uldal        -1.49
Casarsa      -1.76
SEBRLE        0.62
CLAY          0.34
KARPOV        0.27
BERNARD       0.18
YURKOV        0.09
WARNERS       0.07
ZSIVOCZKY     0.00
McMULLEN     -0.03
MARTINEAU    -0.59
HERNU        -0.80
BARRAS       -0.87
NOOL         -1.03
BOURGUIGNON  -2.02
attr(,"scaled:center")
       100m    Longueur       Poids     Hauteur        400m      110m H      Disque      Perche 
  10.998049    7.260000   14.477073    1.976829   49.616341   14.605854   44.325610    4.762439 
    Javelot       1500m  Classement      Points 
  58.316585  279.024878   12.121951 8005.365854 
attr(,"scaled:scale")
        100m     Longueur        Poids      Hauteur         400m       110m H       Disque 
  0.26302300   0.31640164   0.82442781   0.08895052   1.15345081   0.47178902   3.37784476 
      Perche      Javelot        1500m   Classement       Points 
  0.27799982   4.82682018  11.67324722   7.91894918 342.38514542 
round(cor(decath[1:12,1:12]),2)
            100m Longueur Poids Hauteur  400m 110m H Disque Perche Javelot 1500m Classement Points
100m        1.00    -0.78 -0.22   -0.15  0.59   0.45  -0.57   0.21   -0.17 -0.37       0.55  -0.63
Longueur   -0.78     1.00  0.35    0.11 -0.57  -0.59   0.56   0.07    0.39  0.45      -0.69   0.80
Poids      -0.22     0.35  1.00    0.75 -0.36  -0.19   0.85  -0.44    0.43  0.09      -0.69   0.74
Hauteur    -0.15     0.11  0.75    1.00 -0.24  -0.10   0.65  -0.77    0.13 -0.17      -0.55   0.49
400m        0.59    -0.57 -0.36   -0.24  1.00   0.32  -0.50   0.26   -0.04  0.20       0.71  -0.63
110m H      0.45    -0.59 -0.19   -0.10  0.32   1.00  -0.36   0.12    0.14 -0.45       0.23  -0.38
Disque     -0.57     0.56  0.85    0.65 -0.50  -0.36   1.00  -0.49    0.39  0.10      -0.76   0.85
Perche      0.21     0.07 -0.44   -0.77  0.26   0.12  -0.49   1.00    0.24  0.39       0.26  -0.17
Javelot    -0.17     0.39  0.43    0.13 -0.04   0.14   0.39   0.24    1.00  0.09      -0.56   0.65
1500m      -0.37     0.45  0.09   -0.17  0.20  -0.45   0.10   0.39    0.09  1.00       0.09   0.17
Classement  0.55    -0.69 -0.69   -0.55  0.71   0.23  -0.76   0.26   -0.56  0.09       1.00  -0.93
Points     -0.63     0.80  0.74    0.49 -0.63  -0.38   0.85  -0.17    0.65  0.17      -0.93   1.00

Factoshiny

library(Factoshiny)
res.shiny <- PCAshiny(decath)

Pour aller plus loin

plotellipses(res.pca)

LS0tDQp0aXRsZTogIkFuYWx5c2UgZW4gQ29tcG9zYW50ZXMgUHJpbmNpcGFsZXMiDQphdXRob3I6ICJIdXNzb24gZXQgYWwuIg0KZGF0ZTogIjA1LzA5LzIwMTgiDQpvdXRwdXQ6DQogIGh0bWxfbm90ZWJvb2s6DQogICAgdG9jOiB5ZXMNCiAgICB0b2NfZGVwdGg6IDMNCiAgICB0b2NfZmxvYXQ6IHllcw0KICBodG1sX2RvY3VtZW50Og0KICAgIHRvYzogeWVzDQogICAgdG9jX2RlcHRoOiAnMycNCiAgICB0b2NfZmxvYXQ6IHllcw0KLS0tDQoNCiMgMS4gSW1wb3J0ZXIgbGVzIGRvbm7DqWVzDQoNCmBgYHtyfQ0KZGVjYXRoIDwtIHJlYWQudGFibGUoImh0dHBzOi8vci1zdGF0LXNjLWRvbm5lZXMuZ2l0aHViLmlvL2RlY2F0aGxvbi5jc3YiLCANCiAgICAgICAgICAgICAgICAgICAgIHNlcCA9ICI7IiwgZGVjID0gIi4iLCBoZWFkZXIgPSBUUlVFLCByb3cubmFtZXMgPSAxLCBjaGVjay5uYW1lcyA9IEZBTFNFKQ0Kc3VtbWFyeShkZWNhdGgpDQpgYGANCg0KIyAyIGV0IDMuIFBhcmFtw6h0cmVzIGRlIGwnQUNQDQoNCmBgYHtyLG1lc3NhZ2U9RkFMU0Usd2FybmluZz1GQUxTRX0NCmxpYnJ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