1. Home
  2. BJFORECAST procedure

BJFORECAST procedure

Plots forecasts of a time series using a previously fitted ARIMA (G. Tunnicliffe Wilson & S.J. Welham).

Options

PROBABILITY = scalar Probability value used for forecast limits; default 0.9
GRAPHICS = string token What type of graphics to use (lineprinter, highresolution); default high
WINDOW = scalar Window to be used for plotting; default 1
PENS = variate The three pens to be used (after being defined appropriately) for drawing the plots; default !(1,2,3)

Parameters

SERIES = variates Variates holding the time series to be used for producing forecasts
LENGTH = scalars or variates Specifies the units to be used from each series: a scalar N specifies that the first N units of the series are to be used, a variate of length 2 gives the time index of the first and last units of the subseries to be used; by default the whole series is used
TSM = TSMs ARIMA model to be used for forecasting
TIMERANGE = variates The first and second elements of each variate specify respectively the first and last time index, relative to the whole series, of the range to be forecast
ORIGIN = scalars The time of the latest observation to be used to construct forecasts with increasing leadtimes for each series; if ORIGIN is unset, the default is to take the latest time point in the series prior to the range given by TIMERANGE, unless parameter LEADTIME is set, in which case fixed leadtime forecasts are constructed
LEADTIME = scalars The fixed leadtime to be used to construct forecasts if ORIGIN is unset
FORECAST = variates Save the values of the constructed forecasts
LOWER = variates Save the lower limits of the forecasts
UPPER = variates Save the upper limits of the forecasts
SFE = variates Save the standardized forecast errors, available only for LEADTIME=1

Description

For a time series variate, given by the SERIES parameter, BJFORECAST plots forecasts calculated from a previously fitted ARIMA model, specified by the TSM parameter. The set of time points for which forecasts are produced is defined by setting the TIMERANGE parameter to a variate of length 2 holding the first and last time index. If only part of the series is to be used to initialize for forecasting, this is specified by setting parameter LENGTH, either to a scalar N to indicate that the first N values are to be used, or to a variate of length 2 holding the positions of the first and last units to be included. The procedure also prints a description of the series, and details of the model involved in the initialization for forecasting.

There are two options to control the type of forecasting. Setting the ORIGIN parameter to a scalar indicates that forecasts are calculated from this time point (at increasing leadtimes) for the range of future times specified by the TIMERANGE parameter. Alternatively, if ORIGIN is unset, it is possible to produce forecasts with a fixed leadtime, by setting the parameter LEADTIME to the required value. If neither ORIGIN nor LEADTIME are set, a default origin is taken, namely the last element before the time range to be forecast. Where possible, the values of the supplied series are also plotted for comparison. If one-step-ahead forecasts are requested (fixed leadtime set to 1), the standardized forecast errors are plotted as a tracking signal for use in checking the continuing adequacy of the model.

The FORECAST parameter can be used to save the calculated forecasts in a variate and parameters LOWER and UPPER can save the lower and upper confidence limits for these forecasts. If the forecasts are from a fixed leadtime of 1, the standardized forecast errors can be saved in a variate given by parameter SFE; because of the way in which the standard errors are calculated, the last value of this variate is always missing. The PROBABILITY option indicates the probability value to be used for the confidence limits, with 0.9 as the default value.

Option GRAPHICS controls whether plots are produced for line printer or for the current high-resolution graphics device; by default high-resolution plots are produced. The window to be used for high-resolution plots is specified by the WINDOW option; by default WINDOW=1. The FRAME directive can be used to set the attributes of this window before calling the procedure, and these will be unchanged on leaving the procedure. The PENS option controls which pens are to be used for the plots; the attributes of these pens are modified within the procedure. By default pens 1-3 are used, but these can be changed by setting option PENS to a variate of length 3 containing the numbers of the three different pens required.

Options: PROBABILITY, GRAPHICS, WINDOW, PENS.

Parameters: SERIES, LENGTH, TSM, TIMERANGE, ORIGIN, LEADTIME, FORECAST, LOWER, UPPER, SFE.

Method

The values of the supplied series values, up to the origin, are used to initialize for forecasting (by residual regeneration), and the forecasts are then constructed over the requested time range. If fixed leadtime forecasts are required, the origin is successively updated for each forecast.

Action with RESTRICT

The input and output structures must not be restricted. Restriction of the input series to a contiguous set of units can be achieved using the LENGTH parameter.

See also

Directive: TFORECAST.

Procedures: BJESTIMATE, BJIDENTIFY.

Commands for: Time series.

Example

CAPTION    'BJFORECAST example',!t(\
           'Data from Andrews & Herzberg (1985), Data, A Collection',\
           'of Problems from Many Fields for the Student and Research',\
           'Worker, Springer-Verlag, pp. 369-370.'); STYLE=meta,plain
VARIATE    [VALUES= 8.075,7.819,7.366,8.113,7.380,7.134,7.222,7.768,\
                    7.386,6.965,6.478,8.105,8.060,7.684,7.580,7.093,\
                    6.129,6.026,6.679,7.414,7.112,7.762,7.645,8.639,\
                    7.667,8.080,6.678,6.739,5.569,5.049,5.642,6.808,\
                    6.636,8.241,7.968,8.044,7.791,7.024,6.102,6.053,\
                    5.941,5.386,5.811,6.716,6.923,6.939,6.705,6.914] Profit
TSM        Model; ORDERS=!(2,0,1,0,1,1,4);\
           PARAMETERS=!(1,-0.0928,0.1911,1.5650,-0.8474,0.9988,0.9111)
CAPTION    !t('Use BJFORECAST for series Profit based on times 1-40 and',\
           'ARIMA model Model to produce forecasts for times 41-56.')
BJFORECAST Profit; TSM=Model; TIMERANGE=!(41,56)
CAPTION    !t('Use BJFORECAST to produce one-step ahead forecasts based',\
           'on Model for series Profit at time points 41-50.')
BJFORECAST Profit; TSM=Model; TIMERANGE=!(41,50); LEADTIME=1
Updated on March 8, 2019

Was this article helpful?