Announcement

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

  • Panel data model - lag between variables

    Dear Statalist,

    Hope you are doing great

    I am currently working on an assignment and I need to test if my independent variables (year t) influence firm performance (year t+1).
    I am using a panel data set (2014 - 2019), I lagged in STATA firm performance therefore values range between 2015 to 2019.
    How do I make sure when running a pooled OLS (or eventually FE and/or RE) that STATA only considers the values of my independent variables between 2014 - 2018 (t-1) ?

    Thanking you in advance.
    Last edited by Walter Osuji; 16 Jan 2022, 10:53. Reason: paneldata

  • #2
    I might have explained myself poorly, I uploaded my database with observations running from 2014 to 2019.
    How do I make sure when running a pooled OLS (or eventually FE and/or RE) that STATA only considers the values of my independent variables between 2014 - 2018 (t-1) and dependent variable between 2015-2019 (t)?

    Comment


    • #3
      So if you truly have panel data, you should begin by using the -xtset- command to tell Stata. See -help xtset- if you are not familiar with this command. You use it to tell Stata what variable identifies the individual panels, and, since you want to use lags, you must also give it the time variable. So if you have, say, data on firms obtained yearly, you would write
      Code:
      xtset firm_id year
      replacing "firm_id" by the actual name of the variable that identifies firms, and "year" by the actual name of the variable that gives the year.

      Then you can work with the lagged values by using the L. operator. Read -help tsvarlist- for more information and other useful time-series operators. But, basically your regression would look something like this:

      Code:
      regression_command outcome_variable L1.(explanatory_variables_that_should_be_lagged) explanatory_variables_that_should_not_be_lagged_if_any
      Then Stata does all the hard work for you.

      Comment


      • #4
        Dear Clyde,
        So by using your suggested code I will get this result: independent variables between 2014 - 2018 (t-1) and dependent variable between 2015-2019 (t)?

        Thank you very much for the help

        Comment


        • #5
          Yes. Try it, and you will see for yourself.

          Comment


          • #6
            Thank you very much Mr. Schecther, you were very helpful

            Comment

            Working...
            X