TVolscho-286 wrote:Could some of the Enders-Siklos code be modified to pick thresholds from an ARDL? Has anyone tried this?
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 wrote:TVolscho-286 wrote:Could some of the Enders-Siklos code be modified to pick thresholds from an ARDL? Has anyone tried this?
***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 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?
'***********************************************************
'******************** 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
Users browsing this forum: No registered users and 9 guests