<p>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.</p>

<pre><code>* expand US data for the last observed data point.
expand 20 if country == "US" &amp; year == 2010
bys country year: replace year = . if _n &gt; 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"
</code></pre>

<p>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 ;)</p>

CC BY-SA 4.0
2018-09-19T01:44:59.723Z
`predict outcome_var, xbu` accounts for the fixed effects. Also, as you said, the full set of variables (X) are needed.
chan1142
CC BY-SA 4.0
2018-10-21T18:36:55.383Z
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.
NickCHK
CC BY-SA 4.0
2018-12-18T14:20:25.480Z
This is an econometrics exercise. The question belongs here and not at stackoverflow.
123
CC BY-SA 4.0
2018-09-18T14:38:26.790Z
2018-09-19T10:51:34.857Z
2018-09-19T10:51:34.857Z
E. Sommer
<p>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, <strong>for only one country in particular</strong>. Could somebody suggest the best way to do this?</p>

<p>I am using Stata for this purpose.</p>

CC BY-SA 4.0
2018-11-18T20:17:30.313Z
why are you using dummies for year? treat it as a trend variable and forecasting will be much easier.
EconJohn
CC BY-SA 4.0
2018-12-18T14:29:39.833Z
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.
123
<econometrics><paneldata><stata>
Panel Data and Forecasting
Student
# Panel Data and Forecasting

(Asked by: username_0 on 2018-09-18)

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.

**Tags:** econometrics, paneldata, stata
> **Comments:**
> **username_1**: why are you using dummies for year? treat it as a trend variable and forecasting will be much easier.  
> **username_2**: 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.  

---

## 1 answers

### Answer by username_3 on 2018-09-18. Score: -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 ;)

> **Comments:**
> **username_4**: `predict outcome_var, xbu` accounts for the fixed effects. Also, as you said, the full set of variables (X) are needed.  
> **username_5**: 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.  
> **username_2**: This is an econometrics exercise. The question belongs here and not at stackoverflow.  

---

