I'm trying to use Stata's forecasting interface (found under statistics > time series > forecasting) to develop VERY BASIC forecasts. My dataset includes 24 provinces across 30 years (1985 through 2014). I want to forecast the number of lawyers in each province to the year 2020. I will only use 2 variables to predict future lawyer counts: (1) year and (2) province.
Here's my code:
forecast create, replace
xtset prov year
xtreg lawyers yr, fe
estimates store Forecast_Attempt1
forecast estimates Forecast_Attempt1
forecast solve, prefix(f_) begin(2014) end(2020)
The 2014-2020 forecasts produced using this code are the same for all 24 provinces. This result tells me that Stata is not considering the province fixed effects in creating the forecasts. In an effort to get Stata to include these effects, I change the third line of the code from xtreg lawyers yr, fe to reg lawyers yr i.prov. These regressions are almost equivalent except that the latter one includes the province effects as dummy variables whereas the former subtracts out these effects prior to estimation. When I make this substitution and try to run the last line of the code, I receive the error message "command cannot be used with panel data."
Can someone please help me? Please let me know if you need additional information.
Here's my code:
forecast create, replace
xtset prov year
xtreg lawyers yr, fe
estimates store Forecast_Attempt1
forecast estimates Forecast_Attempt1
forecast solve, prefix(f_) begin(2014) end(2020)
The 2014-2020 forecasts produced using this code are the same for all 24 provinces. This result tells me that Stata is not considering the province fixed effects in creating the forecasts. In an effort to get Stata to include these effects, I change the third line of the code from xtreg lawyers yr, fe to reg lawyers yr i.prov. These regressions are almost equivalent except that the latter one includes the province effects as dummy variables whereas the former subtracts out these effects prior to estimation. When I make this substitution and try to run the last line of the code, I receive the error message "command cannot be used with panel data."
Can someone please help me? Please let me know if you need additional information.
Comment