Declares one or more TSM data structures.
Option
MODELTYPE = string token |
Type of model (arima , transfer ); default arim |
---|
Parameters
IDENTIFIER = identifiers |
Identifiers of the TSMs |
---|---|
ORDERS = variates |
Orders of the autoregressive, integrated and moving-average parts of each TSM |
PARAMETERS = variates |
Parameters of each TSM |
LAGS = variates |
Lags, if not default |
Description
The TSM structure stores a time-series model which you can use with directives such as TFIT
for Box-Jenkins modelling of time series. The information that you give to specify the model is stored in two variates, called the orders and the parameters; an optional third variate contains lags. The elements of a TSM are thus
[1]
or ['Orders']
;
[2]
or ['Parameters']
;
[3]
or ['Lags']
.
The labels of the TSM can be specified in either upper or lower case, or any mixture.
To declare a TSM you use the TSM
directive. You set the type of model by the MODELTYPE
option. The default setting defines an ARIMA model. This is an equation relating the present value yt of an observed time series to past values. The equation includes lagged values not only of the series itself, but also of an unobserved series of innovations, at ; you can interpret the innovations as the error in predicting yt from past values yt–1, yt–2 …. The usual statistical model assumes that the innovations are a series of independent Normal deviates with mean zero and constant variance. The residuals obtained from fitting the model can be used to estimate the innovations.
Using the notation of Box & Jenkins (1970), the simple non-seasonal ARIMA model for the time series yt is
φ(B) {∇dyt(λ) – c} = θ(B)at
where B is the backward shift operator Bpyt =yt-p ,
∇ is the differencing operator ∇yt =yt–yt–1 , ∇dyt =∇d-1 (yt–yt–1 ), and
φ(B) = 1 – φ1B – … – φpBp
θ(B) = 1 – θ1B – … – θqBq
The parameter λ specifies a Box-Cox power transformation defined by
yt(λ) = (ytλ – 1) / λ, λ ≠ 0
yt(0) = log(yt)
However, in the default case when λ is fixed and not estimated, the value λ=1 implies no transformation and then yt(1)=yt rather than yt-1. If λ≠1 or if λ is to be estimated, then Genstat will not let you have values of yt ≤0. The usual case however is that λ=1 and is not to be estimated, so that yt may take any values.
The ORDERS
parameter is a list of variates, one for each of the models. For each simple ARIMA model, the variate contains the three values p, d and q.
The PARAMETERS
parameter is a list of variates, one for each of the models. For each simple ARIMA model, the variate contains (3+p+q) values: λ, c, σa2, φ1…φp, θ1…θq. You must always include the first three parameters. The parameter σa2 is the innovation variance.
Whenever a TSM is used, Genstat checks its values. The orders must all be non-negative. The parameters λ and c can take any values, but σa2 must be non-negative. The next p+q values specify the autoregressive and moving-average parameters: they must satisfy the stationarity and invertibility conditions for ARIMA models (see Box & Jenkins 1970). An exception is that before estimation the model parameters may be unset, in which case Genstat sets them to default values. You can omit the PARAMETERS
parameter, in which case an unnamed structure is defined to contain the default values. However, you should usually specify the variate of parameters, and if possible assign good preliminary values before estimation (see FTSM
) as this will speed up the model fitting process.
The LAGS
parameter is a list of variates, one for each of the models. For each simple ARIMA model, this variate contains p+q values, one corresponding to each of the autoregressive and moving-average parameters. Genstat then modifies the ARIMA model by defining
φ(B) = 1 – φ1 B**l1 – … – φp B**lp
θ(B) = 1 – θ1 B**m1 – … – θq B**mq
The LAGS
parameter for this model contains l1…lp, m1…mq. The sequences of lags l1…lp must be positive integers that are strictly increasing; the default values are 1…p if LAGS
is not set. The same rule applies to m1…mq.
The seasonal ARIMA model for the time series yt is an extension of the simple model, to the form
φ(B) Φ(Bs) { ∇d∇sDyt(λ) – c } = θ(B) Θ(Bs) at
where the extra, seasonal, operators associated with seasonal period s are of three types:
Φ(Bs) = 1 – Φ1 Bs – … – ΦP B**Ps
which is seasonal autoregression of order P;
∇sD
which is seasonal differencing of order D; and
Θ(Bs) = 1 – Θ1 Bs – … – ΘQ B**Qs
which is seasonal moving average of order Q.
When seasonal terms are to be included, you must extend the ORDERS
parameter so that it contains p, d, q, P, D, Q and s. Even if the non-seasonal part of the model has p=d=q=0, these parameters must still be included at the beginning of the list. The seasonal orders must satisfy P≥0, D≥0, Q≥0 and s≥1.
You must also extend the PARAMETERS
parameter to contain:
λ, c, σa2, φ1…φp, θ1…θq, Φ1…ΦP, Θ1…ΘQ
You can modify the seasonal model to allow other lags:
Φ(Bs) = 1 – Φ1 B**L1 – … – ΦP B**Lp
Θ(Bs) = 1 – Θ1 B**M1 – … – ΘQ B**MQ
The sequence of lags L1…LP must be strictly increasing and must be positive-integer multiples of the period s; the default values are s, 2s … Ps. The same rules apply to M1…MQ. For any seasonal model, you must extend the LAGS
parameter, if supplied, so that it contains
l1 … lp, m1 … mq, L1 … LP, M1 … MQ.
You can use multiple seasonal periods, by extending the variate of ORDERS
with further seasonal orders P′, D′, Q′ and s′. You must correspondingly extend the variates of PARAMETERS
and LAGS
. It is also possible to set the seasonal periods to 1, which means you can estimate non-seasonal models with factored operators.
You can declare an ORDERS
variate to have more values than is necessary, provided that the extra values are filled with zeroes, and that the number of values is 3+4k, k being the number of seasonal periods. The same applies to PARAMETERS
and LAGS
variates, except that Genstat ignores the extra values whatever they may be. Thus you can extend a simple model to a seasonal model, simply by resetting the extra values.
Setting MODELTYPE=transferfunction
defines a transfer-function model. The simple non-seasonal transfer-function model relates a component zt of the output series to the corresponding input series xt, by the equation
δ(B) ∇d zt = ω(B) Bb {xt(λ) – c}
where
δ(B) = 1 – δ1 B – … – δp BP
ω(B) = ω0 – ω1 B – … – ωq Bq .
The integer b>0 defines a pure delay, and the integer d>0 defines the order of differencing in the transfer function.
The parameter λ specifies a Box-Cox power transformation for the input series, and the parameter c specifies a reference level for the transformed input. There is no mean correction of the input series when transfer-function models are estimated, and you should use a value of c close to the series mean so as to improve the numerical conditioning of the estimation procedure. However, if the input series xt is trend-like rather than stationary, you could alternatively use a value for c close to the early series values, because this reduces the transient errors that arise when the transfer function is applied. The PRIORMETHOD
parameter of TRANSFERFUNCTION
, described below, provides further means of handling these transients.
The parameters λ and c are not estimated unless you specify otherwise by the BOXCOXMETHOD
parameter of TRANSFERFUNCTION
or the FIX
option of TFIT
. Often c in the transfer-function model is aliased with the constant term in the ARIMA errors, and so they should not both be estimated. In some circumstances, however, they both could be estimated, for example in a differenced transfer-function model with stationary noise.
The ORDERS
parameter for the simple transfer-function model described above specifies a variate containing the four values b, p, d and q.
The PARAMETERS
parameter specifies a variate containing 3+p+q values: λ, c, δ1, … δp, ω0, ω1 … ωq. You must always include the parameters λ, c and ω0. When you use a transfer-function model, Genstat will check its parameter values. In particular the operator δ(B) must satisfy the stability or stationarity condition.
The LAGS
parameter is optional, and may be used to change the lags associated with the parameters, from the default values of 1 … p, 1 … q. The variate of lags contains values corresponding to the parameters δ1 … δp, ω1 … ωq. They have the same interpretation as the lags in ARIMA models, and must satisfy the same conditions. Note that there is no lag associated with ω0, because the delay b provides the necessary flexibility for this.
You can also have seasonal extensions of transfer-function models:
δ(B)Δ(Bs)∇d∇sDzt = ω(B)Ω(Bs)Bb{xt(λ) – c}
Δ(Bs) = 1 – Δ1 Bs – … – ΔP BPs
Ω(Bs) = 1 – Ω1 Bs – … – ΩQ BQs
Note that there is no Ω0 coefficient, because ω0 is always present in the model and provides sufficient flexibility.
The ORDERS
parameter here contains b, p, d, q, P, D, Q and s, and the PARAMETERS
parameter contains λ, c, δ1 … δp, ω0 … ωq, Δ1 … ΔP, Ω1 … ΩQ. You can analogously extend the LAGS
parameter. You can also have extensions to multiple seasonal periods, as for ARIMA models.
Option: MODELTYPE
.
Parameters: IDENTIFIER
, ORDERS
, PARAMETERS
, LAGS
.
Reference
Box, G.E.P. & Jenkins, G.M. (1970). Time Series Analysis, Forecasting and Control. Holden-Day, San Francisco.
See also
Directives: FTSM
, TDISPLAY
, TFILTER
, TFIT
, TFORECAST
, TKEEP
, TRANSFERFUNCTION
, TSUMMARIZE
, CORRELATE
, FOURIER
, POINTER
.
Procedures: BJESTIMATE
, BJFORECAST
, BJIDENTIFY
, MOVINGAVERAGE
, PERIODTEST
, PREWHITEN
, REPPERIODOGRAM
, SMOOTHSPECTRUM
.
Commands for: Data structures, Time series.
Example
" Example TFIT-1: Fitting a seasonal ARIMA model" VARIATE time; VALUES=!(1...120) FILEREAD [NAME='%gendir%/examples/TFIT-1.DAT'] apt " Display the correlation structure of the logged data" CALCULATE lapt = LOG(apt) BJIDENTIFY [GRAPHICS=high; WINDOWS=!(5,6,7,8)] lapt " Calculate the autocorrelations of the differences and seasonally differenced series" CALCULATE ddslapt = DIFFERENCE(DIFFERENCE(lapt; 12); 1) CORRELATE [PRINT=auto; MAXLAG=48] ddslapt; AUTO=ddsr " Define a model for the series: IMA(1) (that is, a model with a single moving-average parameter applied to the differences of the series) plus a seasonal IMA(1) component" TSM [MODELTYPE=arima] airpass; ORDERS=!((0,1,1)2,12) " Form preliminary estimates of the parameters, using a log transformation (BOXCOX=0 is equivalent to log)" FTSM [PRINT=model] airpass; ddsr; BOXCOX=0 " Get the best estimates, fixing the constant" TFIT [CONSTANT=fix] SERIES=apt; TSM=airpass " Graph the residuals against time" TKEEP RESID=resids DGRAPH [WINDOW=3; KEYWINDOW=0; TITLE='Residuals vs Time'] resids; time " Test the independence of the residuals" CORRELATE [GRAPH=auto; MAXLAG=48] resids; TEST=S PRINT 'Test statistic for independence of the residuals',S