Bai and Carrion-i-Silvestre (2009) - Panel unit root tests with structural breaks

I would be so grateful if someone could help me with the following code from the panelbreak.e example on the carrionlib webpage: https://github.com/aptech/gauss-carrion-library/blob/master/examples/panelbreak.e.

I have a panel of data (25 years for 8 countries) and I would like to apply this test. If someone could please tell me how to alter this code so it uses my own data I will be so grateful. (I am new to GAUSS).

new;
cls;

library carrionlib;

// Load data
test_data = loadd(__FILE_DIR $+ "brics.xlsx", "lco2");

// Time periods
bigt = 29;

ncross = rows(test_data)/bigT;

// Create wide panel data
lco2_wide = reshape(test_data, ncross, bigT)';

// Declare control structurea
struct breakControl bCtl;

// Number of breaks
m = 3;

// Model
model = 4|m|1|1|2;

// Set the number of factors
k = 2;

// Number of maximum factors to allow
// and estimation method
kmax = 3|1;

// AR degress
p_ar = 0;

// Datevec
datevec = 0;

{ Z_test, test_n, test_chi, Z_test_sim, test_n_sim, test_chi_sim, fhat } = panelbreak(lco2_wide, model, p_ar, kmax, datevec);

print "Z test: " Z_test;
print "Pval (normal): " test_n;
print "Pval (Chi-square): " test_chi;

print;

print "Simplified tests";
print "Z test: " Z_test_sim;
print "Pval (normal): " test_n_sim;
print "Pval (Chi-square): " test_chi_sim;

1 Answer



0



To alter the panelbreak.e example to use your own data, you need to change the data loading section of the code. This line:

// Load data
test_data = loadd(__FILE_DIR $+ "brics.xlsx", "lco2");

specifies which data file (brics.xlsx) to load and uses the formula string to specify which variables to load from the file.

In addition, please note that the panelbreak procedure requires balanced panel data that is in a wide format. These lines are converting the stacked panel data loaded from brics.xlsx into wide format:

// Time periods
bigt = 29;
ncross = rows(test_data)/bigT;

// Create wide panel data
lco2_wide = reshape(test_data, ncross, bigT)';

I suggest reviewing the following related resources for more information:

  1. Loading variables from a file
  2. The Current Working Directory: What you Need to Know
  3. Running Publicly Available GAUSS Code Pt. 1
  4. Running Publicly Available GAUSS Code Pt. 2

Eric

105

Your Answer

1 Answer

0

To alter the panelbreak.e example to use your own data, you need to change the data loading section of the code. This line:

// Load data
test_data = loadd(__FILE_DIR $+ "brics.xlsx", "lco2");

specifies which data file (brics.xlsx) to load and uses the formula string to specify which variables to load from the file.

In addition, please note that the panelbreak procedure requires balanced panel data that is in a wide format. These lines are converting the stacked panel data loaded from brics.xlsx into wide format:

// Time periods
bigt = 29;
ncross = rows(test_data)/bigT;

// Create wide panel data
lco2_wide = reshape(test_data, ncross, bigT)';

I suggest reviewing the following related resources for more information:

  1. Loading variables from a file
  2. The Current Working Directory: What you Need to Know
  3. Running Publicly Available GAUSS Code Pt. 1
  4. Running Publicly Available GAUSS Code Pt. 2


You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.

Try GAUSS for 14 days for FREE

See what GAUSS can do for your data

© Aptech Systems, Inc. All rights reserved.

Privacy Policy