factpca
{
if(!is.matrix(x)){
x
}
z
p
if(p<3){
stop("factor analysis requires at least three variables")
}
cr
eig
s=sum(eig$values)
tmp=0.0
flag=0
for(i in 1:length(eig$values)){
tmp=tmp+eig$values[i]
flag=i
if(tmp/s>=0.8)
break
}
rowname
colname
A
for(j in 1:flag){
A[,j]=sqrt(eig$values[j])*eig$vectors[,j] #填充矩阵A的值
}
A2
var.A
D1
rotmat
if(rotation=="varimax"){ #采用最大方差旋转法,进行因子旋转
#rot
rot
A1
rotmat
A
}
D
D2
F
if(score=="Bartlett"){
F
}
else if(score=="regression"){
F
}
scores
#list(rotloadings=A,loadings=A2,eigenvalues=eig$values,eigenvalue=eig$values(1:flag),comdgree=var.A,F=F)
result
result
}