Outils logiciels pour les cours Paris II
Cours Paris II
Stages/ Thèses/ Séminaires |
R
V <- c(1,2,3) X <- matrix(c(1,2,3,4,5,6),nrow=2,ncol=3)
cat("1 2 3 4", "2 6 7 8", "3 10 11 12", file="f.dat", sep="\n")
for(i in 1:5) print(1:i)
B %*% C
[,1] [,2] [,3] [,4] [1,] 0.1 2 2.0 1 [2,] 0.2 3 3.0 1 [3,] 0.1 4 4.1 1 # initial matrix B <- matrix(c(0.1,2,2,1,0.2,3,3,1,0.1,4,4.1,1), nrow = 3, ncol = 4, byrow = TRUE) print(B) # covariance matrix B.cov <- cov(B) print(B.cov) # eigenvectors and eigenvalues C <- eigen(B.cov) V <- C$vectors; VP <- C$values print("vecteurs propres"); print(VP) print(V) # restrict to the first 2 dimensions V1 <- V[1:4,1:2] print(V1) # projection of the initial matrix B1 <- B %*% V1 print(B1) |