650
Le logiciel R
C- Table de la loi normale centr´ ee-r´ eduite
8.1- phi <- function(x) {exp(-x^2/2)/sqrt(2 * pi)}
8.2- quantiles <- seq(0,5.5,by=0.01)
n <- length(quantiles)
probs <- vector(mode="numeric",length=n)
for (i in 1:n) probs[i] <- integrate(phi,lower=-Inf,
upper=quantiles[i],rel.tol=0.00001)$value
8.3- all.equal(probs,pnorm(quantiles))
8.4- plot(c(rev(-quantiles),quantiles),c(rev(1-probs),probs),type="l")
8.5- curve(pnorm(x),add=TRUE,col="blue")
D- Une analyse en composantes principales
8.1- url <- "http://www.biostatisticien.eu/springeR/climatvin.csv"
climatvin <- read.table(url,sep="\t",header=TRUE)
attach(climatvin)
names(climatvin)
8.2- X <- as.matrix(climatvin[,-c(1,6)])
8.3- g <- colMeans(X)
round(g,2)
8.4- Xpoint <- scale(X,scale=FALSE)
8.5- n <- nrow(X)
inertie <- sum(Xpoint^2)/n
inertie
8.6- contrinertie <- rowSums(Xpoint^2)/n/inertie
contrinertie
8.7- unn <- as.matrix(rep(1,n))
8.8- g
(g <- t(X)% * %unn/n)
8.9- Xpoint
(Xpoint <- X-unn% * %t(g))
8.10- (S <- t(Xpoint)% * %Xpoint/n)
cov(X) * (n-1)/n
Précédent

- 677/701

Suivant