I have N:12 T:31 panel data. I have (y1) 1 dependent variables and 2 (x1, x2) independent variables. I would like to perform second generation panel cointegration test. ı planing to perform 3 panel cointegration test. first test Panel westerlund ecm.boot, second panel durbin hausman test, thirdly westerlund coint.prg test. But ı have confused how to adjust code. below this code belong to ecm_boot. ıs this correct?

```
new;
library tspdlib;
// Here we load all data for testing
// Note that this dataset is stacked
// and the ecm_panel procedure
// requires wide panel data
data = loadd("C:/Users/AK SAÇLI/Desktop/gauss içinnnn jubile.dta", "code + y1 + x1 + x2");
// Time periods
t = 31;
ncross = rows(data)/t;
k = (cols(data)-3);
// Convert dependent data
// from stacked to wide
y = reshape(data[., 2], ncross, t)';
// Convert independent data
// from stacked to wide
x = reshape(data[., 3]', ncross*k, t)';
// Number of bootstrap replications
nb = 1000;
// Model specification
// 1 = Nothing
// 2 = Constant
// 3 = Constant & Trend
mod = 3;
// Lags
p = int(4*(t/100)^(2/9));
// Leads
q = int(4*(t/100)^(2/9));
// Bandwidth
r = int(4*(t/100)^(2/9));
// Run the test
{ test, pval } = ecm_panel(y, x, mod, p, q, r);
```

## 3 Answers

0

Hello,

Thank you for your question. The test referenced in this program file is actually part of the Westerlund library. Prior to using this test you need to install and load the Westerlund library.

A great place to get started with GAUSS libraries is our previous blog, Using GAUSS Packages [A Guide].

There are a few general steps that should be taken to run tests from libraries:

- Install and load the library (a library only needs to be installed once but will need to be loaded every time GAUSS is restarted.)
- Save a copy of the example file related to the test you want to run.
- Change the data loading portion of the copied example file.
- Adjust the test parameters as needed.

0

I have N:12 T:31 panel data. I downloaded this library and then set up it. I have 1 dependent variable, 2 independent variables. The example in the library has one dependent variable and 1 independent variable. But I have 2 independent variable. Because of that, how to adjust these sections;

```
// Convert independent data
// from stacked to wide
x = reshape(data[., 3]', ncross*k, t)';
```

below its my new strucuture is correct ?

```
new;
library westerlundlib;
// Here we load all data for testing
// Note that this dataset is stacked
// and the ecm_panel procedure
// requires wide panel data
data = loadd("C:/Users/AK SAÇLI/Desktop/gauss içinnnn jubile.dta", "code + y1 + x1 +x2");
// Time periods
t = 31;
ncross = rows(data)/t;
k = (cols(data)-2);
// Convert dependent data
// from stacked to wide
y = reshape(data[., 2], ncross, t)';
// Convert independent data
// from stacked to wide
x = reshape(data[., 3]', ncross*k, t)';
// Number of bootstrap replications
nb = 1000;
// Model specification
// 1 = Nothing
// 2 = Constant
// 3 = Constant & Trend
mod = 1;
// Lags
p = int(4*(t/100)^(2/9));
// Leads
q = int(4*(t/100)^(2/9));
// Bandwidth
r = int(4*(t/100)^(2/9));
// Run the test
{ test, pval } = ecm_panel(y, x, mod, p, q, r);
```

0

To adjust the code above to account for more than one variable, the following code

```
// Convert independent data
// from stacked to wide
x = reshape(data[., 3]', ncross*k, t)';
```

should be modified to reference whatever columns contain the independent variable you want to use in you model.

For example, suppose that the independent variables for your model are contained the third and fourth columns. Your code should read:

```
// Convert independent data
// from stacked to wide
x = reshape(data[., 3:4]', ncross*k, t)';
```

## Your Answer

## 3 Answers

Hello,

Thank you for your question. The test referenced in this program file is actually part of the Westerlund library. Prior to using this test you need to install and load the Westerlund library.

A great place to get started with GAUSS libraries is our previous blog, Using GAUSS Packages [A Guide].

There are a few general steps that should be taken to run tests from libraries:

- Install and load the library (a library only needs to be installed once but will need to be loaded every time GAUSS is restarted.)
- Save a copy of the example file related to the test you want to run.
- Change the data loading portion of the copied example file.
- Adjust the test parameters as needed.

I have N:12 T:31 panel data. I downloaded this library and then set up it. I have 1 dependent variable, 2 independent variables. The example in the library has one dependent variable and 1 independent variable. But I have 2 independent variable. Because of that, how to adjust these sections;

```
// Convert independent data
// from stacked to wide
x = reshape(data[., 3]', ncross*k, t)';
```

below its my new strucuture is correct ?

```
new;
library westerlundlib;
// Here we load all data for testing
// Note that this dataset is stacked
// and the ecm_panel procedure
// requires wide panel data
data = loadd("C:/Users/AK SAÇLI/Desktop/gauss içinnnn jubile.dta", "code + y1 + x1 +x2");
// Time periods
t = 31;
ncross = rows(data)/t;
k = (cols(data)-2);
// Convert dependent data
// from stacked to wide
y = reshape(data[., 2], ncross, t)';
// Convert independent data
// from stacked to wide
x = reshape(data[., 3]', ncross*k, t)';
// Number of bootstrap replications
nb = 1000;
// Model specification
// 1 = Nothing
// 2 = Constant
// 3 = Constant & Trend
mod = 1;
// Lags
p = int(4*(t/100)^(2/9));
// Leads
q = int(4*(t/100)^(2/9));
// Bandwidth
r = int(4*(t/100)^(2/9));
// Run the test
{ test, pval } = ecm_panel(y, x, mod, p, q, r);
```

To adjust the code above to account for more than one variable, the following code

```
// Convert independent data
// from stacked to wide
x = reshape(data[., 3]', ncross*k, t)';
```

should be modified to reference whatever columns contain the independent variable you want to use in you model.

For example, suppose that the independent variables for your model are contained the third and fourth columns. Your code should read:

```
// Convert independent data
// from stacked to wide
x = reshape(data[., 3:4]', ncross*k, t)';
```