cointegrating nonlinear ARDL

If you are seeking RATS code for implementing a particular technique or replicating results from a paper, post your request here. Be sure to include complete citations for any papers or books.

cointegrating nonlinear ARDL

Unread postby Ozmando » Wed Jul 18, 2012 4:57 am

Hi All,

I am looking for RATS code to estimate a cointegrating nonlinear ARDL as in the paper by Shin, Y., Yu, B. and Greenwood-Nimmo, M.J. (2012, April). "Modelling Asymmetric Cointegration and Dynamic Multipliers in a Nonlinear ARDL Framework" which can be found at this link: http://www.greenwoodeconomics.com/workingpapers.html.

There is a gauss code in the link.

Thanks in advance for your help.
Oz
Ozmando
 
Posts: 42
Joined: Sun Jul 15, 2012 4:04 pm

Re: cointegrating nonlinear ARDL

Unread postby TomDoan » Wed Jul 18, 2012 1:48 pm

There's nothing particularly difficult about that - it's LINREG's with a search over the threshold value. However, if there is any Gauss code on that link, I don't see it.
TomDoan
 
Posts: 7147
Joined: Wed Nov 01, 2006 5:36 pm

Re: cointegrating nonlinear ARDL

Unread postby hlchan » Tue Aug 28, 2012 2:42 am

Dear Tom,

Here is the guass code
http://www.greenwoodeconomics.com/ardlmc.g
hlchan
 
Posts: 27
Joined: Thu Aug 27, 2009 7:32 pm

Re: cointegrating nonlinear ARDL

Unread postby Ozmando » Tue Aug 28, 2012 3:22 am

Hi Tom,

I have now managed to run the Gauss version of the code.
But I guess a RATS code will still be useful for RATS users.

Thanks,
Oz
Ozmando
 
Posts: 42
Joined: Sun Jul 15, 2012 4:04 pm

Re: cointegrating nonlinear ARDL

Unread postby TVolscho-286 » Thu Mar 13, 2014 11:21 am

Could some of the Enders-Siklos code be modified to pick thresholds from an ARDL? Has anyone tried this?
TVolscho-286
 
Posts: 25
Joined: Thu May 03, 2012 6:50 pm

Re: cointegrating nonlinear ARDL

Unread postby Ozmando » Tue Nov 21, 2017 2:42 pm

TVolscho-286 wrote:Could some of the Enders-Siklos code be modified to pick thresholds from an ARDL? Has anyone tried this?


This is the set of codes developed for eviews. Might be helpful to develop one for RATS?

Code: Select all
This provides guidance on how to run the code


Put all the files in one folder and data in excel file just like the one provided with codes. Then set the Step=1 and make the changes as per your data and run. It will make the work file from excel according to the settings provided below. Then set STEP=2 to run NARDL and to get multipliers.

!step=1  ‘set STEP=1 and Run after the work file is in E view then set STEP=2 to run the estimations
!multiplierlength = 16        The time period for which multiplier effect is required'Specifies the period in which the unit shock occurs. The shock occurs in the last period minus multiplier length
!bandwidth = 1.64      Do not change 'Sets the bandwidth for standard errors
!laglength = 1        ‘The number of lags to include as search parameters in the G2S regression
!tb=0                               Do not change '0=without brk and trend** 1=trend** 2=brk** 3=brk & trend
!sig=0.05                        ' level of significance for G2S
'***********************************************************
'************************ SETTINGS *************************
'*********************************************************** 
!s=3              '*** The scenario of NARDL; 1) IV=1 & nonlinear ************* 2). IVs=2, 1st=linear, 2nd=nonlinear ************* 3). IVs=2 & both non-linear ************* 4). IVs=3, 1st & 2nd=linear, 3rd=Non-linear ******5). IVs=3 all non-linear 
'***Workfile
  %datafile = "ARDLdata.xls"   'For the data file in the root directory
  %dependent = "lfp"   'Ensure the names match exactly with those imported from the excel file
  %independent1 = "ly"   'As above
  %independent2 = "lwti"
  %independent3 = "--"      
  %firstperiod = "1971"   'The first period of estimation
  %lastperiod = "2012"   'The last period of estimation
 
