Re: [R] factanal

From: <Bill.Venables_at_csiro.au>
Date: Mon, 14 May 2007 09:49:39 +1000

Soare Marcian-Alin asks

> Sent: Monday, 14 May 2007 7:34 AM
> To: R-help_at_stat.math.ethz.ch
> Subject: [R] factanal
>
> Hello Guys,

... and the gals, I presume.

> I have problem with the factanal function, I dont understand why it
tells me
> everytime "2 factors is too many for 3 variables"

It's because the 'x' argument to factanal is supposed to be the matrix of responses, and not something derived from it as you use below.

> data set:
>

http://www.statistik.tuwien.ac.at/public/filz/students/multi/ss07/world2 .R
>
> code:
> library(robustbase)
>
> source("world2.R")
>
> str(world) # structure
> summary(world)
>
> world[,8] <- log(world[,8])
> world[,9] <- log(world[,9])
> x <- world[,-c(1,2)]
> x = scale(x)
> princomp(x, cor=TRUE)
> summary(princomp(x, cor=TRUE)) # First Three Main Components:
0.8687063

>
> #a) paarweise Biplots
> biplot(princomp(x, cor=TRUE))
> biplot(princomp(x, cor=TRUE), choices=c(1:2))
> biplot(princomp(x, cor=TRUE), choices=c(1:3))
> biplot(princomp(x, cor=TRUE), choices=c(2:3))
>
> #b) varimax
> x.loa <- loadings(princomp(x, cor=TRUE))
> varimax(x.loa[,1:3])
> varimax(x.loa[,1:3])$rotmat
> rotmat <- varimax(x.loa[,1:3])$rotmat
> biplot(princomp(rotmat, cor=TRUE), choices=c(1:2))
> biplot(princomp(rotmat, cor=TRUE), choices=c(1:3))
> biplot(princomp(rotmat, cor=TRUE), choices=c(2:3))
>
> #c) factor-analysis
> factanal(rotmat, factors=2) ## ?????

how about using

factanal(x, factors = 2)

### ?

>
> Thanks in advance.
>
> KR,
> Alin Soare
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help_at_stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



R-help_at_stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Sun 13 May 2007 - 23:55:24 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 14 May 2007 - 15:31:10 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.