PGMM / GMM Calculation in R

54 Views Asked by At

I want to calculate a GMM model in R. To understand the formula (pgmm) better, I tried to run an example:

data("EmplUK", package = "plm")
ar <- pgmm(log(emp) ~ lag(log(emp), 1:2) + lag(log(wage), 0:1) +
lag(log(capital), 0:2) + lag(log(output), 0:2) | lag(log(emp), 2:99),
data = EmplUK, effect = "twoways", model = "twosteps")
mtest(ar, order = 1L)
mtest(ar, order = 2L, vcov = vcovHC)

However, every time I run this, this error occurs: Error in lag(): ! n must be a whole number, not an integer vector. Run rlang::last_trace() to see where the error occurred.

How do I change the formula for that the error disappears?

0

There are 0 best solutions below