简体   繁体   中英

Error in factanal function in R

I'm using the factanal function with this simple code:

factor_analyisi<-factanal(CFscale,factors=2,rotate="varimax")

But I get this error:

Error in solve.default(cv) : 
  system is computationally singular: reciprocal condition number = 1.70441e-20

Why??

This is the head of CFscale matrix,

       Age X6Ckine.CCL21. BCA.1..CXCL13. ENA.78.CXCL5. EOTAXIN.CCL11.
ID2  1.3589518    -0.62230682      0.4234253    -1.0014789     -0.8840086
ID3 -1.0019921    -0.08609578      0.8596906    -0.5711517     -0.7924021
ID4  0.1621975    -0.62285177     -0.4081158    -0.6698831     -0.7941621
ID5 -0.9368626    -0.57273123     -0.3889110    -1.0381312     -0.9192960
ID7  1.1554221    -1.01596723     -0.4453790    -0.3098134     -0.8896405
ID8 -1.2136629    -0.19600220      0.1276134    -0.5717698     -0.7149634

with dim(CFscale) 39 309

Can someone help me?

These types of question are all the same. You can see a glm version of this here:

https://stats.stackexchange.com/questions/76488/error-system-is-computationally-singular-when-running-a-glm

In the course of creating a linear model (which a factor based model is) often in the course of the computation, you need to solve something that looks like:

Ab=c

where A is a coefficient matrix, b a vector, and c the result vector. Solving this involves reversing A , which is essentially your data (not really, but close enough). Inverting a matrix means find an A^-1 such that

A*A^-1=I

and I is a diagonal matrix with 1s on the diagonal. When A is not invertable, it is called singular - and you can't solve the system.

From a practical point of view, this means the problem is in the data . Of course you don't want to hear that, so there are remedies. By problems, it usually means two or more of your variables are highly correlated. Thus I would suggest:

  1. Check for correlations between variables you have reason to suspect are correlated - and remove highly correlated duplicates.
  2. If you have no idea, just check all pairs. This isn't as good, since often two variables may correlate a third, but it's something.
  3. Finally, reduce your statistic space. You don't have that many variables. You can try running without each, and seeing if you can solve the problem. This is another indication of correlation.

Also this is factor analysis, and you have only 5 variables. That's a very low amount - usually meaning you aren't expecting more than 1 factor, maybe 2. If you get 3, or maybe 4 or more factors, then this isn't the analysis you're looking for - the point is to see if you can reduce your independent variables, and this won't really do that if you don't have 1-2 factors. Since you ran looking for 2 factors, this may not be beneficial.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM