Advertisement
Guest User

AFC

a guest
Dec 26th, 2011
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
R 1.04 KB | None | 0 0
  1.  
  2.  
  3.  
  4. mat_orig <- matrix(c(
  5. 11100,
  6. 04850,
  7. 00034
  8. ), ncol = 3)
  9.  
  10. colnames(mat_orig) <- c('[5,10[','[10,15[','[15,20]')
  11.  
  12. rownames(mat_orig) <- c('[0,4[','[4,8[','[8,12[','[12,16[','[16,20[')
  13.  
  14. mat_orig
  15.  
  16.  
  17. mat_fi <- matrix(c(
  18. 0.888888889,    0.088888889,    0, -0.111111111,    -0.111111111,
  19. -0.62962963,    0.17037037, 0.259259259,    -0.00462963,    -0.62962963,
  20. -0.259259259, -0.259259259, -0.259259259,   0.115740741,    0.740740741
  21. ), ncol = 3)
  22.  
  23. mat_fi
  24.  
  25.  
  26. mat_mp <- matrix(c(
  27.  9.00000, 0, 0,
  28.  0, 1.58824, 0,
  29.  0, 0, 3.85714  
  30. ), ncol=3)
  31.  
  32. mat_mp
  33.  
  34. mat_mn <- matrix(c(
  35.  27.0000, 0, 0, 0, 0,
  36.  0, 5.4000, 0, 0, 0,
  37.  0, 0, 3.0000, 0, 0,
  38.  0, 0, 0, 3.3750, 0,
  39.  0, 0, 0, 0, 6.7500
  40. ), ncol=5)
  41.  
  42. mat_mn
  43.  
  44.  
  45. res_col <- eigen(mat_mp %*% t(mat_fi) %*% solve(mat_mn) %*% mat_fi)
  46.  
  47. res_col
  48.  
  49. comp_col <- matrix(c(
  50.     mat_fi %*% matrix(res_col$vectors[,1], ncol=1) * -2.0897 ,
  51.     mat_fi %*% matrix(res_col$vectors[,2], ncol=1) *  4.75
  52. ), ncol=2)
  53.  
  54.  
  55. comp_col
  56.  
  57.  
  58. library(FactoMineR)
  59.  
  60. test_ca <- CA(mat_orig)
  61. comp_col
  62. test_ca$row$coord
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement