I'm watching a video on YouTube about linear regression, one line of code is like this (function pgmm
of package plm
):
model1 = pgmm(democracy~lag(democracy)+lag(income)|lag(democracy, 2:99), DemocracyIncome25, index=c("country", "year"), model="twosteps", effect="twoways")
Just want to know what is the meaning of |
here, and what does this operation really do.
In general the |
represents the logical OR
operator, but in the pgmm
function the |
sign is used to provide the instrumental variables that you want to use in your panel data GMM.
in your sample code model1 = pgmm(democracy~lag(democracy)+lag(income)|lag(democracy, 2:99), DemocracyIncome25, index=c("country", "year"), model="twosteps", effect="twoways")
you have the dependent variable democracy and independent variables as lag of democracy and lagged income. The variables after the |
lag(democracy, 2:99), DemocracyIncome25 will act as instrumental variables.
Please refer to the page 17 of the plm documentation here to the page 17 of the plm package documentation here