# Lag selection and stationarity in VAR with three variables in STATA

By Divya Dhuria and Priya Chetty on September 27, 2018

The previous article explained how to perform the lag selection, Johansen co-integration test and Vector Auto Regression (VAR) with two variables, Gross Domestic Product (GDP) and Private Final Consumption (PFC). This article incorporates Gross Fixed Capital Formation (GFC) and again performs the lag selection test and check for stationarity for both, GFC and PFC. Thus this article incorporates the VAR with three variables in STATA. The process also includes Johansen cointegration test for the model including all three-time series.

While running the regression for time series data, it is important to include the lagged values of the dependent as well as independent variables. For instance, last year’s GDP may be correlated to this year’s GDP, this showing lagged values. Thus if past values affect today’s values then more lags will be necessary. Therefore, to determine the exact level of lags, the first step is to perform lag selection criteria in STATA.

## Lag selection

1. Click on ‘Statistics’ on Result window
2. Choose ‘Multi-variate Time Series’
3. Click on ‘VAR Diagnostic and Test’
4. Select ‘Lag-order selection statistics’.

After selecting the lag-order selection statistics, a ‘varsoc’ window will open in STATA (figure below). Select two components on the main windo; the list of dependent variables (GDP, GFC and PFC), and the maximum lag order.

Select the maximum number of lags to check; for instance, “8”. Further in ‘Dependent variables’ option, select three main variables GDP, GFC and PFC.

The results will appear in the output window (figure below). The STATA command for lag selection is also visible here. Alternatively, use the below command to generate the result:

`varsoc gdp gfc pfc, max lag (8)`

In the result table, the number of lags in the first column and the parameters for optimal lags like Final Prediction Error (FPE), Akaike information criterion (AIC), Hannan Quinn Information Criteria (HQIC) and Schwartz Information Criteria (SBIC) are visible. STATA with this command computes four information criteria as well as a sequence of likelihood ratio (LR) tests.

## Identify the number of lags

To identify the number of lags, select the values showing “”. For instance, FPE shows value at lag 8 and carries the sign “”. Therefore, the lag as per FPE criteria is 8. In order to select the parameter with optimal lags for VAR, follow the majority number. That means, if three out of four parameters show the same number of lags, let’s say 8, then take 8 lags. However, in this case, it is not possible to follow the majority since two parameters show 1 and the other two show 8. Therefore, follow the AIC and FPE criteria, since the number of observations is more than 60.

## Stationarity

This case follows the same steps for GFC and PFC used in the case of ARIMA where stationarity of GDP time series was checked. The figure below shows the time series graph of PFC and GFC.