the Carrion-i-Silvestre et al. (2005) unit root test for panel data

Dear users,
i am a phd student from tunisia.I do need your help to make the Carrion-i-Silvestre et al. (2005) test. i have got the gauss code (coderepl.zip and boostrap.zip). i have a panel data in excel sheet for (14 countries over the period (1980-2012) and i have 5 variables). i set up gauss10 edition. could you sir send to me the steps and gauss command, which help me to perform the unit root test mentioned above (from importing excel data to the output of the test). really, i do need this to complete my thesis. pleaaaaaaaaaaaase help me.
i do thank you for your support and the code is as follows and please tell me what i should change to test my own panel data. it contains 14 countries over the period(1980-2012) and 5 variable in order to test stationarity in level and first difference and to apply panel vecm.

/*
Lectura de la base de dades de PIB per capita
de Maddison.

Període: 1870-1994 per a 17 països (primera columna amb els anys).
*/

new;
cls;

output file=c:\josepll\articles\pankpss\bootstrap\carrion.out reset;
outwidth 256;

load odata[125,18]=c:\josepll\articles\pankpss\unknown\Maddison\pibpcmad.prn;

aus=ln(odata[.,2]);
aust=ln(odata[.,3]);
bel=ln(odata[.,4]);
can=ln(odata[.,5]);
den=ln(odata[.,6]);
fin=ln(odata[.,7]);
fra=ln(odata[.,8]);
ger=ln(odata[.,9]);
ita=ln(odata[.,10]);
jap=odata[1:15,11]|ln(odata[16:rows(odata),11]);
ned=ln(odata[.,12]);
nze=ln(odata[.,13]);
nor=ln(odata[.,14]);
swe=ln(odata[.,15]);
swi=odata[1:29,16]|ln(odata[30:rows(odata),16]);
uk=ln(odata[.,17]);
usa=ln(odata[.,18]);

print "
/*********************************************************************/
/* Anàlisi */
/*********************************************************************/ " ;

/*data=aust~bel~can~den~fra~jap~usa; @ Data set that RHo at the 1% in Ben-David and Papell (1995) @*/
/*data=aust~bel~can~den~fra~jap~swe~uk~usa; @ Data set that RHo at the 1% and 2.5% in Ben-David and Papell (1995) @*/
/*data=aust~bel~can~den~fin~fra~ger~jap~swe~uk~usa; @ Data set that RHo at the 1, 2.5 and 10% in Ben-David and Papell (1995) @*/
/*data=aus~aust~bel~can~den~fin~fra~ger~ita~jap~ned~nze~nor~swe~swi~uk~usa; @ The Whole data set @*/
data=aus~aust~bel~can~den~fin~fra~ger~ita~ned~nze~nor~swe~uk~usa; @ Countries with complete time series 1870-... @

k=cols(data); @ Number of countries (individuals) @
bigt=rows(data); @ Number of time periods @
kernel=0|5;

m=5; @maximum number of structural changes allowed@

model0=2; @ Model quan no hi ha canvis. Segon model: efectes individuals + tendència @
model = 4; @ Model quan hi ha canvis. Canvis en la mitjana i en el pendent @

/*
model0=1; @ Model quan no hi ha canvis. Primer model: efectes individuals @
model = 3; @ Model quan hi ha canvis. Canvis en la mitjana @
*/

/**********************************************************************************************/
/**********************************************************************************************/

eps1=.15; @Value of the trimming (in percentage) for the construction
and critical values of the supF ype tests (used in the
supF test, the Dmax, the supF(l+1|l) and the sequential
procedure). if these test are used, h below should be set
at int(eps1*bigt). But if the tests are not required, estimation
can be done with an arbitrary h.
There are five options: eps1 = .05, .10, .15, .20 or .25.
for each option, the maximal value of m above is: 10 for eps1 = .05;
8 for eps1 = .10, 5 for eps1 = .15, 3 for eps1 = .20 and 2 for eps1 = .25.@
h=int(eps1*bigt); @minimal length of a segment (h >= q). Note: if
robust=1, h should be set at a larger value.@
/* the following are options if p > 0.
----------------------------------- */
fixb=0; @set to 1 if use fixed initial values for beta@
betaini=0; @if fixb=1, load the initial value of beta.@
maxi=20; @maximum number of iterations for the nonlinear
procedure to obtain global minimizers.@
printd=1; @set to 1 if want the output from the iterations
to be printed.@
eps=0.0001; @criterion for the convergence.@
/*--------------------------------- */

