Advertisement
kukis03

Untitled

Jan 16th, 2024
19
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. library(readxl)
  2. datos=read_excel("D:/Descargas/DATABASES/practica componentes principales.xlsx")
  3. datos1=datos[c(1:30),c(11:19)]
  4. plot(datos1)
  5. m=princomp(datos1,cor=TRUE)
  6. m$scores
  7. cor(datos1)
  8. valvec=eigen(cor(datos1))
  9. a=(m$scores[,1])/sqrt(valvec$values[1])
  10. b=(m$scores[,2])/sqrt(valvec$values[2])
  11. c=(m$scores[,3])/sqrt(valvec$values[3])
  12.  
  13. Arl=370
  14. alfag=1/Arl
  15. alfai=1-(1-alfag)^(1/3)
  16. alfamedio=alfai/2
  17.  
  18. LCI=qnorm(alfamedio)
  19. LCS=-LCI
  20.  
  21. datos2=datos[c(31:40),c(11:19)]
  22. msc=m$scores
  23. d=predict(m,newdata=datos2)
  24. l=rbind(msc,d)
  25.  
  26. a=(l[,1])/sqrt(valvec$values[1])
  27. b=(l[,2])/sqrt(valvec$values[2])
  28. c=(l[,3])/sqrt(valvec$values[3])
  29. plot(a,b)
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement