Announcement

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

  • Questions regarding Lag Variables Panel Data Analysis

    Hello,
    I have a question regarding shifts in a panel data regression.
    In my example, Corona occurred as an example. I would analyze the effect on company sales. However, I suspect that the effect of Corona did not "show up" until later and would also like to do a regression with a shift of one period.
    So if I think the effect of my independent variable occurs later, do I shift the dependent variable back or forward ?

    Below I wrote down both examples, which one would be correct ?

    Code:
    gen Revenues_lag1 = Revenues[_n-1]  gen Revenues_lag1 = Revenues[_n+1]
    Last edited by Hakan Self; 16 Apr 2022, 10:08.

  • #2
    If you expect that the outcome will occur after the event, then you want the analysis to associate the outcome variable at a given time with an earlier value of the event variable, or, equivalently, the event variable to be associated with a later value of the outcome variable.

    As for the code examples you show, you shouldn't use either of them. Rather you should use Stata's time-series operators. Something like this:

    Code:
    tsset time_variable
    regression_command F.Revenues i.event_variable ...
    The reason not to use the _n-1 or _n+1 approach is that it will produce incorrect results if there are any gaps in the time series. The F. operator is robust to that problem.

    Note: You start your post by stating that you are working with panel data. But in your suggested code using _n-1 and _n+1, there is no reference to any kind of panel structure. So I have assumed that you really have a single time series, not panel data. If I have misunderstood, then that is all the more reason not to use the _n-1 and _n+1 approach because it will, at the beginning or end of a single panel's data "import" Revenues from a different panel! If you do have panel data, then -tsset- will give you an error message. So you should instead -xtset panel_variable time_variable-. And you should use a panel-data regression estimator rather than a simple regression command.

    Added: #1 is nearly identical to #1 at https://www.statalist.org/forums/for...-data-analyses, which received a similar answer from Jared Greathouse, though he assumes that Revenues is an explanatory variable, whereas I assume it is an outcome. The fact that the question is so similar and asked in such a similar way, however, is striking. If the two O.P.s are the same person, under different names, please don't do that. First, we don't like bumping; second Forum members are asked to use their real names. Alternatively, it raises the suspicion that help is being solicited for a class homework problem, which is also against Forum policy.
    Last edited by Clyde Schechter; 16 Apr 2022, 12:58.

    Comment


    • #3
      Thanks for your answers Clyde.
      My data is paneldata and I used -xtset-. and -reghdfe-. So you say I should use

      Code:
      reghdfe F.Revenues x1 x2, absorb(country)
      Is that correct ?

      Comment


      • #4
        Yes, that is what I recommend.

        Comment

        Working...
        X