I am reading Chap7 Enders(2010) AETS 3rdEdn and have attempted to replicate Rothman's (1998) results p.433 & p.445 (they are not in the example's provided with Enders(2014) AETS 4thEdn).
Code: Select all
*===============================
cal(q) 1948:1
data(format=fred) 1948:1 1979:4 unrate
*
set lunrate = log(unrate)
*
* stationarity tests
@dfunit(ttest,det=trend) lunrate
@dfunit(ttest,det=trend,maxlags=6,method=gtos) lunrate
@dfunit(ttest,det=trend,maxlags=6,method=aic) lunrate
*
* detrend lunrate
set trend = t
set trend2 = trend^2
set trend3 = trend^3
*
linreg(define=detrend) lunrate / resids
# constant trend trend2 trend3
prj fitted
set detrendedlun = lunrate - fitted
*
*
prin / lunrate fitted resids detrendedlun
*
graph(hea='Rothman (1998) U.S. unemployment rate',key=upleft, $
klabels=||"lunrate","fitted","detrendedlun"||) 3
# lunrate
# fitted
# detrendedlun
*
* stationarity tests
@dfunit(ttest) detrendedlun
@dfunit(ttest,maxlags=6,method=gtos) detrendedlun
@dfunit(ttest,maxlags=6,method=aic) detrendedlun
*
*
*===============================
* AR model
linreg(define=AR) detrendedlun
# detrendedlun{1 to 2}
*
* GAR model
set detrendedlun3 = detrendedlun^3
linreg(define=GAR) detrendedlun
# detrendedlun{1 to 2} detrendedlun3{2}
*
* BL model
dec series eps
clear(zeros) eps
*
nonlin alpha beta gamma
frml bilinear detrendedlun = z = alpha*detrendedlun{1}+beta*detrendedlun{2}+gamma*detrendedlun{1}*eps{3},eps=detrendedlun-z,z
*
* estimate ARMA model
nonlin alpha beta gamma=0.0
nlls(frml=bilinear) detrendedlun 1948:3 1979:4
*
* estimate bilinear model
nonlin alpha beta gamma
nlls(frml=bilinear) detrendedlun 1948:3 1979:4
*
*
*===============================
* SETAR model
*
set thresh1 = detrendedlun{1}; * use delay of 1
*
@ThreshTest(trim=.15,thresh=thresh1,nograph) detrendedlun 1948:1 *
# constant detrendedlun{1 to 2}
disp "breakvalue" %%breakvalue
disp "Sum of Squared Residuals" %rss
*
* Rothmans's breakvalue
*comp %%breakvalue = 0.062
*
* Estimate the two branches of the model.
linreg(smpl=thresh1>=%%breakvalue) detrendedlun 1948:1 *
# constant detrendedlun{1 to 2}
linreg(smpl=thresh1<%%breakvalue) detrendedlun 1948:1 *
# constant detrendedlun{1 to 2}
2. How has Rothman detrended the U.S. unemployment rate?
3. For the Bilinear model, there are less data points in the estimation 84pts vs. 126pts. Why? However, If I change eps{3} to e.g. eps{2} in the interaction term I have the correct 126pts.
4. For the SETAR model the breakvalue is different, presumably as to the data.
5. Let's say I generate multi-step ahead OOS forecasts and produce a fan-chart, as below for the detrended log-unrate. Using these results I want to generate a fan chart for the trended & unlogged forecasts and similarly for the prediction intervals i.e. I would like to convert all the results in the fan-chart into LEVELS. So something like restore the trend and exp the log-levels forecasts i.e. get "un" forecasts, then exp the RHS of each prediction interval equation with "un" forecast instead of rfore. Is this correct? and if so how in RATS?
Code: Select all
*===============================
* Fan chart for detrended log-unrate
*
* detrend lunrate
set trend 1948:1 1982:4 = t
set trend2 1948:1 1982:4 = trend^2
set trend3 1948:1 1982:4 = trend^3
*
linreg(define=detrend) lunrate / resids
# constant trend trend2 trend3
prj fitted
set detrendedlun = lunrate - fitted
*
boxjenk(ar=2,diffs=0,ma=0,define=req) detrendedlun 1948:1 1979:4
*
uforecast(equation=req,stderrs=stderrs) rfore 1980:1 1982:4
*
prin / lunrate fitted resids detrendedlun rfore
*
set lower95 1980:1 1982:4 = rfore+%invnormal(.025)*stderrs
set upper95 1980:1 1982:4 = rfore+%invnormal(.975)*stderrs
set lower80 1980:1 1982:4 = rfore+%invnormal(.1)*stderrs
set upper80 1980:1 1982:4 = rfore+%invnormal(.9)*stderrs
*
graph(footer="Forecasts and Prediction Intervals",ovcount=4,overlay=fan,ovsame) 6
# detrendedlun 1948:1 1979:4
# rfore
# lower95
# lower80
# upper80
# upper95
many thanks,
Amarjit