1. Home
  2. FORECAST directive

FORECAST directive

Forecasts future values of a time series (synonym of TFORECAST).

Options

PRINT = string tokens What to print (forecasts, limits, setransform, sfe); default fore,limi
CHANNEL = scalar Channel number for output; default * i.e. current output channel
ORIGIN = scalar Number of known values to be incorporated; default 0
UPDATE = string token Whether to update the forecast origin to the end of the new observations (yes, no); default no
NEWOBSERVATIONS = variate Variate of length ≥ ORIGIN providing new values of the time series to be incorporated (must be set if ORIGIN > 0)
SFE = variate Saves standardized forecast errors; default *
MAXLEAD = scalar Maximum lead time i.e number of forecasts to be made; default * defines the number as the length of FORECAST variate
FORECAST = variate Variate of length MAXLEAD to save forecasts of output series; default *
SETRANSFORM = variate Saves standard errors of the forecasts (on transformed scale, if defined); default *
LOWER = variate Saves lower confidence limits; default *
UPPER = variate Saves upper confidence limits; default *
PROBABILITY = scalar Probability level for confidence limits; default 0.9
COMPONENTS = pointer Contains variates (of length ORIGIN + MAXLEAD) to save components of the forecast
SAVE = identifier Save structure to supply fitted model; default * i.e. that from last model fitted

Parameters

FUTURE = variates Variates (of length ORIGIN + MAXLEAD) containing future values of input series
METHOD = string tokens How to treat future values of input series (observations, forecasts); default obse

Description

FORECAST was renamed as TFORECAST in Release 14 to emphasize its status as a time-series command. The earlier name (FORECAST) was retained to allow previous programs to continue to run, but this may be removed in a future release.

FORECAST can be used after ESTIMATE to forecast future values of a time series. In many applications of forecasting with univariate ARIMA models, you will need only a simple form of the directive. For example

FORECAST [MAXLEAD=10]

will cause Genstat to print forecasts for 10 lead times, that is, the next 10 time points after the end of your data. However, you must already have used ESTIMATE to specify the time series to be forecast, and the model to be used for forecasting. This information is supplied by the SAVE option; if SAVE is not specified, FORECAST uses the information from the most recent ESTIMATE statement. Once you have used ESTIMATE, you can give successive FORECAST statements to incorporate new observations of the time series, and to produce forecasts from the end of the new data.

If the time series is supplied with a known model (that is, one with all its orders and parameters specified) you can use ESTIMATE with option setting METHOD=initialize before you use FORECAST. This will carry out just sufficient calculations, in particular the regeneration of the model residuals, for FORECAST to be used. The model parameters will not be changed – not even the innovation variance. This setting of METHOD restricts the structures, such as parameter standard errors, that can be accessed using TDISPLAY and TKEEP after ESTIMATE. The SAVE structure created by using ESTIMATE with METHOD=initialize thus requires less space than that produced by the other settings.

The PRINT option controls the printed output, and the CHANNEL option allows this to be sent to another output channel.

The ORIGIN option specifies the number of new values to be incorporated before forecasting ahead from that point. Setting this to a positive value n indicates that n new observations are to be added onto the end of the series. These new observations must be supplied in a variate using the NEWOBSERVATIONS option, which must be of length ≥n. The standardized forecast errors for these new observations can be printed or saved in a variate of length n using the SFE option.

The UPDATE option specifies whether these new observations are to be incorporated internally onto the end of the time series and the internal pointer moved to the end of the new observations. If UPDATE=yes is used, then ORIGIN=0 in future calls to FORECAST will point to the end of the n new observations. If the default, UPDATE=no is used, then the internal pointer remains at the end of the original series.

The number of future values to be forecast is set by option MAXLEAD. These new values can be saved in a variate of length MAXLEAD using the FORECAST option.

The PROBABILITY option determines the width of the error limits on the forecast. It defines the probability that the actual value will be contained within the limits at any particular lead time. Note that the limits do not apply simultaneously over all lead times.

The SETRANSFORM option specifies a variate to store the standard errors that Genstat used in calculating the error limits of the forecasts, starting at lead time 1. These are the standard errors of the transformed series, according to the value of the Box-Cox transformation parameter; they are functions of the model only, not of the data.

