繁体   English   中英

使用`gmm`(GMM Estimation)时“系统是计算奇异的”错误

[英]“system is computationally singular” error when using `gmm` (GMM Estimation)

尝试使用R中的GMM包来估计线性模型的参数(af):

LEV1 = a*Macro + b*Firm + c*Sector + d*qtr + e*fqtr + f*tax

Macro,Firm和Sector是具有n行的矩阵。 qtr,fqtr和tax是具有n个成员的向量。

我有一个名为unconstrd的大型数据框,它包含所有数据。 首先,我将数据分解为单独的矩阵:

v_LEV1 <- as.matrix(unconstrd$LEV1)
Macro <- as.matrix(cbind(unconstrd$Agg_Corp_Prof,unconstrd$R1000_TR, unconstrd$CP_Spread))
Firm <- as.matrix(cbind(unconstrd$ppe_ratio, unconstrd$op_inc_ratio_avg, unconstrd$selling_exp_avg,
                  unconstrd$tax_avg, unconstrd$Mark_to_Bk, unconstrd$mc_ratio))
Sector <- as.matrix(cbind(unconstrd$Sect_Flag03,
                  unconstrd$Sect_Flag04, unconstrd$Sect_Flag05, unconstrd$Sect_Flag06,
                  unconstrd$Sect_Flag07, unconstrd$Sect_Flag08, unconstrd$Sect_Flag12,
                  unconstrd$Sect_Flag13, unconstrd$Sect_Flag14, unconstrd$Sect_Flag15,
                  unconstrd$Sect_Flag17))
v_qtr <- as.matrix(unconstrd$qtr)
v_fqtr <- as.matrix(unconstrd$fqtr)
v_tax <- as.matrix(unconstrd$tax_dummy)

然后,我将数据绑定在一起,用于gmm调用的x变量:

h=cbind(Macro,Firm,Sector,v_qtr, v_fqtr, v_tax)

然后,我调用gmm:

gmm1 <- gmm(v_LEV1 ~ Macro + Firm + Sector + v_qtr + v_fqtr + v_tax, x=h)

我收到消息:

Error in solve.default(crossprod(hm, xm), crossprod(hm, ym)) : 
  system is computationally singular: reciprocal condition number = 1.10214e-18

我提前道歉并承认我是R的初学者,我之前从未使用过GMM。 GMM功能如此通用,我已经查看了网络上可用的示例,但似乎没有什么特别足以帮助我的情况。

你试图适应一个没有完整排名的矩阵---尝试排除一些变量和/或寻找错误。 没有您的数据,或者至少是样本,我们不能说更多。

这更像是Crossvalidated.com的建模问题, 不是StackOverflow的编程问题。

我很确定我的变量之间没有线性相关性,但我一次完成了添加一个变量的练习,以查看导致错误的原因。 最后,我让一位同事在SAS上运行GMM,它运行完美,没有错误信息。 我不确定R版本的问题是什么,但此时我有一个解决方案,并在R上给你GMM。

感谢所有试图提供帮助的人。

暂无
暂无

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

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