Announcement

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

  • Out of sample prediction with ibn. and country fixed effects

    Dear All,

    first post here. I'll try to be as precise as possible. I am working with a cross-sectional data set for some 64 countries and have some 900 observations for the 1st administrative level. In order to account for unobserved heterogeneity on the country level I want to use a country-fixed effects operator. Both predict commands, for the same data, yield the same predicted values.
    Code:
    reg ln_y ln_x ibn.country
    predict y_hat if e(sample)
    
    reg ln_y ln_x ibn.country, nocons
    predict y_hat1 if e(sample)
    So far so good. If I use both commands and predict for the whole dataset, which includes countries that are not within e(sample), the results for the out of sample predictions, y_hat and y_hat1, differ. This has no direct relevance for my work. But I cant really identify what is leading to the differing results. Any help is greatly appreciated.

    Best,
    Philipp
    Last edited by Philipp Holz; 29 Feb 2020, 13:30.

  • #2
    The country dummies in fixed effects are nothing more than a separate constant for each country. Since "ibn" in factor variable notation implies no base level, if you omit the constant term, then you will get an estimate for all N dummies. Your coefficient estimates on the time varying variables will be the same across both regressions, but in one regression you have a constant term while in the other, you do not. Now, this does not matter for the insample predictions as:

    1. In the regression with an intercept, the coefficient on the intercept term is equal to the coefficient on the omitted dummy, which is estimated in the regression without an intercept.
    2. The coefficients on the country dummies in the regression with an intercept are simply the difference between the coefficient on the intercept term and the coefficients on the country dummies in the regression with no intercept.

    So mathematically, the prediction for the insample observations is the same as the difference in the coefficients on the intercept term and country dummies is simply one of distribution. For out of sample predictions, the coefficients on the country dummies are equal to 0, so it boils down to the fact that you have a coefficient on the intercept term in one regression and not in the other.

    Comment


    • #3
      Thanks Andrew! This makes things a lot clearer.

      Comment

      Working...
      X