powered by
a function to take lags and leads with panel data, mostly a wrapper for plm's lag function.
plm
L(x, k = 1, ...)
variable to lag
how many lags to take? If a negative number, leads will be generated.
other options to pass to plm::lag, does not need to be specified
plm::lag
returns lag of the variable as a data frame
# NOT RUN { library(plm) data(Produc) use(Produc, clear=TRUE) xtset(year, state) gen(Lemp, L(emp)) gen(L2emp, L(emp,2)) headdata(10) # }
Run the code above in your browser using DataLab