robust=0; @set to 1 if want to allow for heterogeneity
and autocorrelation the in residuals, 0 otherwise.
The method used is Andrews(1991) automatic
bandwidth with AR(1) approximation and the
quadratic quernel. Note: Do not set to 1 if
lagged dependent variables are included as
regressors.@
prewhit=0; @set to 1 if want to apply AR(1) prewhitening
prior to estimating the long run covariance
matrix@
hetdat=1; @Option for the construction of the F-tests.
Set to 1 if want to allow different moment matrices of the
regressors accross segments. if hetdat = 0, the same
moment matrices are assumed for each segment and estimated
from the full sample. It is recommended to set hetdat=1. if p > 0
set hetdat = 1.@
hetvar=1; @Option for the construction of the F-tests.
Set to 1 if want to allow for the variance of the residuals
to be different across segments. if hetvar=0, the variance
of the residuals is assumed constant across segments
and constructed from the full sample. This option is not available
when robust = 1.@
hetomega=1; @Used in the construction of the confidence
intervals for the break dates. if hetomega=0,
the long run covariance matrix of zu is assumed
identical accross segments (the variance of the
errors u if robust = 0).@
hetq=1; @Used in the construction of the confidence
intervals for the break dates. if hetq=0,
the moment matrix of the data is assumed
identical accross segments.@
doglobal=1; @set to 1 if want to call the procedure
to obtain global minimizers.@
dotest=1; @set to 1 if want to construct the sup F,
UDmax and WDmax tests. doglobal must be set
to 1 to run this procedure.@
dospflp1=1; @set to 1 if want to construct the sup(l+1|l)
tests where under the null the l breaks are
obtained using global minimizers. doglobal
must be set to 1 to run this procedure.@
doorder=1; @set to 1 if want to call the procedure that
selects the number of breaks using information
criteria. doglobal must be set to 1 to run
this procedure.@
dosequa=1; @set to 1 if want to estimate the breaks
sequentially and estimate the number of
breaks using the supF(l+1|l) test.@
dorepart=1; @set to 1 if want to modify the
break dates obtained from the sequential
method using the repartition method of
Bai (1995), Estimating breaks one at a time.
This is needed for the confidence intervals
obtained with estim below to be valid.@
estimbic=1; @set to 1 if want to estimate the model with
the number of breaks selected by BIC.@
estimlwz=0; @set to 1 if want to estimate the model with
the number of breaks selected by LWZ.@
estimseq=0; @set to 1 if want to estimate the model with
the number of breaks selected using the
sequential procedure.@
estimrep=0; @set to 1 if want to esimate the model with
the breaks selected using the repartition
method.@
estimfix=0; @set to 1 if want to estimate the model with
a prespecified number of breaks equal to fixn
set below.@
fixn=0;

/*****************************************************************************/
/*****************************************************************************/

if model == 3;
z=ones(bigt,1); @ Matrix conformeb by the elements that are allowed to change @
q=cols(z); @ Number of regressors z @
x=0;
p=0;
elseif model == 4;
z=ones(bigt,1)~seqa(1,1,bigt); @ Matrix conformeb by the elements that are allowed to change @
q=cols(z); @ Number of regressors z @
x=0;
p=0;
endif;

@ Matrices of results @
numkpss=zeros(k,1);
denkpss=zeros(k,1);
m_lee_est=zeros(k,4);
m_tb=zeros(1,m);
m_tb2=zeros(1,m);

m_deter=zeros(bigt,k);

j=1;
do until j>k;

{datevec,nbreak,mbic,mlwz,supfl,dateseq,ftest,wftest,reparv}=pbreak(bigt,data[.,j],z,q,m,h,eps1,robust,prewhit,hetomega,
hetq,doglobal,dotest,dospflp1,doorder,dosequa,dorepart,estimbic,estimlwz,
estimseq,estimrep,estimfix,fixb,x,q,eps,maxi,fixb,betaini,printd,hetdat,hetvar,fixn);

nbr=nbreak[2]; @ Numero de canvis detectats pel procediment sequencial al 5% de significacio @

/*nbr=mbic;*/

nbr=mlwz;

if nbr > 0;
tb=selif(datevec[.,nbr],datevec[.,nbr] .gt 0);
{kpsstest,num,den} = pankpss(data[.,j],tb,model,kernel);

deter=dekpss(model,bigt,tb);
beta=data[.,j]/deter;
m_deter[.,j] =deter*beta;

elseif nbr == 0;
{kpsstest,num,den} = pankpss(data[.,j],0,model0,kernel);

z=dekpss(model0,bigt,0);
beta=data[.,j]/z;
m_deter[.,j] =z*beta;

endif;

numkpss[j]=num;
denkpss[j]=den;
m_lee_est[j,.]=kpsstest~nbr~mbic~mlwz;

m_tb=m_tb|datevec;
m_tb2=m_tb2|reparv;

j=j+1;
endo;

test_hom=meanc(numkpss)./meanc(denkpss); @ Assuming homogeneous long-run variance @
test_het=meanc(m_lee_est[.,1]); @ Assuming heterogeneous long-run variance @

m_tb=m_tb[2:rows(m_tb),.];

test_mean=zeros(k,1);
test_var=zeros(k,1);

j=1;
do until j>k;
if m_lee_est[j,2] > 0;
temp1=m_tb[(j*m)-m+1:(j*m),.];
temp2=calcdem(model,temp1[.,m_lee_est[j,2]],bigt); @ Computes the mean and variance @
test_mean[j]=temp2[1];
test_var[j]=temp2[2];
elseif m_lee_est[j,2] == 0;
temp2=calcdem(model0,0,bigt); @ Computes the mean and variance @
test_mean[j]=temp2[1];
test_var[j]=temp2[2];
endif;
j=j+1;
endo;

