'GMM formula in R

I have a panel dataset of firms with data from 2010 to 2019 and I need to estimate this model:

Employees i,t = f (employees i,t-1 , automation i,t-1 , automation i,t-2 , automation i,t-3 , automation i,t-4 , labour cost per employee i,t , value added i,t , gross investments i,t , control variables i,t)

To solve the endogeneity problem of the model, I need to use the generalized method of moments. All the explanatory variables must be instrumented in the model, using up to thrice lagged instruments: as instruments for the level equations I need to use the differenced values of the independent variables, i.e. thrice lagged differences in labour demand, automation, labour costs etc. The level equations must also include a set of industry and year dummies as controls.

I tried to run this command:

regr=pgmm(log(employees)~lag(log(employees),1)+lag(automation,1:4)+cost_employee+value_added+gross_investments|lag(log(employees),3)+lag(cost_employee,3)+lag(value_added,3)+lag(gross_investments,3),data=db,effect="twoways",model="onestep",index=c("fiscal_code","year"),transformation = "ld")

First of all, I'm not sure if this command is correct. Second, I obtained these errors:

Error in eigen(A1) : infinite or missing values in 'x'
In addition: There were 50 or more warnings (use warnings() to see the first 50)
Error in solve.default(crossprod(WX, t.CP.WX.A1)) :
  system is computationally singular: reciprocal condition number = 4.56592e-21
In addition: Warning message:
In pgmm(log(employees) ~ lag(log(employees), 1) + lag(automation,  :
  the first-step matrix is singular, a general inverse is used
gmm


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source