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!
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!
Comment