'***********************************************************
'************************ WORKFILE *************************
'***********************************************************
 if !step=1 then
'***Create workfile and set sample
 
  wfcreate(wf = workfile, page = yearly) y {%firstperiod} {%lastperiod}   'Can be set for daily, weekly, monthly, yearly
Ozmando
 
Posts: 42
Joined: Sun Jul 15, 2012 4:04 pm

Re: cointegrating nonlinear ARDL

Unread postby Ozmando » Tue Nov 21, 2017 2:45 pm

Ozmando wrote:
TVolscho-286 wrote:Could some of the Enders-Siklos code be modified to pick thresholds from an ARDL? Has anyone tried this?

Code: Select all
***Quiet mode
  mode quiet
'***Multiplier

!step=1                             ' To apprpriately run the NARDL first set STEP=1 and select the lag lenth after lag length selection set STEP=2 to run the estimations
!multiplierlength = 16        'Specifies the period in which the unit shock occurs. The shock occurs in the last period minus multiplier length
!bandwidth = 1.64      'Sets the bandwidth for standard errors
!laglength = 1                   'The number of lags to include as search parameters in the G2S regression
!tb=0                                '0=without brk and trend** 1=trend** 2=brk** 3=brk & trend
!sig=0.05                        ' level of significance for G2S
'***********************************************************
'************************ SETTINGS *************************
'*********************************************************** 
!s=3              '*** The scenario of NARDL; 1) IV=1 & nonlinear ************* 2). IVs=2, 1st=linear, 2nd=nonlinear ************* 3). IVs=2 & both non-linear ************* 4). IVs=3, 1st & 2nd=linear, 3rd=Non-linear ******5). IVs=3 all non-linear 
'***Workfile
  %datafile = "ARDLdata.xls"   'For the data file in the root directory
  %dependent = "lfp"   'Ensure the names match exactly with those imported from the excel file
  %independent1 = "ly"   'As above
  %independent2 = "lwti"
  %independent3 = "--"      
  %firstperiod = "1971"   'The first period of estimation
  %lastperiod = "2012"   'The last period of estimation
 
'***********************************************************
'************************ WORKFILE *************************
'***********************************************************
 if !step=1 then
'***Create workfile and set sample
 
  wfcreate(wf = workfile, page = yearly) y {%firstperiod} {%lastperiod}   'Can be set for daily, weekly, monthly, yearly
  import .\{%datafile}   'Imports datafile
'Gerenerate trend and break'
series tr=@trend()
'{%dependent}.buroot(dif=0,nograph,output=buoutput)
'!idate = buoutput(@imin(buoutput.@col(7)),1)
'string date = @otod(!idate+1)
'freeze(brk1) {%dependent}.buroot(dif=0, nograph)
'{%date}=brk1(6,1)
'series brk = @recode(@date>@dateval("{date}"), 1, 0)
'smpl %firstperiod {date}
'series brk=0
'smpl {date} %lastperiod
'brk=1
'smpl %firstperiod %lastperiod
'delete buoutput date
'Generate positive(negative) cummulative sums
if !s=1 then
GENR X={%independent1}
GENR DX=X-X(-1)
GENR POS=DX>=0
GENR DXPOS=POS*DX
GENR DXNEG=(1-POS)*DX
GENR XPOS=@CUMSUM(DXPOS)
GENR XNEG=@CUMSUM(DXNEG)
GENR {%independent1}_P=XPOS
GENR {%independent1}_N=XNEG
DELETE X DX POS DXPOS DXNEG XPOS XNEG
GENR D{%independent1}=D({%independent1})
GENR D{%independent1}_P=D({%independent1}_P)
GENR D{%independent1}_N=D({%independent1}_N)
else if !s=2 then
GENR D{%independent1}=D({%independent1})
GENR X={%independent2}
GENR DX=X-X(-1)
GENR POS=DX>=0
GENR DXPOS=POS*DX
GENR DXNEG=(1-POS)*DX
GENR XPOS=@CUMSUM(DXPOS)
GENR XNEG=@CUMSUM(DXNEG)
GENR {%independent2}_P=XPOS
GENR {%independent2}_N=XNEG
DELETE X DX POS DXPOS DXNEG XPOS XNEG
GENR D{%independent2}=D({%independent2})
GENR D{%independent2}_P=D({%independent2}_P)
GENR D{%independent2}_N=D({%independent2}_N)
else if !s=3 then
GENR X={%independent1}
GENR DX=X-X(-1)
GENR POS=DX>=0
GENR DXPOS=POS*DX
GENR DXNEG=(1-POS)*DX
GENR XPOS=@CUMSUM(DXPOS)
GENR XNEG=@CUMSUM(DXNEG)
GENR {%independent1}_P=XPOS
GENR {%independent1}_N=XNEG
DELETE X DX POS DXPOS DXNEG XPOS XNEG
GENR D{%independent1}=D({%independent1})
GENR D{%independent1}_P=D({%independent1}_P)
GENR D{%independent1}_N=D({%independent1}_N)
GENR X={%independent2}
GENR DX=X-X(-1)
GENR POS=DX>=0
GENR DXPOS=POS*DX
GENR DXNEG=(1-POS)*DX
GENR XPOS=@CUMSUM(DXPOS)
GENR XNEG=@CUMSUM(DXNEG)
GENR {%independent2}_P=XPOS
GENR {%independent2}_N=XNEG
DELETE X DX POS DXPOS DXNEG XPOS XNEG
GENR D{%independent2}=D({%independent2})
GENR D{%independent2}_P=D({%independent2}_P)
GENR D{%independent2}_N=D({%independent2}_N)
else if !s=4 then
GENR D{%independent1}=D({%independent1})
GENR D{%independent2}=D({%independent2})
GENR X={%independent3}
GENR DX=X-X(-1)
GENR POS=DX>=0
GENR DXPOS=POS*DX
GENR DXNEG=(1-POS)*DX
GENR XPOS=@CUMSUM(DXPOS)
GENR XNEG=@CUMSUM(DXNEG)
GENR {%independent3}_P=XPOS
GENR {%independent3}_N=XNEG
DELETE X DX POS DXPOS DXNEG XPOS XNEG
GENR D{%independent3}=D({%independent3})
GENR D{%independent3}_P=D({%independent3}_P)
GENR D{%independent3}_N=D({%independent3}_N)
else if !s=5 then
GENR X={%independent1}
GENR DX=X-X(-1)
GENR POS=DX>=0
GENR DXPOS=POS*DX
GENR DXNEG=(1-POS)*DX
GENR XPOS=@CUMSUM(DXPOS)
GENR XNEG=@CUMSUM(DXNEG)
GENR {%independent1}_P=XPOS
GENR {%independent1}_N=XNEG
DELETE X DX POS DXPOS DXNEG XPOS XNEG
GENR D{%independent1}=D({%independent1})
GENR D{%independent1}_P=D({%independent1}_P)
GENR D{%independent1}_N=D({%independent1}_N)
GENR X={%independent2}
GENR DX=X-X(-1)
GENR POS=DX>=0
GENR DXPOS=POS*DX
GENR DXNEG=(1-POS)*DX
GENR XPOS=@CUMSUM(DXPOS)
GENR XNEG=@CUMSUM(DXNEG)
GENR {%independent2}_P=XPOS
GENR {%independent2}_N=XNEG
DELETE X DX POS DXPOS DXNEG XPOS XNEG
GENR D{%independent2}=D({%independent2})
GENR D{%independent2}_P=D({%independent2}_P)
GENR D{%independent2}_N=D({%independent2}_N)
GENR X={%independent3}
GENR DX=X-X(-1)
GENR POS=DX>=0
GENR DXPOS=POS*DX
GENR DXNEG=(1-POS)*DX
GENR XPOS=@CUMSUM(DXPOS)
GENR XNEG=@CUMSUM(DXNEG)
GENR {%independent3}_P=XPOS
GENR {%independent3}_N=XNEG
DELETE X DX POS DXPOS DXNEG XPOS XNEG
GENR D{%independent3}=D({%independent3})
GENR D{%independent3}_P=D({%independent3}_P)
GENR D{%independent3}_N=D({%independent3}_N)
endif
endif
endif
endif
endif
'Generate first difference series
GENR D{%dependent}=D({%dependent})

else if !step=2 then
   
'***Include sub-procedures
if !tb=0 then
  include .\02_nardl
else if !tb=1 then
  include .\02_nardl1
else if !tb=2 then
  include .\02_nardl2
else if !tb=3 then
  include .\02_nardl3
endif
endif
endif
endif

  include .\03_mplier

'***Save workfile

  'wfsave(2) .\workfile.wf1

delete coefs_{%dependent} cov_{%dependent}
endif
endif

Ozmando
 
Posts: 42
Joined: Sun Jul 15, 2012 4:04 pm

Re: cointegrating nonlinear ARDL

Unread postby Ozmando » Tue Nov 21, 2017 2:46 pm

Ozmando wrote:
Ozmando wrote:
TVolscho-286 wrote:Could some of the Enders-Siklos code be modified to pick thresholds from an ARDL? Has anyone tried this?


Code: Select all
'***********************************************************
'******************** NARDL ESTIMATION *********************
'***********************************************************
'***Set sample period
  smpl %firstperiod %lastperiod
'***Define loop
if !s=1 then
  for %i {%dependent}
'****model      
    equation nardl_{%i}.stepls(method = uni, back, btol = !sig) d({%i}) c {%i}(-1) {%independent1}_p(-1) {%independent1}_n(-1) @ d{%i}(-1 to -{!laglength}) d{%independent1}_p(-0 to -{!laglength}) d{%independent1}_n(-0 to -{!laglength})     
      coef coefs_{%i} = c
'***Store results and conduct tests      
     sym cov_{%i} = nardl_{%i}.@coefcov
        scalar BDM_{%i} = c(2)/@stderrs(2)
        freeze(SerCorr_{%i}) nardl_{%i}.auto(12)
        freeze(HSked_{%i}) nardl_{%i}.hettest(type = White, c)
        freeze(Cusum_{%i}) nardl_{%i}.rls(v)   
   'store coeffecients
      freeze(LRW_{%independent1}) nardl_{%i}.wald -c(3)/c(2) = -c(4)/c(2)
      freeze(LR_{%independent1}_P) nardl_{%i}.wald -c(3)/c(2) = 0
      freeze(LRW_{%independent1}_N) nardl_{%i}.wald -c(4)/c(2) = 0
      freeze(PSS_{%i}) nardl_{%i}.wald c(2) = c(3) = c(4) = 0
   next   

else if !s=2 then 
  for %i {%dependent}
'****Model   
      equation nardl_{%i}.stepls(method = uni, back, btol = !sig) d({%i}) c  {%i}(-1) {%independent1}(-1)  {%independent2}_p(-1) {%independent2}_n(-1)  @ d{%i}(-1 to -{!laglength}) d{%independent1}(-0 to -{!laglength})  d{%independent2}_p(-0 to -{!laglength}) d{%independent2}_n(-0 to -{!laglength})    
     coef coefs_{%i} = c
'***Store results and conduct tests      
     sym cov_{%i} = nardl_{%i}.@coefcov
        scalar BDM_{%i} = c(2)/@stderrs(2)
        freeze(SerCorr_{%i}) nardl_{%i}.auto(12)
        freeze(HSked_{%i}) nardl_{%i}.hettest(type = White, c)
        freeze(Cusum_{%i}) nardl_{%i}.rls(v)   
   'store coeffecients
      freeze(LRW_{%independent2}) nardl_{%i}.wald -c(4)/c(2) = -c(5)/c(2)
         freeze(LR_{%independent2}_P) nardl_{%i}.wald -c(4)/c(2) = 0
             freeze(LR_{%independent2}_N) nardl_{%i}.wald -c(5)/c(2) = 0
      freeze(PSS_{%i}) nardl_{%i}.wald c(2) = c(3) = c(4)= c(5)  = 0
   next   
else if !s=3 then 
  for %i {%dependent}
'****Model      
   equation nardl_{%i}.stepls(method = uni, back, btol = !sig) d({%i}) c {%i}(-1) {%independent1}_p(-1) {%independent1}_n(-1) {%independent2}_p(-1) {%independent2}_n(-1) @ d{%i}(-1 to -{!laglength}) d{%independent1}_p(-0 to -{!laglength}) d{%independent1}_n(-0 to -{!laglength}) d{%independent2}_p(-0 to -{!laglength}) d{%independent2}_n(-0 to -{!laglength})
      coef coefs_{%i} = c
'***Store results and conduct tests      
     sym cov_{%i} = nardl_{%i}.@coefcov
        scalar BDM_{%i} = c(2)/@stderrs(2)
        freeze(SerCorr_{%i}) nardl_{%i}.auto(12)
        freeze(HSked_{%i}) nardl_{%i}.hettest(type = White, c)
        freeze(Cusum_{%i}) nardl_{%i}.rls(v)
'***Store results and conduct tests   
      freeze(LRW_{%independent1}) nardl_{%i}.wald -c(3)/c(2) = -c(4)/c(2)
           freeze(LRW_{%independent2}) nardl_{%i}.wald -c(5)/c(2) = -c(6)/c(2)
      freeze(LR_{%independent1}_P) nardl_{%i}.wald -c(3)/c(2) = 0
      freeze(LR_{%independent1}_N) nardl_{%i}.wald -c(4)/c(2) = 0
      freeze(LR_{%independent2}_P) nardl_{%i}.wald -c(5)/c(2) = 0
      freeze(LR_{%independent2}_N) nardl_{%i}.wald -c(6)/c(2) = 0
      freeze(PSS_{%i}) nardl_{%i}.wald c(2) = c(3) = c(4)= c(5) = c(6) = 0
   next
else if !s=4 then 
  for %i {%dependent}
'****Model      
   equation nardl_{%i}.stepls(method = uni, back, btol = !sig) d({%i}) c {%i}(-1) {%independent1}(-1)  {%independent2}(-1) {%independent3}_p(-1) {%independent3}_n(-1) @ d{%i}(-1 to -{!laglength}) d{%independent1}(-0 to -{!laglength}) d{%independent2}(-0 to -{!laglength}) d{%independent3}_p(-0 to -{!laglength}) d{%independent3}_n(-0 to -{!laglength}) 
      coef coefs_{%i} = c
'***Store results and conduct tests      
     sym cov_{%i} = nardl_{%i}.@coefcov
        scalar BDM_{%i} = c(2)/@stderrs(2)
        freeze(SerCorr_{%i}) nardl_{%i}.auto(12)
        freeze(HSked_{%i}) nardl_{%i}.hettest(type = White, c)
        freeze(Cusum_{%i}) nardl_{%i}.rls(v)
'***Store results and conduct tests   
      freeze(LRW_{%independent3}) nardl_{%i}.wald -c(5)/c(2) = -c(6)/c(2)
      freeze(LR_{%independent3}_P) nardl_{%i}.wald -c(5)/c(2) = 0
      freeze(LR_{%independent3}_N) nardl_{%i}.wald -c(6)/c(2) = 0
      freeze(PSS_{%i}) nardl_{%i}.wald c(2) = c(3) = c(4)= c(5) = c(6) = 0
   next   
else if !s=5 then 
  for %i {%dependent}
'****Model      
   equation nardl_{%i}.stepls(method = uni, back, btol = !sig) d({%i}) c {%i}(-1) {%independent1}_p(-1) {%independent1}_n(-1) {%independent2}_p(-1) {%independent2}_n(-1) {%independent3}_p(-1) {%independent3}_n(-1) @ d{%i}(-1 to -{!laglength}) d{%independent1}_p(-0 to -{!laglength}) d{%independent1}_n(-0 to -{!laglength}) d{%independent2}_p(-0 to -{!laglength}) d{%independent2}_n(-0 to -{!laglength}) d{%independent3}_p(-0 to -{!laglength}) d{%independent3}_n(-0 to -{!laglength})
      coef coefs_{%i} = c
'***Store results and conduct tests      
     sym cov_{%i} = nardl_{%i}.@coefcov
        scalar BDM_{%i} = c(2)/@stderrs(2)
        freeze(SerCorr_{%i}) nardl_{%i}.auto(12)
        freeze(HSked_{%i}) nardl_{%i}.hettest(type = White, c)
        freeze(Cusum_{%i}) nardl_{%i}.rls(v)
'***Store results and conduct tests   
      freeze(LRW_{%independent1}) nardl_{%i}.wald -c(3)/c(2) = -c(4)/c(2)
           freeze(LRW_{%independent2}) nardl_{%i}.wald -c(5)/c(2) = -c(6)/c(2)
      freeze(LRW_{%independent3}) nardl_{%i}.wald -c(7)/c(2) = -c(8)/c(2)
      freeze(LR_{%independent1}_P) nardl_{%i}.wald -c(3)/c(2) = 0
      freeze(LR_{%independent1}_N) nardl_{%i}.wald -c(4)/c(2) = 0
      freeze(LR_{%independent2}_P) nardl_{%i}.wald -c(5)/c(2) = 0
      freeze(LR_{%independent2}_N) nardl_{%i}.wald -c(6)/c(2) = 0
      freeze(LR_{%independent3}_P) nardl_{%i}.wald -c(7)/c(2) = 0
      freeze(LR_{%independent3}_N) nardl_{%i}.wald -c(8)/c(2) = 0
      freeze(PSS_{%i}) nardl_{%i}.wald c(2) = c(3) = c(4)= c(5) = c(6) = c(7) = c(8) = 0
   next      
endif
endif
endif
endif
endif
Ozmando
 
Posts: 42
Joined: Sun Jul 15, 2012 4:04 pm

Re: cointegrating nonlinear ARDL

Unread postby TomDoan » Tue Nov 21, 2017 5:25 pm

Sorry. What exactly is that? The data set has nothing in common with the Greenwood-Nimmo et al analysis and just offhand, the EViews code includes some techniques that aren't from that paper either.
TomDoan
 
Posts: 7147
Joined: Wed Nov 01, 2006 5:36 pm

Re: cointegrating nonlinear ARDL

Unread postby benazir_ » Sat Aug 28, 2021 1:30 pm

Hi.
I am trying to use an one unknown threshold ARDL model which Cho et al. (2020) did in following paper.
"Recent Developments of the Autoregressive Distributed Lag Modelling Framework"
Is there any possibility if you can help me with the codes of TARDL with unknown threshold as I am new and have tried a lot to implement unknown TARDL but can not write code for unknown TARDL model. I would really appreciate your help and kind reply.
I followed the Hansen splitting method and so far find threshold and then I split my data around the threshold and then ran positive and negative regime separately by using ardl model. But problem is that since this is unknown threshold so we cannot use ardl or ols method and paper suggest to use QLR but I am stuck at this point and do not know how to use QLR for estimation and inference after finding threshold value.
Thanks in Advance
benazir_
 
Posts: 1
Joined: Wed Aug 23, 2017 5:22 pm


Return to Looking for Code?

Who is online

Users browsing this forum: No registered users and 1 guest