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

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,

**and**

*GFC*__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

To start with lag selection, follow the below steps:

- Click on ‘Statistics’ on Result window
- Choose ‘Multi-variate Time Series’
- Click on ‘VAR Diagnostic and Test’
- 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**.

As the graph shows, trends for both ** GFC** and

__PFC__is upward, indicating that mean and variances of both variables are non-constant. That means both the series are non-stationary. For more clarity, use the augmented Dickey-Fuller test. In order to transform the times series

__PFC__and

**into stationary, apply differencing. Following the below two commands:**

*GFC*- Generate gfc_d1 = d1.gfc
- Generate pfc_d1 = d1.pfc

The first differencing series of ** GFC** (gfc_d1) and

__PFC__(pfc_d1) is generated. To ascertain the stationarity, again perform augmented Dickey-Fuller test. The figure below shows the result for

**(gfc_d1) and**

*GFC*__PFC__(pfc_d1):

The p values for both differenced series of ** GFC** (gfc_d1) and

__PFC__(pfc_d1) is close to zero, which means the null hypothesis of non-stationarity can be rejected and first differenced time series are stationary.

This article shows how to perform lag selection and stationarity test in a *VAR* with three variables **GDP**, __PFC__ and __GFC__. The next article shows the co-integration test to choose the correct type of *VAR* model.

I am a management graduate with specialisation in Marketing and Finance. I have over 12 years' experience in research and analysis. This includes fundamental and applied research in the domains of management and social sciences. I am well versed with academic research principles. Over the years i have developed a mastery in different types of data analysis on different applications like SPSS, Amos, and NVIVO. My expertise lies in inferring the findings and creating actionable strategies based on them.

Over the past decade I have also built a profile as a researcher on Project Guru's Knowledge Tank division. I have penned over 200 articles that have earned me 400+ citations so far. My Google Scholar profile can be accessed here.

I now consult university faculty through Faculty Development Programs (FDPs) on the latest developments in the field of research. I also guide individual researchers on how they can commercialise their inventions or research findings. Other developments im actively involved in at Project Guru include strengthening the "Publish" division as a bridge between industry and academia by bringing together experienced research persons, learners, and practitioners to collaboratively work on a common goal.

## Discuss