Announcement

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

  • Lagged Variables and Included Data?

    Hello:

    I am relatively new to Stata and I want to confirm what the program does with data in a dataset when lagged variables are employed.

    I have panel data with annual observations of the number of overseas trips the UK Prime Minister and Foreign Minister made to other specific countries between 1992-2019 (xtset country year). Though I am only interested in this post-Cold War time period, my dataset runs from 1990-2019 because I am lagging several of my independent variables by one year (L.) and in one case two years (L2.).

    Am I correct in thinking that when I run a regression that the observations for 1990 and 1991 will not be dropped because there will be no data for the L1 or L2 to reference?

    To put it another way, how do I ensure that only the years I want (1992-2019) are included in the analysis and that the additional observations (1990 and 1991) are only used to provide information for the lagged variables?

    Thanks in advance!

  • #2
    Wlater:
    this seems to be a job for -e(sample)-:
    Code:
    . use "https://www.stata-press.com/data/r17/nlswork.dta"
    . quietly xtreg ln_wage L.age, fe
    . xtsum ln_wage age if e(sample)
    
    Variable         |      Mean   Std. dev.       Min        Max |    Observations
    -----------------+--------------------------------------------+----------------
    ln_wage  overall |  1.707265   .4583665   .0049397   5.263916 |     N =   10891
             between |              .442823   .0317382   4.204645 |     n =    3700
             within  |             .2475439   .0146523   4.326597 | T-bar = 2.94351
                     |                                            |
    age      overall |  28.26389   6.831304         16         46 |     N =   10872
             between |             5.968995         17         46 |     n =    3694
             within  |             4.859478   17.26389   43.26389 | T-bar = 2.94315
    
    .
    Kind regards,
    Carlo
    (StataNow 18.5)

    Comment


    • #3
      Thank you very much!

      Comment

      Working...
      X