test_mean=meanc(test_mean);
test_var=meanc(test_var);

testd_hom=sqrt(k)*(test_hom-test_mean)./sqrt(test_var);
testd_het=sqrt(k)*(test_het-test_mean)./sqrt(test_var);

print "************************************";
print "Results for the PANKPSS test ";
print "************************************";

print "Stationarity test with structural breaks (homogeneous): " testd_hom "with p-val: " cdfnc(testd_hom);
print "Stationarity test with structural breaks (heterogeneous): " testd_het "with p-val: " cdfnc(testd_het);

print "Nombre de breaks permesos com a maxim" m;
print "Matriu de tests individuals" m_lee_est;
print "Nombre d'observacions" rows(data);
print "Punts de trencament estimats" m_tb;

@++++++++++++@
@ Bootstrap @
@++++++++++++@

n=cols(data);
t=rows(data);
m_res=zeros(t,n); @ Matriu per deixar els residus @

i=1;
do until i>n; @ Residuals @
m_res[.,i]=data[.,i]-m_deter[.,i];
i=i+1;
endo;

re=2000; @ Nombre de rèpliques del Bootstrap @
m_kpss_hom=zeros(re,1);
m_kpss_het=zeros(re,1);
m_had_test=zeros(n,3);

j=1;
do while j<=re;
tt=rows(m_res);
m_resb=zeros(t+30,n);

i=1;
do while in;
yb[.,i]=m_deter[.,i]+m_resb[.,i];
i=i+1;
endo;

i=1;
do until i>n;

temp1=m_tb[(i*m)-m+1:(i*m),.]; @ Matrix of Breaks @
dd_tb=temp1[.,m_lee_est[i,2]];

if nbr > 0;
dd_tb=selif(dd_tb,dd_tb .gt 0);
{kpsstest,num,den} = pankpss(yb[.,i],dd_tb,model,kernel);
elseif nbr == 0;
{kpsstest,num,den} = pankpss(yb[.,i],0,model0,kernel);
endif;

numkpss[i]=num;
denkpss[i]=den;
m_lee_est[i,.]=kpsstest~nbr~mbic~mlwz;

i=i+1;
endo;

test_hom=meanc(numkpss)./meanc(denkpss); @ Assuming homogeneous long-run variance @
test_het=meanc(m_lee_est[.,1]); @ Assuming heterogeneous long-run variance @

m_kpss_hom[j,.]=sqrt(n)*(test_hom-test_mean)./sqrt(test_var);
m_kpss_het[j,.]=sqrt(n)*(test_het-test_mean)./sqrt(test_var);

j=j+1;
endo;

e=0.01|0.025|0.05|0.1|0.9|0.95|0.975|0.99;

print "Homogeneous";
q=quantile(m_kpss_hom,e);
e~q;

print "Heterogeneous";
q=quantile(m_kpss_het,e);
e~q;

/****************************************/
/****************************************/

#include c:\josepll\articles\mariam\breaks\brcode2.src;
#include granada.src;

Reference :
Carrion-i-Silvestre, J. L., Barrio-Castro, T. D. and Lopez-Bazo, E. (2005). Breaking the panels: an application to the GDP per capita, Econometrics Journal, 8, 159–75.
yours faithfully

11 Answers



0



Could you post a link to where you downloaded the code?

aptech

1,338


0



the code is sent to me by Carrion-i-Silvestre via e-mail. could you give me your mail and i will send to you the code. thank you so much for your help. i really need to perform this unit root test.
yours faithfully



0



Could you sent me Carrion-i-Silvestre via my email ngothucngan@gmail.com. Thank you.

 



0



Could you send me Carrion-i-Silvestre et al 2005 code via my email: ngothucngan@gmail.com



0



Could you send me Carrion-i-Silvestre code via email?

rmoraleslag @ gmail.com



0



Could you please send me the code for Carrion-i-Silvestre et al. (2005) as well? Thanks!

arthur.corazza@gmail.com



0



Could you please send me the code for Carrion-i-Silvestre et al. (2005) ? thanks

caiyf736@nenu.edu.cn



0



Could you please send me the code for Carrion-i-Silvestre et al. (2005) ? thanks

orcunaydin@gmail.com



0



Could you please send me the code for Carrion-i-Silvestre et al. (2005) ? thanks

wasif.zafar6@yahoo.com



0



Could you sent me Carrion-i-Silvestre via my email i.cagdas.ozdemir@gmail.com. Thank you.



0



Please note that the raw GAUSS codes for a number of Carrion-i-Silvestre's papers can be found on Carrion-i-Silvestre's webpage.

In addition, a number of Carrion-i-Silvestre's codes have be compiled and are provided in the Aptech open source library, carrionlib. These can be accessed on the Aptech Github page.

The carrionlib compiles the Carrion-i-Silvestre codes into a single library. This allows you to directly access the functions in the library in your own program files. In addition, the library modifies the raw codes to make it easier to set function parameters.

Erica

60

Your Answer


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 30 days for FREE

See what GAUSS can do for your data

© Aptech Systems, Inc. All rights reserved.

Privacy Policy