Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- v1 <- c(1,1,1,1,1,1,1,1,1,1,3,3,3,3,3,4,5,6)
- v2 <- c(1,2,1,1,1,1,2,1,2,1,3,4,3,3,3,4,6,5)
- v3 <- c(3,3,3,3,3,1,1,1,1,1,1,1,1,1,1,5,4,6)
- v4 <- c(3,3,4,3,3,1,1,2,1,1,1,1,2,1,1,5,6,4)
- v5 <- c(1,1,1,1,1,3,3,3,3,3,1,1,1,1,1,6,4,5)
- v6 <- c(1,1,1,2,1,3,3,3,4,3,1,1,1,2,1,6,5,4)
- m1 <- cbind(v1,v2,v3,v4,v5,v6)
- cor(m1)
- factanal(m1, factors = 3) # varimax is the default
- factanal(m1, factors = 3, rotation = "promax")
- # The following shows the g factor as PC1
- prcomp(m1) # signs may depend on platform
- ## formula interface
- factanal(~v1+v2+v3+v4+v5+v6, factors = 3,
- scores = "Bartlett")$scores
- factanal(~v1+v2+v3+v4+v5+v6, factors = 3,
- scores = "Bartlett")$scores[,1]
- factor1scores <- factor1$scores[,1]
- data1 <- cbind(data, factor1scores)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement