SURADF Panel Unit Root

Questions related to panel (pooled cross-section time series) data.
unforgiven02
Posts: 8
Joined: Sat May 16, 2009 1:26 pm

SURADF Panel Unit Root

Unread post by unforgiven02 »

Hi all,

I would like to implement Breuer, J.B., R. McNown and M.S. Wallace (2002) SURADF panel unit root test for a sample of current accounts of emerging markets. I have Rats codes and have changed the original codes to suit my data. However, I have faced two problem in implementing the method, one of them is the selection of lag length. I can overcome but it takes long effort and time. Is there any automatic selection procedures for lag length of SURADF regressions? And the other and important one, although the code works with original data of article, it doesn't work with my data, Rats gives an error when simulation is proceeding to obtain the critical values : "## REG13. Singular Regressions - Check for Collinearity among Rows 1 to 42. The Error Occurred At Location 1302 of loop/block Line 52 of loop/block", how i could fix this problem?
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: SURADF Panel Unit Root

Unread post by TomDoan »

Is it possible that you have a large value of N (say 42 or more)? The SUR estimators for panel data require small N large T in order to work (at all).
unforgiven02
Posts: 8
Joined: Sat May 16, 2009 1:26 pm

Re: SURADF Panel Unit Root

Unread post by unforgiven02 »

Dear Tom Doan,

Actually, i have 13 of N and 56 of T. I can post the data and the codes here, the problem occurs when the ciritical values are obtained in the bootstrapping procedure.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: SURADF Panel Unit Root

Unread post by TomDoan »

unforgiven02 wrote:Dear Tom Doan,

Actually, i have 13 of N and 56 of T. I can post the data and the codes here, the problem occurs when the ciritical values are obtained in the bootstrapping procedure.
If you could, that would be helpful.
unforgiven02
Posts: 8
Joined: Sat May 16, 2009 1:26 pm

Re: SURADF Panel Unit Root

Unread post by unforgiven02 »

Code: Select all

ALLOCATE 56
OPEN DATA c:\veri_13.xls
DATA(FORMAT=xls,ORG=obs) / Brazil	Chile	Colombia	Czech	Hungary	Indonesia	Korea	Mexico	Peru	Philippines	Russian SouthAfrica	Turkey $
 

diff brazil / dbrazil
diff chile / dchile
diff colombia / dcolombia
diff czech / dczech
diff hungary / dhungary
diff indonesia / dindonesia
diff korea / dkorea
diff mexico / dmexico
diff Peru / dPeru
diff philippines / dphilippines
diff russian / drussian
diff SouthAfrica / dSouthAfrica
diff turkey / dturkey

EQUATION  model1  dbrazil
# CONSTANT  brazil{1} dbrazil{1} dbrazil{2} dbrazil{3} dbrazil{4} dbrazil{5} dbrazil{6} dbrazil{7} dbrazil{8} dbrazil{9} dbrazil{10} 
EQUATION  model2  dchile
# CONSTANT  chile{1} dchile{1} dchile{2} dchile{3} dchile{4} dchile{5} dchile{6} dchile{7}
EQUATION  model3  dcolombia
# CONSTANT  colombia{1} dcolombia{1} dcolombia{2} dcolombia{3} dcolombia{4} dcolombia{5} dcolombia{6} dcolombia{7} dcolombia{8} 
EQUATION  model4  dczech
# CONSTANT  czech{1} dczech{1} dczech{2} dczech{3} dczech{4} 
EQUATION  model5  dhungary
# CONSTANT  hungary{1} dhungary{1} dhungary{2} dhungary{3} 
EQUATION  model6  dindonesia
# CONSTANT  indonesia{1} dindonesia{1}
EQUATION  model7  dkorea
# CONSTANT  korea{1} dkorea{1} dkorea{2} dkorea{3} dkorea{4} dkorea{5} dkorea{6} dkorea{7} dkorea{8} 
EQUATION  model8  dmexico
# CONSTANT  mexico{1} dmexico{1} dmexico{2} dmexico{3} dmexico{4} dmexico{5} dmexico{6} dmexico{7} 
EQUATION  model9  dPeru
# CONSTANT  Peru{1} dPeru{1} dperu{2} dperu{3} dperu{4}
EQUATION  model10  dphilippines
# CONSTANT  philippines{1} dphilippines{1} dphilippines{2} dphilippines{3}  
EQUATION  model11  drussian
# CONSTANT  russian{1} drussian{1} drussian{2} drussian{3} drussian{4} drussian{5} drussian{6} drussian{7} drussian{8} 
EQUATION  model12  dSouthAfrica
# CONSTANT  SouthAfrica{1} dSouthAfrica{1} dSouthAfrica{2} dSouthAfrica{3} dSouthAfrica{4} dSouthAfrica{5} dSouthAfrica{6} dSouthAfrica{7} 
EQUATION  model13  dturkey
# CONSTANT  turkey{1} dturkey{1} dturkey{2} dturkey{3} dturkey{4} dturkey{5} dturkey{6} dturkey{7} 


SUR(outsigma=sig) 13
# model1 e1
# model2 e2
# model3 e3
# model4 e4
# model5 e5
# model6 e6
# model7 e7
# model8 e8
# model9 e9
# model10 e10
# model11 e11
# model12 e12
# model13 e13

*
* input simulation parameters:
*enter number of replications
compute nr=10000
* enter number of countries
compute nc=13
* enter number of time periods in estimation
compute tp=56
* enter number of observations to discard
compute td=5
declare index plgs(nc) plgsl1(nc) plgs1(nc) mats1(nc)
* enter maximum lag in levels representation
* (maximum number of lagged differences plus 1)
compute plgsmax= 4
* number of lags in levels representation=number of lagged differences plus 1
* enter one integer number for each country
* every enty must be at least 2
input plgs
10 7 8 4 3 1 8 7 4 3 8 13 7
compute nc2=nc*2
compute tpd=tp+td
compute plgsmxl1=plgsmax-1
*
all nc2 41
declare vec mu(nc) delta(nc)
declare rec gam(nc,plgsmxl1) y(tpd,nc) yd(tpd,nc)
declare symm sig(nc,nc)
* enter a line of 1's equal in number to the number of countries
input mats1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
* input equation parameters
* enter intercepts
read(unit=input) mu
-0.002035591  0.004379252  -0.010729393 -0.013102120 -0.013145801 0.014322494 0.008055186 0.000016877 -0.000922164 0.004000961 0.056557582 -0.000307428 -0.005929661


* enter coefficients on lagged level (0.0 for unit root case)
read(unit=input) delta
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
* enter coefficients on lagged differences,
* one line for each equation with zeros for omitted lags
read(unit=input) gam

-0.1729670	0.2079762	0.0581387	0.3400962	-0.1814283	-0.2425286	-0.0694597	0.4051570	0.4046196	0.2579492	0.0000000	0.0000000	0.0000000
-0.1190081	-0.1418250	-0.1478671	0.2024690	0.0187486	-0.5262545	-0.1077329	0.0000000	0.0000000	0.0000000	0.0000000	0.0000000	0.0000000
0.3104065		0.2393490	0.1779318	0.3231367	0.1900334	0.2699374	0.1534652	0.2747899	0.0000000	0.0000000	0.0000000	0.0000000
-0.3014910	-0.3526909	-0.3122419	0.3952557	0.0000000	0.0000000	0.0000000	0.0000000	0.0000000	0.0000000	0.0000000	0.0000000	0.0000000
-0.2394407	-0.2366822	-0.3911858	0.0000000	0.0000000	0.0000000	0.0000000	0.0000000	0.0000000	0.0000000	0.0000000	0.0000000	0.0000000
-0.2008891	0.0000000	0.0000000	0.0000000	0.0000000	0.0000000	0.0000000	0.0000000	0.0000000	0.0000000	0.0000000	0.0000000	0.0000000
-0.0305188	-0.0015856	-0.0373848	0.0634611	0.0125941	0.1640198	0.0419195	0.0326614	0.0000000	0.0000000	0.0000000	0.0000000	0.0000000
-0.4526412		-0.6549183	-0.2252921	0.0668727	-0.1505400	0.0495354	-0.2711515	0.0000000	0.0000000	0.0000000	0.0000000	0.0000000
-0.0187454	-0.1428791	-0.1077346	0.2873004	0.0000000	0.0000000	0.0000000	0.0000000	0.0000000	0.0000000	0.0000000	0.0000000	0.0000000
-0.1032679	-0.4744338	-0.0796119	0.0000000	0.0000000	0.0000000	0.0000000	0.0000000	0.0000000	0.0000000	0.0000000	0.0000000	0.0000000
-0.5984638	0.0000000	0.0000000	0.0000000	0.0000000	0.0000000	0.0000000	0.0000000	0.0000000	0.0000000	0.0000000	0.0000000	0.0000000
-0.5284540	-0.3111757	-0.0047189	0.5474602	0.6268022	0.1654141	0.2771352	0.0000000	0.0000000	0.0000000	0.0000000	0.0000000	0.0000000
-0.0074863	-0.3310685	0.0146501	0.2536754	-0.3679807	-0.0428432	-0.5417989	0.0000000	0.0000000	0.0000000	0.0000000	0.0000000	0.0000000

* enter error covariance matrix as lower triangular array
read(unit=input) sig
7.0518E-05												
6.23092E-05	0.000460849											
3.06783E-05	7.44847E-05	0.000105095										
-0.000051183	-6.1112E-07	-4.28748E-05	0.000421023									
-1.77703E-05	7.84065E-05	2.227E-05	5.77618E-05	0.000467256								
2.35066E-06	7.30905E-05	6.83596E-05	-0.000127598	1.67409E-06	0.000283743							
1.45349E-05	3.07946E-05	-6.34556E-06	-0.000186989	5.85727E-05	-1.1202E-05	0.000270065						
3.43628E-06	1.07306E-05	7.50459E-06	-2.5214E-06	1.32832E-05	3.08518E-06	2.5337E-06	2.43116E-06					
4.79731E-05	0.000140007	3.81953E-05	-3.77228E-05	0.000109441	1.90121E-06	8.90412E-05	5.15013E-06	0.000245656				
7.4492E-07	6.90622E-05	-5.22928E-05	-7.16177E-05	-1.13232E-05	-3.86954E-05	0.000173588	-7.037E-07	2.0195E-05	0.000773021			
-5.64988E-05	-4.13569E-05	2.93928E-05	2.49821E-05	-0.00013705	6.96682E-05	-0.000175486	1.29562E-06	-0.000126424	-0.000139449	0.000540374		
-2.0695E-06	-7.09247E-06	-0.000012966	1.94192E-05	5.04111E-06	-4.40543E-06	1.62026E-06	-9.525E-07	-1.02214E-06	-1.33937E-05	-1.12865E-05	1.08042E-05	
3.48722E-05	-1.05954E-05	5.67795E-06	-4.30992E-05	2.60429E-05	1.10287E-05	6.14404E-06	-3.50809E-06	6.9381E-05	-0.000126287	-3.55839E-06	7.9584E-06	0.000277113



* end of data input
write 'intercepts' mu
write 'coefficients on lagged level' delta
write 'coefficients on lagged differences' gam
* write 'error covariance matrix' sig
*
compute begob=1
compute endob=begob+tpd
declare index cumplg(nc)
declare vec et(nc) ut(nc)
declare rect y(tpd,nc) yd(tpd,nc)
declare rect adft(1,nc) surt(1,nc)
* compute cumplg as number of coefficients previously estimated
do i=1,nc
     if i.eq.1
     compute [integer] cumplg(i)=0
     else
     compute [integer] cumplg(i)=cumplg(i-1)+plgs(i-1)+1
end do
compute [integer] splg=cumplg(nc)+plgs(nc)+1
dec rect rmadf(nc,splg)
compute rmadf=%const(0.0)
do i=1,nc
     compute [integer] ic=cumplg(i)+1
     compute rmadf(i,ic)=1.0
end do
open copy=c:\adftst.dat
open copy=c:\surtst.dat
open copy=c:\madftst.dat
*
* begin replication loop
do ir=1,nr
smpl begob endob
* initialize
do it=1,plgsmax
do i=1,nc
     compute yd(it,i)=0.0
     compute y(it,i)=0.0
end do
end do
*
do it=plgsmax,tpd
* generate data
     compute ut=%ran(1.0)
     compute et=%decomp(sig)*ut
     do i=1,nc
       compute yd(it,i)=mu(i)+delta(i)*y(it-1,i)+et(i)
       compute [integer] plgsl1i=plgs(i)-1
       do j=1,plgsl1i
         compute yd(it,i)=yd(it,i)+gam(i,j)*yd(it-j,i)
       end do
       compute y(it,i)=y(it-1,i)+yd(it,i)
     end do
end do
*
*write et yd y


* create numbered series: 1-nc=yd's; nc+1-2nc=y's
do i=1,nc
     set i 1 tpd = yd(t,i)
     set i+nc 1 tpd = y(t,i)
end do
*print
* estimation: ols
smpl begob+td endob-1
do i=1,nc
     compute [integer] plgsl1i=plgs(i)-1
     linreg(noprint,define=i) i / resols cfols
     # i+nc{1} i{1 to plgsl1i} constant
     exclude(noprint)
     # i+nc{1}
     compute adft(1,i)=sqrt(%cdstat)
     if cfols(1).lt.0.0
        compute adft(1,i)=0.0-adft(1,i)
end do
write(noskip,unit=adftst.dat) adft
*
* sur estimation
list ieq = 1 to nc
sur(noprint,nosigma,isigma=sig) nc
*sur(nosigma) nc
cards ieq * nc2+ieq
*cards ieq
do i=1,nc
     exclude(noprint)
     # i+nc{1}
     compute surt(1,i)=sqrt(%cdstat)
     compute [integer] ic=cumplg(i)+1
      if %beta(ic).lt.0.0
        compute surt(1,i)=0.0-surt(1,i)
end do
write(noskip,unit=surtst.dat)  surt
* MADF test
mrestrict(noprint) nc rmadf
write(noskip,unit=madftst.dat)  %cdstat
* end of replication loop
end do
*
close adftst.dat
close surtst.dat
close madftst.dat
*
all nc nr
* specify name of file containing ADF test statistics
open data c:\adftst.dat
data(org=obs) 1 nr 1 to nc
* This reads nr obs on numbered variables, each variable
* being a t-stat for one country
display 'ADF Test Statistics'
do i=1,nc
statistics(fractiles) i
end do
*
clear all
* specify name of file containing SUR test statistics
open data c:\surtst.dat
data(org=obs) 1 nr 1 to nc
display 'SUR Test Statistics'
do i=1,nc
statistics(fractiles) i
end do
*
clear all
* specify name of file containing MADF test statistics
open data c:\madftst.dat
data(org=obs) 1 nr madfstat
display 'MADF Test Statistics'
statistics(fractiles) madfstat
*



[quote][/quote]
Attachments
veri_13.xls
(31 KiB) Downloaded 1233 times
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: SURADF Panel Unit Root

Unread post by TomDoan »

The dimensions on your GAM matrix are way off. Your DECLARE instruction requests 13 x 3, but your READ instruction has maybe five times that number of entries.
unforgiven02
Posts: 8
Joined: Sat May 16, 2009 1:26 pm

Re: SURADF Panel Unit Root

Unread post by unforgiven02 »

Thanks for your reply, i faced an error obtaining the critical values: "## REG13. Singular Regressions - Check for Collinearity among Rows 1 to 42. The Error Occurred At Location 1302 of loop/block Line 52 of loop/block", how i could fix this problem?

Code: Select all

* input simulation parameters:
*enter number of replications
compute nr=10000
* enter number of countries
compute nc=10
* enter number of time periods in estimation
compute tp=40
* enter number of observations to discard
compute td=5
declare index plgs(nc) plgsl1(nc) plgs1(nc) mats1(nc)
* enter maximum lag in levels representation
* (maximum number of lagged differences plus 1)
compute plgsmax= 10
* number of lags in levels representation=number of lagged differences plus 1
* enter one integer number for each country
* every enty must be at least 2
input plgs
7 9 5 4 9 10 5 6 5 8
compute nc2=nc*4
compute tpd=tp+td
compute plgsmxl1=plgsmax-1
*
all nc2 45
declare vec mu(nc) delta(nc)
declare rec gam(nc,plgsmxl1) y(tpd,nc) yd(tpd,nc)
declare symm sig(nc,nc)
* enter a line of 1's equal in number to the number of countries
input mats1
1 1 1 1 1 1 1 1 1 1
* input equation parameters
* enter intercepts
read(unit=input) mu
0 0 0 0 0 0 0 0 0 0
* enter coefficients on lagged level (0.0 for unit root case)
read(unit=input) delta
0 0 0 0 0 0 0 0 0 0
* enter coefficients on lagged differences,
* one line for each equation with zeros for omitted lags
read(unit=input) gam
0.080469499	-0.115183359	-0.108929184	0.248393932	0.142225679	-0.43478759	0	0	0
-0.251807041	-0.317265877	-0.420489762	-0.094496783	-0.096183719	0.192315364	0.16803858	0.365627907	0
-0.422128583	-0.455971375	-0.366111577	0.405062411	0	0	0	0	0
-0.28459096	-0.052343211	-0.403405417	0	0	0	0	0	0
0.585824801	0.766651151	0.577895109	0.659108895	0.588329181	0.550567296	0.38135967	0.492317274	0
-0.481885381	-0.676129573	-0.688162856	-0.131315531	-0.785083765	-0.170147768	0.003907944	0.013014223	0.52201985
0.322099809	0.246073985	-0.238459183	0.355711167	0	0	0	0	0
-0.365089203	-0.537739269	-0.422818245	-0.156613972	-0.229387931	0	0	0	0
0.068839397	-0.07570741	0.054604313	0.424474717	0	0	0	0	0
-0.116325807	-0.302523115	-0.033965878	0.672948375	0.003204633	0.24353217	-0.159679828	0	0


* enter error covariance matrix as lower triangular array
read(unit=input) sig
0.000518101
7.13497E-05	8.8912E-05
-6.50569E-05	-1.62733E-05	0.000547443
0.000124218	3.89731E-05	3.96838E-05	0.000428446
0.000145694	1.31673E-05	-0.000246453	8.15482E-05	0.000312405
-5.71631E-06	6.33491E-05	-9.38103E-05	5.47802E-05	9.03336E-05	0.000311537
7.23755E-05	4.92234E-05	5.10453E-06	9.30314E-05	4.84828E-05	4.25588E-05	0.000111661
0.000199699	-5.43187E-05	-0.000180488	-9.44098E-06	0.000238441	-0.00012802	-8.28772E-06	0.000446258
0.000130293	2.77292E-05	-8.84987E-05	0.000170812	0.00015466	0.000151071	7.71339E-05	6.19709E-05	0.000285775
-3.83562E-05	1.95942E-05	-4.40781E-05	5.25979E-05	5.93834E-05	9.8057E-05	2.29565E-05	8.17969E-06	6.22559E-05	0.000135023

* end of data input
write 'intercepts' mu
write 'coefficients on lagged level' delta
write 'coefficients on lagged differences' gam
* write 'error covariance matrix' sig
*
compute begob=1
compute endob=begob+tpd
declare index cumplg(nc)
declare vec et(nc) ut(nc)
declare rect y(tpd,nc) yd(tpd,nc)
declare rect adft(1,nc) surt(1,nc)
* compute cumplg as number of coefficients previously estimated
do i=1,nc
     if i.eq.1
     compute [integer] cumplg(i)=0
     else
     compute [integer] cumplg(i)=cumplg(i-1)+plgs(i-1)+1
end do
compute [integer] splg=cumplg(nc)+plgs(nc)+1
dec rect rmadf(nc,splg)
compute rmadf=%const(0.0)
do i=1,nc
     compute [integer] ic=cumplg(i)+1
     compute rmadf(i,ic)=1.0
end do
open copy=c:\adftst.dat
open copy=c:\surtst.dat
open copy=c:\madftst.dat
*
* begin replication loop
do ir=1,nr
smpl begob endob
* initialize
do it=1,plgsmax
do i=1,nc
     compute yd(it,i)=0.0
     compute y(it,i)=0.0
end do
end do
*
do it=plgsmax,tpd
* generate data
     compute ut=%ran(1.0)
     compute et=%decomp(sig)*ut
     do i=1,nc
       compute yd(it,i)=mu(i)+delta(i)*y(it-1,i)+et(i)
       compute [integer] plgsl1i=plgs(i)-1
       do j=1,plgsl1i
         compute yd(it,i)=yd(it,i)+gam(i,j)*yd(it-j,i)
       end do
       compute y(it,i)=y(it-1,i)+yd(it,i)
     end do
end do
*
*write et yd y


* create numbered series: 1-nc=yd's; nc+1-2nc=y's
do i=1,nc
     set i 1 tpd = yd(t,i)
     set i+nc 1 tpd = y(t,i)
end do
*print
* estimation: ols
smpl begob+td endob-1
do i=1,nc
     compute [integer] plgsl1i=plgs(i)-1
     linreg(noprint,define=i) i / resols cfols
     # i+nc{1} i{1 to plgsl1i} constant
     exclude(noprint)
     # i+nc{1}
     compute adft(1,i)=sqrt(%cdstat)
     if cfols(1).lt.0.0
        compute adft(1,i)=0.0-adft(1,i)
end do
write(noskip,unit=adftst.dat) adft
*
* sur estimation
list ieq = 1 to nc
sur(noprint,nosigma,isigma=sig) nc
*sur(nosigma) nc
cards ieq * nc2+ieq
*cards ieq
do i=1,nc
     exclude(noprint)
     # i+nc{1}
     compute surt(1,i)=sqrt(%cdstat)
     compute [integer] ic=cumplg(i)+1
      if %beta(ic).lt.0.0
        compute surt(1,i)=0.0-surt(1,i)
end do
write(noskip,unit=surtst.dat)  surt
* MADF test
mrestrict(noprint) nc rmadf
write(noskip,unit=madftst.dat)  %cdstat
* end of replication loop
end do
*
close adftst.dat
close surtst.dat
close madftst.dat
*
all nc nr
* specify name of file containing ADF test statistics
open data c:\adftst.dat
data(org=obs) 1 nr 1 to nc
* This reads nr obs on numbered variables, each variable
* being a t-stat for one country
display 'ADF Test Statistics'
do i=1,nc
statistics(fractiles) i
end do
*
clear all
* specify name of file containing SUR test statistics
open data c:\surtst.dat
data(org=obs) 1 nr 1 to nc
display 'SUR Test Statistics'
do i=1,nc
statistics(fractiles) i
end do
*
clear all
* specify name of file containing MADF test statistics
open data c:\madftst.dat
data(org=obs) 1 nr madfstat
display 'MADF Test Statistics'
statistics(fractiles) madfstat
*

end do







TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: SURADF Panel Unit Root

Unread post by TomDoan »

There's something wrong with your generated data. The generated HUNGARY series, for instance, is so explosive that you can't even run a linear regression on it successfully. There's likely a misalignment of the coefficients with the equations in your simulations so what should be lagged dependent variables are actually cross terms.
nacrointfin
Posts: 11
Joined: Fri Sep 14, 2007 2:43 am

Re: SURADF Panel Unit Root

Unread post by nacrointfin »

Hi Tom

Is it possible to add SURADF procedure file for rats user?

Regards,

Terence
ege_man
Posts: 85
Joined: Sat Jul 07, 2012 2:39 pm

Re: SURADF Panel Unit Root

Unread post by ege_man »

Dear Tom,
Is there any example about the implementation of panel SURADF test in any textbook examples?
I am using version 8.1
Regards
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: SURADF Panel Unit Root

Unread post by TomDoan »

ege_man wrote:Dear Tom,
Is there any example about the implementation of panel SURADF test in any textbook examples?
I am using version 8.1
Regards
No. It's not even mentioned in Baltagi, Greene or Wooldridge.
Post Reply