Lag Dependent Variable with lfe package

Hi everyonne,
I am currently running certain regression models with the felm function from the lfe package. Now I want to run 2 model versions with a lagged dependent variable. I want to lag my dependent variable by 1 year and include it as independent variable in order to capture path dependence. Furthermore both models have to have fixed time and country effects.https://assets.grammarly.com/emoji/v1/1f454.svg

My normal versions (including fixed effects for "year" and "id" look as follows:

Model3 <- felm(y ~ x + control1 + control2 + + control 3 + control4 | factor(year) + factor(id), data_stata)

Model4 <- felm(y ~ x1 + control1 + control2 + control3 + control4 | factor(year) + factor(id), data_stata)

I found this option below, but it is not working for me:

Model3 <- felm(y ~ lag(data_stata)['y'],1) + x + control1 + control2 + control3 | factor(year) + factor(id), data=as.data.frame(data_stata)

If someone could help me with my issue I would highly appreciate it :slight_smile:
Thanks a lot!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.