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 *y _{t}* 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*,

*a*; you can interpret the innovations as the error in predicting

_{t }*y*from past values

_{t}*y*–

_{t}_{1},

*y*–

_{t}_{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 *y _{t}* is

φ(*B*) {∇^{d}*y _{t}*

^{(λ)}–

*c*} = θ(

*B*)

*a*

_{t}where *B* is the backward shift operator *B ^{p}y_{t }*=

*y*,

_{t-p }∇ is the differencing operator ∇*y _{t }*=

*y*–

_{t}*y*–

_{t}_{1 }, ∇

^{d}

*y*=∇

_{t }^{d-1 }(

*y*–

_{t}*y*–

_{t}_{1 }), and

φ(*B*) = 1 – φ_{1}*B* – … – φ_{p}*B ^{p}*

θ(*B*) = 1 – θ_{1}*B* – … – θ_{q}*B ^{q}*

The parameter λ specifies a Box-Cox power transformation defined by

*y _{t}*

^{(λ)}= (

*y*

_{t}^{λ}– 1) / λ, λ ≠ 0

*y _{t}*

^{(0)}= log(

*y*)

_{t}However, in the default case when λ is fixed and not estimated, the value λ=1 implies no transformation and then *y _{t}*

^{(1)}=

*y*rather than

_{t}*y*-1. If λ≠1 or if

_{t}*λ*is to be estimated, then Genstat will not let you have values of

*y*≤0. The usual case however is that λ=1 and is not to be estimated, so that

_{t }*y*may take any values.

_{t}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*, σ_{a}^{2}, φ_{1}…φ_{p}, θ_{1}…θ_{q}. You must always include the first three parameters. The parameter σ_{a}^{2} 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 σ_{a}^{2} 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****l*_{1} – … – φ_{p} *B****l _{p}*

θ(*B*) = 1 – θ_{1} *B****m*_{1} – … – θ_{q} *B****m _{q}*

The `LAGS`

parameter for this model contains *l*_{1}…*l _{p}*,

*m*

_{1}…

*m*. The sequences of lags

_{q}*l*

_{1}…

*l*must be positive integers that are strictly increasing; the default values are 1…

_{p}*p*if

`LAGS`

is not set. The same rule applies to *m*

_{1}…

*m*.

_{q}The seasonal ARIMA model for the time series *y _{t}* is an extension of the simple model, to the form

φ(*B*) Φ(*B ^{s}*) { ∇

^{d}∇

_{s}

^{D}y_{t}^{(λ)}–

*c*} = θ(

*B*) Θ(

*B*)

^{s}*a*

_{t}where the extra, seasonal, operators associated with seasonal period *s* are of three types:

Φ(*B ^{s}*) = 1 – Φ

_{1}

*B*– … – Φ

^{s}_{P}

*B***

*P*

_{s}which is seasonal autoregression of order *P*;

∇_{s}^{D}

which is seasonal differencing of order *D*; and

Θ(*B ^{s}*) = 1 – Θ

_{1}

*B*– … – Θ

^{s}_{Q}

*B***

*Q*

_{s}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*, σ_{a}^{2}, φ_{1}…φ_{p}, θ_{1}…θ_{q}, Φ_{1}…Φ_{P}, Θ_{1}…Θ_{Q}

You can modify the seasonal model to allow other lags:

Φ(*B ^{s}*) = 1 – Φ

_{1}

*B***

*L*

_{1}– … – Φ

_{P}

*B***

*L*

_{p}Θ(*B ^{s}*) = 1 – Θ

_{1}

*B***

*M*

_{1}– … – Θ

_{Q}

*B***

*M*

_{Q}The sequence of lags *L*_{1}…*L _{P}* must be strictly increasing and must be positive-integer multiples of the period

*s*; the default values are

*s*, 2

*s*…

*Ps*. The same rules apply to

*M*

_{1}…

*M*. For any seasonal model, you must extend the

_{Q}`LAGS`

parameter, if supplied, so that it contains*l*_{1} … *l _{p}*,

*m*

_{1}…

*m*,

_{q}*L*

_{1}…

*L*,

_{P}*M*

_{1}…

*M*.

_{Q}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+4*k*, *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 *z _{t}* of the output series to the corresponding input series

*x*, by the equation

_{t}δ(*B*) ∇^{d}* z _{t}* = ω(

*B*)

*B*{

^{b}*x*

_{t}^{(λ)}–

*c*}

where

δ(*B*) = 1 – δ_{1} *B* – … – δ_{p} *B ^{P}*

ω(B) = ω_{0} – ω_{1} *B* – … – ω_{q} *B ^{q}* .

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 *x _{t}* 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*)Δ(*B ^{s}*)∇

^{d}∇

_{s}

*= ω(*

^{D}z_{t}*B*)Ω(

*B*)

^{s}*B*{

^{b}*x*

_{t}^{(λ)}–

*c*}

Δ(*B ^{s}*) = 1 – Δ

_{1}

*B*– … – Δ

^{s}_{P}

*B*

^{Ps}Ω(*B ^{s}*) = 1 – Ω

_{1}

*B*– … – Ω

^{s}_{Q}

*B*

^{Qs}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