Announcement

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

  • xtreg with differenced data

    Hi,

    I’m currently working with panel data of counties in the US over 2 time periods - 2019 and 2014. I would like to estimate a regression of the difference in unemployment rates between 2019 and 2014 on a weighted average of the unemployment rate in counties in 2014. I have created my dependent variable (diff_unemp) using:
    Code:
    gen diff_unemp = unemp_rate-L1.unemp_rate
    My explanatory variable (wtd_unemp) is formed by weighting the unemployment rate in 2014 with a measure of social connectedness. Since wtd_unemp only uses 2014 data, there is a missing value for it in every county in 2019.

    My question is how do I actually run a regression of diff_unemp on wtd_unemp. diff_unemp has differenced observations in the t=2 period with missing values elsewhere while wtd_unemp has observations in the t =1 period with missing values in t=2 so I get an error saying "no observations" on trying to run
    Code:
    xtreg diff_unemp wtd_unemp
    Here is an example of the first 3 counties with my panel ID indicating counties (geo_id), the time variable indicating whether time is 2014 (time = 1) or 2019 (time = 2), the unemployment rate, the differenced unemployment rate and the weighted unemployment rate.
    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input long geo_id float(time unemp_rate diff_unemp) double wtd_unemp
    1001 1  8.531919         .  11.90644273715219
    1001 2  3.676644 -4.855275                  .
    1003 1  8.596502         .  11.47575394038222
    1003 2  4.255062  -4.34144                  .
    1005 1 14.186176         . 14.466721732840035
    1005 2  9.166487  -5.01969                  .
    end
    Any help would be greatly appreciated!



  • #2
    Please let me know if I can provide any further clarification!

    Comment

    Working...
    X