Rolling Window Timeseries ARDL Cointegrating Bounds in STATA

ARDL bound testing approach is widely used in time series data to assess long run relation in mixed order of variables. Recently a study has emerged which had developed the Rolling Window ARDL model (RARDL) using MATLAB. This tutorial tries to develop a similar version using STATA.

This rolling window ARDL model can help estimate the sensitivity of the effects of independent variable across time and find the time periods in which the effect of the variables was strongest. Policy models can be assessed using this approach to see in which regime the policy was effective.

You can see the tutorial here:

 

Codes are as under:

clear
 use “C:\Users\LENOVO\Desktop\rolling window ARDL\rolling window ardl in stata\data.dta”
 tsset time
**# Overall Model
  ardl mal pak turk , lags(. . .) maxlag(4 4 4) ec
  estat ectest
 ardl mal pak turk , lags(. . .) maxlag(4 4 4) ec aic regstore(ecreg)
estimates restore ecreg
regress
estat dwatson
estat archlm
estat bgodfrey
estat hettest
estat ovtest
estat vif
** following command only works in stata 14 or above
estat sbsingle
**ssc install cusum6
cusum6 D.mal L(1/2)D.mal L.mal pak indo d.pak d.indo, cs(cusum)
cusum6 D.mal L(1/2)D.mal L.mal pak indo d.pak d.indo, cs(cusum2)
**# Rolling Window ARDL
 capture postutil clear
tempfile holding
postfile handle start end adj se_adj pak se_pak indo se_indo f_val t_val rmse r2 using `holding’
forvalues i = 1(10)1838 {
local obs_end = `i’ + 500
ardl mal pak turk if time > `i’ & time < `obs_end’, lags(. . .) maxlag(4 4 4) ec
 post handle (`i’) (`obs_end’) (_b[L1.mal]) (sqrt(e(V)[1,1])) (e(b)[1,2]) (sqrt(e(V)[2,2])) (e(b)[1,3])  (sqrt(e(V)[3,3])) (e(F_pss)) (e(t_pss)) (e(rmse)) (e(r2))
}
 postclose handle
use `holding’, clear
 gen t_adj = adj / se_adj
 twoway (line adj start, yaxis(2)) (line t_adj start) , yline(-1.96 1.96) title(Adjustment Coefficient)
 gen t_pak = pak / se_pak
 twoway (line pak start, yaxis(2)) (line t_pak start) , yline(-1.96 1.96) title(Effect of Pakistan Stock Index)
 gen t_indo = indo / se_indo
 twoway (line indo start, yaxis(2)) (line t_indo start), yline(-1.96 1.96) title (Effect of Turkey Stock Index)
 twoway (line f_val start), yline(4.123) title(F Bounds Test) name(a1, replace)
 * 4.123
 twoway (line t_val start), yline(-3.219) title(t Bounds Test) name(a2, replace)
 * -3.219
 twoway (line rmse start), title(Root Mean Sq Error) name(a3, replace)
 twoway (line r2 start), title(R Squared) name(a4, replace)
 graph combine a1 a2 a3 a4, title (Regression Statistics) scheme(sj)

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top