Announcement

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

  • Using esttab to report results for Lagged Variables

    Hi All,

    My dataset resembles the following (I have panel data, so multiple observations for the same time period, but I think this table is without loss of generality)

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float(year y x)
    2001 12 321
    2002 32  32
    2003 12  12
    2004  3   1
    2005  1   2
    end
    In the above, I have data on individuals (identifier dropped), and variables y and x. I wish to explain y as a function of the first , second lag, third, fifth and tenthy of x, each for different models. After declaring the data either as time series, or as panel, I do the following:

    Code:
    foreach i in 1 2 3 5 10{
        eststo : qui xi : xtreg y l`i'.(x) i.year
        }
    Now, I wish to use the esttab command- but the issue is that each of the variables are named differently. So, for instance, if I type:

    Code:
        esttab using "table1.tex", scalar(F) stats(N r2 vce) varwidth(25) keep(L.x)  star(+ 0.15 * 0.10 ** 0.05 *** 0.01) p  label replace
    all I would obtain would be the coefficient son the first lag of x. If I want more lags of x, I would have to add L2.x and so on. I do not wish to do this, as the table would look unnecessarily big, especially if I add other controls. Is it possible to subsume all the coefficients here under a variable name "x", in a single row? I could name the columns differently, corresponding to the particular lag.

    Many thanks,
    CS

  • #2
    I would do something like:

    Code:
    est clear
    capture drop X
    foreach i in 1 2 3 5 10 {
        gen X=l`i'.x 
        eststo : xtreg y X i.year
        drop X
        }
    
    esttab using "table1.tex", scalar(F) stats(N r2 vce) varwidth(25) keep(X)  ///
        star(+ 0.15 * 0.10 ** 0.05 *** 0.01) p  label replace
    On a side, I think that using xi in this context is redundant.

    Comment

    Working...
    X