Hi Tom,
Based on Example 4.1 TAR Model for Unemployment, here's an attempt at recursive STATIC ONE-STEP AHEAD FORECASTS generated from a SETAR model. Please can you have a look - I think it's correct.
Code: Select all
*===============================
*
* RECURSIVE STATIC ONE-STEP AHEAD OOS FORECASTS
*
*
seed 550103
*
clear(length=2010:10) urfore_1
*
do regend = 2010:10-13, 2010:10
*
@threshtest(thresh=dur,d=1,nreps=100) dur * regend
# constant dur{1 to 4}
*
compute break1=%%breakvalue
disp break1
*
* Estimate the two branches and define equations
*
linreg(smpl=dur{1}<=break1,frml=branch1) dur * regend
# constant dur{1 to 4}
compute rss1=%rss,ndf1=%ndf
linreg(smpl=dur{1}>break1,frml=branch2) dur * regend
# constant dur{1 to 4}
compute rss2=%rss,ndf2=%ndf
compute seesq=(rss1+rss2)/(ndf1+ndf2)
*
*
* Define the forecasting model
*
frml(variance=seesq) tarfrml dur = $
%if(dur{1}<=break1,branch1,branch2)
frml(identity) urid unrate = unrate{1}+dur
group tarmodel tarfrml urid
*
*
* Compute average across simulations
*
compute fstart=regend,fend=regend
set urfore_1 regend regend = 0.0
compute ndraws=5000
do draw=1,ndraws
simulate(model=tarmodel,from=regend,to=regend,results=sims_1,noprint)
set urfore_1 regend regend = urfore_1+sims_1(2)
end do draw
set urfore_1 regend regend = urfore_1/ndraws
*
*
end do regend
*
graph(footer="RECURSIVE STATIC ONE-STEP AHEAD OOS FORECASTS") 2
# unrate regend-13 regend
# urfore_1
*
prin fstart-13 regend unrate urfore_1
How do I calculate forecast SE's for Prediction intervals?
I also want to compute nth-step-ahead forecasts, DYNAMIC MULTISTEP AHEAD OOS FORECASTS and save only the nth forecast step from each recursive multistep ahead simulation...
many thanks,
Amarjit