Announcement

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

  • Creating lagged variables for panel data with multiple imputations

    Hi, I have panel data set by countrycode and year, with multiple imputations.

    When I try to sort data and command:
    Code:
    sort countrycode year
    for some reason the imputed dataset loses variability, i.e. all the observations for non-imputed variable are the same. e.g. for US in years 2000-2010 I imputed var1. When I sort by countrycode and year, var2, var3 etc are just the same value for all US observations in 2000-2010.

    Now to what I was actually doing this for: trying to create lags of my variables.
    What I had in mind for code was:
    Code:
    sort countrycode year
    by countrycode: gen lagvar1 = var1[_n-1] if year==year[_n-1]+1
    As mentioned above, that problem with sorting arises. Is it possible to create lagged variables for imputed data and if so, what is the code?

  • #2
    Way over my head here but maybe this will start some discussion.

    If I were fitting panel data I'd be using xtreg and handling lagging using time series variable lists (help tsvarlist). Since help xtreg supports mi estimate that would seem to be a possible direction.

    Comment

    Working...
    X