Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Including lags in a xtreg regression

    Hello,

    I have a panel dataset containing quarterly data from 2000-2016. I want to do a regression where my dependent variables are lagged 8 periods, but I do not know how to do that correctly so I was wondering if anyone can help me?

    I am doing an OLS regression using the xtreg-command.

    Thanks in advance.








  • #2
    I assume your data includes a variable that gives the quarterly date, and I'll call it qdate. (If you don't have such a variable, you must first create one. Without seeing example data, it is impossible to give advice how to proceed with that.) I also assume you have a panel identifier variable, which I'll just call panel.

    Code:
    xtset panel qdate
    
    xtreg outcome_variable L8.variable_to_be_lagged_8_periods other_variables
    Do read -help tsvarlist- for a general understanding of how Stata works with lags and leads.

    Comment


    • #3
      Hanne:
      as an aside to Clyde's helpful advice, please note that if your dependent variable is the one you want to lag, you have to switch to dynamic panel data model (see -xtabond-) (I read from your post dependent variables; you probably meant independent variables but just in case...).
      Kind regards,
      Carlo
      (Stata 19.0)

      Comment

      Working...
      X