Académique Documents
Professionnel Documents
Culture Documents
attach(climatvin)
#8.2
X <- as.matrix(climatvin[,-c(1,6)])
#8.3
g <- apply(X,FUN=mean,2)
round(g,2)
#8.4
#8.5
n <- nrow(X)
p <- ncol(X)
inertie
#8.6
contrinertie
#8.7
unn <- as.matrix(rep(1,n))
#8.8
g <- t(X)%*%unn/n
#8.9
#8.10
S <- t(Xpoint)%*%Xpoint/n
S <- cov(X)*(n-1)/n
#8.11
#8.12
Z <- Xpoint%*%Dunsurs
#8.13
R <- t(Z)%*%Z/n
R <- cor(X)
#8.14
W <- eigen(R,symmetric=T)$vectors
#8.15
x <- cos(theta)
y <- sin(theta)
plot(x,y,type="l")
abline(h=0,v=0)
A <- W%*%Lambda^(1/2)
text(A[,1:2],colnames(X))
arrows(rep(0,4),rep(0,4),A[,1],A[,2],length=0.1)
#8.16
cumsum(diag(Lambda))/p*100
#8.17
CW <- Z%*%W
#8.18
dev.new()
text(CW[,c(1,2)],labels=ANNEE)
abline(h=0,v=0)
#8.19
text(bon,labels=ANNEE[QUALITE==1],col="red")
text(moyen,labels=ANNEE[QUALITE==2],col="blue")
text(mediocre,labels=ANNEE[QUALITE==3],col="green")
abline(h=0,v=0)
legend("topleft",c("bon","moyen","mediocre"),fill=c("red","blue","green"))
#8.20
round(QLT,2)
#8.21
require(ade4)
#8.22
scatter(res)
s.class(res$li,as.factor(climatvin[,6]))