25.07.2013 Views

Correction TD 1 analyse de données Exercice 1:

Correction TD 1 analyse de données Exercice 1:

Correction TD 1 analyse de données Exercice 1:

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

ESA 3 <strong>TD</strong>1 <strong>analyse</strong> <strong>de</strong> <strong>données</strong>: correction p. 1<br />

<strong>Correction</strong> <strong>TD</strong> 1 <strong>analyse</strong> <strong>de</strong> <strong>données</strong> I-3-c<br />

On calcule soit la trace <strong>de</strong> la matrice V soit la somme <strong>de</strong>s variances, ici 3.<br />

<strong>Exercice</strong> 1:<br />

> T apply(T,2,mean) ♣ applique la fonction mean<br />

[1] 1 1 1 à T suivant les colonnes (2)<br />

> apply(T,2,sd) ♣ sd (standard <strong>de</strong>viation) utilise n-1 et non n<br />

[1] 0.82 1.16 1.16 pour le calcul.<br />

I - 2<br />

> X X la SCE est divisé par n-1 au<br />

[,1] [,2] [,3] lieu <strong>de</strong> n d'où la correction<br />

[1,] 0.00 -1 -1 par sqrt(n/n-1)<br />

[2,] 0.00 1 -1<br />

[3,] 1.41 1 1<br />

[4,] -1.41 -1 1<br />

I-3-a<br />

> VV F


ESA 3 <strong>TD</strong>1 <strong>analyse</strong> <strong>de</strong> <strong>données</strong>: correction p. 2<br />

II-3 calcul <strong>de</strong>s QLT<br />

III-1 Calcul <strong>de</strong>s coor<strong>données</strong> <strong>de</strong>s variables G<br />

> G diag(inertie^(-1))%*%F^2/4<br />

[,1] [,2] [,3]<br />

[1,] 0.25 0.50 0.25 ♣ diag : matrice<br />

[2,] 0.25 0.50 0.25 diagonale <strong>de</strong>s<br />

[3,] 0.73 0.25 0.02 inverses <strong>de</strong>s inerties<br />

[4,] 0.73 0.25 0.02<br />

II-4 calcul <strong>de</strong>s CTR<br />

> F^2%*%diag(eigen(V)$values^(-1))/4<br />

[,1] [,2] [,3]<br />

[1,] 0.07 0.25 0.43 ♣ diag(eigen(V)$values^(-1))<br />

[2,] 0.07 0.25 0.43 matrice diagonale avec<br />

[3,] 0.43 0.25 0.07 l'inverse <strong>de</strong>s valeurs propres.<br />

[4,] 0.43 0.25 0.07<br />

II-5<br />

> plot(F[,1],F[,2],main="plan F1 F2")<br />

Individus<br />

♣ plot(x,y) : nuage <strong>de</strong> points avec x=F1 y=F2<br />

III-2 CTR <strong>de</strong>s variables<br />

>vecteurs%*%G^2%*%diag(eigen(cor(X))$values^(-1)<br />

[,1] [,2] [,3]<br />

[1,] 0.5 0 0.5<br />

[2,] 0.5 0 0.5<br />

[3,] 0.0 1 0.0<br />

III-3<br />

>plot(G[,1],G[,2],main="plan F1 F2")<br />

<strong>Exercice</strong> 2<br />

I-1<br />

> T colnames(T) gI


ESA 3 <strong>TD</strong>1 <strong>analyse</strong> <strong>de</strong> <strong>données</strong>: correction p. 3<br />

I-2<br />

7.545x1 + 7.545x2 - 15.09x3 = 0 donc 7.545[( x2+ x3)/2] + 7.545x2 - 15.09x3=0<br />

> Y t(Y)<br />

=> x1 = x2 = x3 et en normant on trouve x=±0.577 (3x²=1)<br />

[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11]<br />

math -5 -4 -3 -2 -1 0 1 2 3 4 5<br />

musi 0 -5 -2 -1 -3 -4 3 1 2 4 5<br />

I-5<br />

a. λ1 = 25.091<br />

fran -4 0 -1 -3 -2 -5 2 3 1 4 5 b. λ1/trace = 25.091/30 = 83.6 %<br />

I-3<br />

> V V<br />

math musi fran<br />

math 10.000000 7.545455 7.545455<br />

musi 7.545455 10.000000 7.545455<br />

fran 7.545455 7.545455 10.000000<br />

V représente la matrice <strong>de</strong> covariance <strong>de</strong> Y.<br />

L'inertie est égale à la trace <strong>de</strong> V (10+10+10) ou la<br />

somme <strong>de</strong>s variances.<br />

I-4 (valeurs et vecteurs propres <strong>de</strong> V)<br />

> eigen(V)<br />

$values<br />

[1] 25.090909 2.454545 2.454545<br />

$vectors<br />

[,1] [,2] [,3]<br />

[1,] 0.5773503 0.8164966 0.0000000<br />

[2,] 0.5773503 -0.4082483 -0.7071068<br />

[3,] 0.5773503 -0.4082483 0.7071068<br />

Recherche manuelle <strong>de</strong> u1 :<br />

10x1 + 7.545x2 + 7.545x3 = λ x1 recherche <strong>de</strong>s espaces propres<br />

7.545x1 + 10x2 + 7.545x3 = λx2 f(U) = λ.U<br />

7.545x1 + 7.545x2 + 10x3 = λx3<br />

pour λ = 25.091<br />

-15.09x1 + 7.545x2 + 7.545x3 = 0 => x1=( x2 + x3)/2<br />

7.545x1 – 15.09x2 + 7.545x3 = 0<br />

II-1<br />

> Y%*%eigen(V)$vectors (extrait)<br />

math musi fran<br />

[1,] -5.196152 -2.449490e+00 -2.828427e+00<br />

[2,] -5.196152 -1.224745e+00 3.535534e+00<br />

Gf i ²<br />

II-2 3 COR(i/F1) = *1000 [F]²n1/somme marginale ligne [F]²<br />

Gi²<br />

ind1 658,537 185,010 156,454<br />

ind4 857,143 1,834 141,024<br />

II-4 CTR(i/F1) =<br />

p.jGf<br />

i ²<br />

N<br />

*1000 donc ([F]n1² * 1/n)/λ1<br />

p Gf ²<br />

∑<br />

k = 1<br />

. k<br />

ind1 97.8 ind4 43.5<br />

Indivsup<br />

III-1<br />

-4,04<br />

5,19<br />

k


ESA 3 <strong>TD</strong>1 <strong>analyse</strong> <strong>de</strong> <strong>données</strong>: correction p. 4<br />

>G T X tXX eigen(tXX)<br />

$values<br />

[1] 2.000000e+00 1.000000e+00 9.860761e-32<br />

$vectors<br />

[,1] [,2] [,3]<br />

[1,] 0.0000000 1 0.0000000<br />

[2,] 0.7071068 0 0.7071068<br />

[3,] -0.7071068 0 0.7071068<br />

> F G

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!