# [R] factanal

Bill.Venables at csiro.au Bill.Venables at csiro.au
Mon May 14 01:49:39 CEST 2007

```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
> 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)   ## ?????

factanal(x, factors = 2)

### ?

>
>
> KR,
> Alin Soare
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help