'open workfile wfopen .\smlocalirfs_data.wf1 'macroeconomic variables %yvar = "yg" %xvar = "ir" %zvar = "pi" 'draw figure-1 group vars.add {%yvar} {%xvar} {%zvar} freeze(mode=overwrite,figure1) vars.line figure1.legend columns(3) figure1.setelem(1) legend(GDP growth) figure1.setelem(2) legend(Interest rate) figure1.setelem(3) legend(Inflation rate) 'input variables !lags = 4 'number of lags !Hmax = 20 'horizon of impulse-response !lambda = 100 'penalty parameter !alpha = 0.05 'significance 'control variables group controls.add {%yvar} {%zvar} {%yvar}(-1to-!lags ) {%xvar}(-1to-!lags ) {%zvar}(-1to-!lags ) 'sample period %sample = "1960q1 2007q2" smpl {%sample} 'run the add-in (regular LP) smlocalirfs(yvar={%yvar},xvar={%xvar},zvar=controls,lag=!lags,Hmax=!Hmax,type=1,alpha=!alpha,smpl={%sample},nocont) 'run the add-in (smoothed LP) smlocalirfs(yvar={%yvar},xvar={%xvar},zvar=controls,lag=!lags,Hmax=!Hmax,type=2,r=2,lambda=!lambda,alpha=!alpha,smpl={%sample},nocont) 'run the add-in (cross validation for the optimal lambda value and confidence interval) vector lambdas = @fill(1,10,50,100,250,500,1000,5000,10000) smlocalirfs(yvar={%yvar},xvar={%xvar},zvar=controls,lag=!lags,Hmax=!Hmax,type=2,r=2,lambdavec=lambdas,alpha=!alpha,smpl={%sample},nocont,confint) 'draw Figure 3 matrix impreps = @hcat(imprep,imprep01) freeze(mode=overwrite,figure3) impreps.line figure3.setelem(1) legend(Regular LP) figure3.setelem(2) legend(Smooth LP) 'draw Figure 4 matrix impreps2 = @hcat(imprep02,imprep_confint) freeze(mode=overwrite,figure4) impreps2.line figure4.legend columns(3) figure4.setelem(1) legend(Base) figure4.setelem(2) legend(Lower band) figure4.setelem(3) legend(Upper band) figure4.options linepat figure4.setelem(2) linecolor(@rgb(213,0,50)) figure4.setelem(3) linepattern(DASH1) linecolor(@rgb(213,0,50))