zoe chan
2013-Jan-13 14:08 UTC
[R] R error: system is computationally singular when building GMM model
Dear, I built the generalized method of moments model to estimate the sales rank in the bookstore using plm package in R. The equation is: data1.gmm <- pgmm(dynformula(lnsales_rank ~ ln_price + avg_ham_rate + avg_spam_rate + num_of_ham+ num_of_spam + ship_code2 +ship_code3 +ship_code4+ ship_code5+ ship_code6 + ship_ code7, lag = list(0, 0, 0, 0,0,0,0,0,0,0,0,0), log =FALSE), data=data, effect = "individual", model "twosteps", transformation = "ld",gmm.inst = ~ ln_price, lag.gmm =2) However, error message: Error in solve.default(Reduce("+", A1)) : system is computationally singular: reciprocal condition number 6.36689e-23" shown. I found that skipping one of the ship_code variables (dummy variable) can generate result. But don't know the reason. I found some books about using R, but no one can answer me. Please help. Thanks much. Zoe [[alternative HTML version deleted]]
Uwe Ligges
2013-Jan-13 17:02 UTC
[R] R error: system is computationally singular when building GMM model
On 13.01.2013 15:08, zoe chan wrote:> > Dear, > I built the generalized method of moments model to estimate the sales rank > in the bookstore using plm package in R. > > The equation is: > > data1.gmm <- pgmm(dynformula(lnsales_rank ~ ln_price + avg_ham_rate + > avg_spam_rate + num_of_ham+ num_of_spam + ship_code2 +ship_code3 > +ship_code4+ ship_code5+ ship_code6 + ship_ code7, lag = list(0, 0, 0, > 0,0,0,0,0,0,0,0,0), log =FALSE), data=data, effect = "individual", model > "twosteps", transformation = "ld",gmm.inst = ~ ln_price, lag.gmm =2) > > However, error message: Error in solve.default(Reduce("+", A1)) : > system is computationally singular: reciprocal condition number > 6.36689e-23" shown. > > I found that skipping one of the ship_code variables (dummy variable) can > generate result. But don't know the reason. > > I found some books about using R, but no one can answer me.The error message says quite a lot: The code tries solve() and fails since the matrix is numerically singular. Now go ahead and find out why that happens. Not enough data for all combinations of your categorical variables in a way that you can still estimate all the coefficients, I believe, Uwe Ligges> Please help. Thanks much. > > Zoe > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >
Maybe Matching Threads
- System GMM fails due to computationally singular system. Why?
- 'gmm' package: How to pass controls to a numerical solver used in the gmm() function?
- GMM, panel data, functions lag() and diff()
- GMM with covariance moment condicion
- GMM: "The covariance matrix of the coefficients is singular"