# [R] pgmm function errors in R

Wadim iLchuk v@d|k||chuk01 @end|ng |rom gm@||@com
Fri Jan 22 12:38:57 CET 2021

```Hello everyone, My name is Vadym, I am a last-year student at Stockholm
School of Economics in Riga, currently working on my Bachelor's Thesis (so
still learning R). For my research, I need a GMM estimator (preferable
Arellano and Bond, 1991). I have been searching for a solution to my issue
for about 2 months already, yet still, no solutions have been found.

The data set could be found here:
Dataset is firm-level data.

The main model for my topic is:
deltaTFPt+1   = lag(deltaTFPt) + deltadebtt + finfrictiont +
deltadebt*finfriction + age + ta + deltasales.

Where, deltaTFP - growth in productivity of the firm from t to t+1,
deltadebt - growth in debt of the company, finfriction is my main variable
of interest - namely financial friction for the company, age is the age of
the company, ta is total assets, deltasales - growth in sales.

I need to estimate coefficients by using GMM

My code is the following for doing so by using pgmm function:
###############
PLVData_A <- pdata.frame(LVData_A, index = c("ID","Year")) z1 <-
pgmm(domegaACF_A ~ lag(domegaACF_A, 1) + ddebt + ff1 + ff1:ddebt + Age + ta
+ dsales | lag(domegaACF_A, 2), data = PLVData_A, effect = "twoways", model
= "onestep", transformation = "d")
summary(z1, robust = TRUE)
#################

Bearing in mind that I have been struggling with this for 2-3
months already I have tried to change everything I could in the model, but
constantly receive these types of errors:

Error in solve.default(crossprod(WX, t(crossprod(WX, A1)))) :
Lapack routine dgesv: system is exactly singular: U[5,5] = 0
In pgmm(domegaACF_A ~ lag(domegaACF_A, 1) + lag(ddebt, 0:1) + ff1 +  :
the first-step matrix is singular, a general inverse is used

Error in solve.default(crossprod(WX, t(crossprod(WX, A1)))) :
system is computationally singular: reciprocal condition number =
4.26304e-27
In pgmm(domegaACF_A ~ lag(domegaACF_A, 1) + lag(ddebt, 0:1) + ff1 +  :
the first-step matrix is singular, a general inverse is used

Error in cbind(yX1[[i]], V1) :
number of rows of matrices must match (see arg 2)

Error in cbind(W2[[i]], V2) :
number of rows of matrices must match (see arg 2)
In addition: There were 50 or more warnings (use warnings() to see the
first 50)

I would really appreciate any of your support or ideas since I have no clue
of how to solve the issue. Thank you in advance!

[[alternative HTML version deleted]]

```