#compare the fit of 4 to 3 factors for the Harman 24 variables
fa4 <- factanal(x,4,covmat=Harman74.cor$cov)
round(factor.fit(Harman74.cor$cov,fa4$loading),2)
#[1] 0.9
fa3 <- factanal(x,3,covmat=Harman74.cor$cov)
round(factor.fit(Harman74.cor$cov,fa3$loading),2)
#[1] 0.88
## The function is currently defined as
function (r,f) {
r2 <-sum( r*r)
rstar <- factor.residuals(r,f)
rstar2 <- sum(rstar*rstar)
fit<- 1- rstar2/r2
return(fit) }
Run the code above in your browser using DataLab