The function returns infomation criteria and final prediction error for sequential increasing the lag order up to a VAR(p)-proccess. which are based on the same sample size.

```
VARselect(y, lag.max = 10, type = c("const", "trend", "both", "none"),
season = NULL, exogen = NULL)
```

y

Data item containing the endogenous variables

lag.max

Integer for the highest lag order (default is
`lag.max = 10`

).

type

Type of deterministic regressors to include.

season

Inlusion of centered seasonal dummy variables (integer value of frequency).

exogen

Inlusion of exogenous variables.

A list with the following elements:

Vector with the optimal lag number according to each criterium.

A matrix containing the values of the criteria up to
`lag.max`

.

Estimates a VAR by OLS per equation. The model is of the following form:

$$ \bold{y}_t = A_1 \bold{y}_{t-1} + \ldots + A_p \bold{y}_{t-p} + CD_t + \bold{u}_t $$

where \(\bold{y}_t\) is a \(K \times 1\) vector of endogenous
variables and \(u_t\) assigns a spherical disturbance term of the
same dimension. The coefficient matrices \(A_1, \ldots, A_p\) are of
dimension \(K \times K\). In addition, either a constant and/or a
trend can be included as deterministic regressors as well as centered
seasonal dummy variables and/or exogenous variables (term \(CD_T\), by
setting the `type`

argument to the corresponding value and/or
setting `season`

to the desired frequency (integer) and/or providing a
matrix object for `exogen`

, respectively. The default for `type`

is
`const`

and for `season`

and `exogen`

the default is
set to `NULL`

.
Based on the same sample size the following information criteria and
the final prediction error are computed:
$$
AIC(n) = \ln \det(\tilde{\Sigma}_u(n)) + \frac{2}{T}n K^2 \quad,
$$
$$
HQ(n) = \ln \det(\tilde{\Sigma}_u(n)) + \frac{2 \ln(\ln(T))}{T}n K^2 \quad,
$$
$$
SC(n) = \ln \det(\tilde{\Sigma}_u(n)) + \frac{\ln(T)}{T}n K^2 \quad,
$$

$$ FPE(n) = \left ( \frac{T + n^*}{T - n^*} \right )^K \det(\tilde{\Sigma}_u(n)) \quad , $$ with \(\tilde{\Sigma}_u (n) = T^{-1} \sum_{t=1}^T \bold{\hat{u}}_t \bold{\hat{u}}_t'\) and \(n^*\) is the total number of the parameters in each equation and \(n\) assigns the lag order.

Akaike, H. (1969), Fitting autoregressive models for prediction,
*Annals of the Institute of Statistical Mathematics*,
**21**: 243-247.

Akaike, H. (1971), Autoregressive model fitting for control,
*Annals of the Institute of Statistical Mathematics*,
**23**: 163-180.

Akaike, H. (1973), Information theory and an extension of the maximum
likelihood principle, in B. N. Petrov and F. Cs<e1>ki (eds.), *2nd
International Symposium on Information Theory*, Acad<e9>mia Kiad<f3>,
Budapest, pp. 267-281.

Akaike, H. (1974), A new look at the statistical model identification,
IEEE *Transactions on Automatic Control*, **AC-19**:
716-723.

Hamilton, J. (1994), *Time Series Analysis*, Princeton
University Press, Princeton.

Hannan, E. J. and B. G. Quinn (1979), The determination of the order
of an autoregression, *Journal of the Royal Statistical Society*,
**B41**: 190-195.

L<U+34AE5C2F>hl, H. (2006), *New Introduction to Multiple Time Series
Analysis*, Springer, New York.

Quinn, B. (1980), Order determination for a multivariate
autoregression, *Journal of the Royal Statistical Society*,
**B42**: 182-185.

Schwarz, G. (1978), Estimating the dimension of a model, *Annals
of Statistics*, **6**: 461-464.

```
# NOT RUN {
data(Canada)
VARselect(Canada, lag.max = 5, type="const")
# }
```

Run the code above in your browser using DataLab