Announcement

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

  • Out of sample prediction for fixed effects (areg) model

    I have a balanced panel on numbers of accidents and am attempting to ‘demean, detrend and deaseasonalise’ the data for further analysis. I want to estimate the constant, (regional) trend and seasonal effects over (say) ten years and then remove these estimated effects from data for the following two years on which I base my analysis (I do this assuming I am removing long term effects, rather than estimating short term (constant,) trend and seasonal effects for just the analysis sample).
    My data is specified by region and day. I have one way (region) fixed effects, regional time trends, monthly and weekday ‘seasonal’ dummies in my model. I have estimated using areg and absorbed the region fixed effects:

    areg num_acc trend_r1-trend_r10 i.Accident_Month i.weekday, absorb(region) vce(robust)

    I am using Stata version 15 under windows 10.
    I have read about areg postestimation and would have liked to use the following command:

    predict num_acc, residuals (as these would be the demeaned, detrended and deseasonalised numbers)

    however, this will only predict for the estimation sample rather than also for the analysis sample.
    Is there another way I can predict numbers of accidents (or residuals) out of sample while including the fixed effect estimates?

    Thank you!

  • #2
    Often with panel data, using the panel estimators is better. xtreg will predict xb out of sample. Note, that if a lot of the action is in your panel variables, you can't do much with that when you predict out of sample - they're simply not estimated out of sample.

    If this doesn't make sense, you can always generate your predictions using the estimated parameters.

    Comment

    Working...
    X