RATS 10.1
RATS 10.1

Graphics /

Graphing Forecasts

Home Page

← Previous Next →

It's very common to show the last few observations of historical data (as separate series) when you do graphs of out-of-sample forecasts. If you do that, you will find there will be a break in the graph between the end of the historical data and the start of the forecasts. One way to improve the appearance is to add the final historical value to the beginning of the forecast series. That way, its line will connect smoothly with the historical series.

 

The following (from GRAPHFORECAST.RPF) uses ESMOOTH (exponential smoothing) to forecast from 2007:1 to 2008:12. The final actual data value from 2006:12 is added at that entry to the forecast series (JPNFORE). A grid line is added to the graph at 2006:12.

 

cal(m) 1960:1

open data oecdsample.rat

data(format=rats) 1960:1 2006:12 jpniptotrs

 

esmooth(trend=select,seasonal=select,$

     forecast=jpnfore,steps=24) jpniptotrs

set jpnfore 2006:12 2006:12 = jpniptotrs

graph(header="Forecasts of Japanese IP",grid=t==2006:12) 2

# jpniptotrs 2004:1  2006:12

# jpnfore    2006:12 2008:12

 

 

 

 

This is another example, taken from pages 349-360 of Diebold (2004). It includes upper and lower confidence bands, and shades the “forecast” area. The full program is DIEB3P348.RPF in the textbook examples.

 

The forecasts start at 1995:1. This sets FOREZONE to 1 for 1995:1 and later.

 

set forezone * 2010:12 = t>=1995:1

 

This estimates the model through 1994:12:

 

boxjenk(const,diffs=1,ar=1,define=diffeq) logyen * 1994:12 resids

 

This uses UFORECAST to generate forecasts and  standard errors, then uses those to get upper and lower two standard deviation bounds:

 

uforecast(equation=diffeq,stderrs=sefore) fyen 1995:1 1996:7

set upper 1995:1 1996:7 = fyen+2.0*sefore

set lower 1995:1 1996:7 = fyen-2.0*sefore

 

Graph the actual values, forecasts, and upper and lower bounds. Shading is applied where FOREZONE is non-zero. The stylenum parameter is used to specify line style 3 for both the upper and lower series:

 

graph(header=$

"Figure 12.17. Log Yen/Dollar Rate: History, Forecast and Realization",$

shading=forezone) 4

# logyen 1990:1 1996:12

# fyen 1995:1 1996:7

# upper 1995:1 1996:7 3

# lower 1995:1 1996:7 3

 


Copyright © 2025 Thomas A. Doan