I have balanced panel data for around 130 countries, over three years. I ran a fixed effects regression using 'country' as my panel variable, and adding dummies for 'year'. I want to forecast the value of the dependent variable for the next 20 years, for only one country in particular. Could somebody suggest the best way to do this?

I am using Stata for this purpose.

  • $\begingroup$ why are you using dummies for year? treat it as a trend variable and forecasting will be much easier. $\endgroup$
    – EconJohn
    Nov 18, 2018 at 20:17
  • $\begingroup$ I think your best bet here is to gather data that will help explain that dependent variable for your desired country, specify a model, and then predict for that country. $\endgroup$
    – 123
    Dec 18, 2018 at 14:29

1 Answer 1


Probably this question is better placed at stackoverflow. Technically, in order to predict out of the sample, you need the full set of variables in the estimation. So after carrying out the estimation, you could do something like this. I assume your last observed year is 2010.

* expand US data for the last observed data point.
expand 20 if country == "US" & year == 2010
bys country year: replace year = . if _n > 1
bys country (year): replace year = year[_n-1] if year == .
estimates restore panel_estimation
predict outcome_var
* check whether that worked
tw line outcome_var year if country == "US"

This will predict a value based on your panel estimation also for the newly created observations. I am not judging whether it makes sense to extrapolate a time-trend over three years to twenty years ;)

  • $\begingroup$ predict outcome_var, xbu accounts for the fixed effects. Also, as you said, the full set of variables (X) are needed. $\endgroup$
    – chan1142
    Sep 19, 2018 at 1:44
  • $\begingroup$ When predicting the future, you are basically either making the claim that you think one of your covariates will change and so you predict a change in the dependent variable, or the claim that there is some time trend that you expect to continue, and are using that time trend to predict the future. By using dummies for year, you're not estimating a time trend, and have no basis for making a prediction about the future. This answer looks legit for how to code this up (although I think you're missing a +1 in line 5), but I think you also have to use a parametric form for year, not dummies. $\endgroup$
    – NickCHK
    Oct 21, 2018 at 18:36
  • 1
    $\begingroup$ This is an econometrics exercise. The question belongs here and not at stackoverflow. $\endgroup$
    – 123
    Dec 18, 2018 at 14:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.