The LOWER option specifies a variate to store the lower limits of the forecasts. This must be the same length as the FORECAST variate. The FORECAST directive puts the values of the lower limit into the variate, matching the forecasts in the FORECAST variate. The UPPER option similarly allows the upper limits to be saved. Note that the limits are constructed as symmetric percentiles, assuming Normality of the transformed time series. Similarly, the forecast is a median value – not necessarily the mode or the mean, unless the transformation parameter is 1.0.

The SFE option specifies a variate to save the standardized errors of the forecasts. These are the innovation values that are generated as each successive new observation is incorporated, divided by the square root of the TSM innovation variance. They provide a useful check on the continuing adequacy of the model. For example, excessively large values (compared to the standard Normal distribution) may indicate that you should revise the model. The variate must be the same length as the FORECAST variate. The FORECAST directive places values of the errors in the variate, matching the new observations in the FORECAST variate.

The parameters of FORECAST are relevant only when the time-series model incorporates explanatory variables, which requires a TRANSFERFUNCTION statement before the ESTIMATE statement. You use the FUTURE parameter to specify a list of variates, corresponding to the list of variates specified by the SERIES parameter of TRANSFERFUNCTION. These variates must all have the same length. They hold future values of the explanatory variables to be used either for constructing forecasts of the response variable, or for incorporating new observations in order to revise the forecasts. You can use the METHOD parameter when some or all of the future values of the explanatory variables are forecasts obtained using univariate ARIMA models. You can amend the error limits of the forecasts for the response variable to allow for the uncertainty in these future values, but you need to assume that there is no cross-correlation between the errors in these predictions. The list of strings specified by the METHOD parameter indicates for each explanatory variable whether such an allowance should be made. The future values of a series are by default treated as known values if no corresponding ARIMA model is present, or if the transformation parameter of the ARIMA model is not equal to the value used in the regression model for that series. You can change the settings of the METHOD parameter in successive FORECAST statements.

The COMPONENTS option is also relevant only when the time-series model incorporates explanatory variables, and can be used to specify a pointer to variates in which you can save components of future values of the output series. There is a variate for each input component and for the output noise component. These variates correspond exactly to the variates that were specified by the FUTURE parameter for the input series, and by the FORECAST variate for the output series; corresponding lengths must match. The values that the variates hold can therefore be components of the forecasts of the output series, or can be new observations. The can be used to investigate the structure of forecasts.

If the input series ARIMA model and the transfer-function model have differing transformation parameters, then the METHOD option reverts to its default action of treating the values of any future input series as known quantities rather than forecasts.

Options: PRINT, CHANNEL, ORIGIN, UPDATE, NEWOBSERVATIONS, SFE, MAXLEAD, FORECAST, SETRANSFORM, LOWER, UPPER, PROBABILITY, COMPONENTS, SAVE.

Parameters: FUTURE, METHOD.

See also

Directives: TFORECAST.

Commands for: Time series.

Example

" Example TFIT-2: Forecast from a fitted model"

VARIATE  time; VALUES=!(1...120)
FILEREAD [NAME='%gendir%/examples/TFIT-1.DAT'] apt

" Define a model for the series as estimated in example ESTI-1"
TSM      [MODELTYPE=arima] airpass; ORDERS=!((0,1,1)2,12);\
         PARAMETERS=!(0,0,0.687785,0.374404,0.524588)
TFIT     [CONSTANT=fix] SERIES=apt; TSM=airpass

" Forecast one year ahead"
FORECAST [MAXLEAD=12; FORECAST=forecast; UPPER=ulim; LOWER=llim]

" Compare to actual values in a graph"
VARIATE  newtimes; VALUES=!(121...132)
UNITS    newtimes
VARIATE  [VALUES=360,342,406,396,420,472,548,559,463,407,362,405] newset
TEXT     [IPRINT=*] F; !t(12('F'))
PEN      1...4; SYMBOL=2('heavyminus'),'circle',0; LABEL=3(*),F;\ 
         COLOUR=2('red'),'black','blue'
DGRAPH   ulim,llim,newset,forecast; newtimes; PEN=1...4;\
         DESCRIPTION='Upper limit','Lower limit','Observed set',\
                     'Forecast set'
Updated on March 8, 2019

Was this article helpful?