简体   繁体   English

R中的事实函数错误

[英]Error in factanal function in R

I'm using the factanal function with this simple code: 我正在通过以下简单代码使用factanal函数:

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, 这是CFscale矩阵的head

       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 带有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: 您可以在这里看到它的glm版本:

https://stats.stackexchange.com/questions/76488/error-system-is-computationally-singular-when-running-a-glm 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. 其中, A是系数矩阵, b是向量, c是结果向量。 Solving this involves reversing A , which is essentially your data (not really, but close enough). 解决这个问题需要反转A ,这实际上是您的数据(不是真的,但是足够接近)。 Inverting a matrix means find an A^-1 such that 对矩阵求逆意味着找到一个A ^ -1这样

A*A^-1=I

and I is a diagonal matrix with 1s on the diagonal. 我是对角矩阵,对角线为1 When A is not invertable, it is called singular - and you can't solve the system. 当A不可逆时,它称为奇数-您无法求解系统。

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. 这也是因子分析,您只有5个变量。 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. 这是一个非常低的金额-通常​​意味着您期望的因素不会超过1个,也许是2个。如果您获得3个或4个或更多的因素,那么这不是您要寻找的分析-重点是看看是否可以减少自变量,如果您没有1-2个因子,这将不会真正做到。 Since you ran looking for 2 factors, this may not be beneficial. 由于您正在寻找2个因素,因此这可能没有好处。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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