I have combined Barro's educational attainment dataset with the Penn world table. I am now running a regression on the panel data set using a system GMM estimator, with the time effects in the error term (twoways). I am receiving an error saying that my matrix is singular. I understand that this implies that my determinant is non existent, but I believe it to be a coding issue as the model will run if I use dplyr's lag as opposed to plm's.

```
sauer.fvm3.pgmm1 <- pgmm(GDP.Growth ~ plm::lag(GDP.Growth,1)+Pop.Growth+ Ge.f+Cap.Growth|plm::lag(GDP.Growth,2:99),
data = sauer.fvm3,effect= 'twoways',index=c('country','year'),
transformation="ld"
)
summary(sauer.fvm3.pgmm1)
```

Error in solve.default(crossprod(WX, t(crossprod(WX, A1)))) : Lapack routine dgesv: system is exactly singular: U[1,1] = 0

In addition:

Warning message: In pgmm(GDP.Growth ~ plm::lag(GDP.Growth, 1) + Pop.Growth + Ge.f + : the first-step matrix is singular, a general inverse is used

and when i use:

```
sauer.fvm3.pgmm1 <- pgmm(GDP.Growth ~ dplyr::lag(GDP.Growth,1)+Pop.Growth+ Ge.f+Cap.Growth|dplyr::lag(GDP.Growth,2:99),
data = sauer.fvm3,effect= 'twoways',index=c('country','year'),
transformation="ld"
)
summary(sauer.fvm3.pgmm1)
```

I only receive this warning:

Warning message: In pgmm(GDP.Growth ~ dplyr::lag(GDP.Growth, 1) + Pop.Growth + Ge.f + : the second-step matrix is singular, a general inverse is used

The `dplyr`

coefficients do not make theoretical sense and do not line up with the paper I am recreating. I do not understand why the PLM lags are not working or even if they are the problem. Any help with this would be great appreciated.