Rothman(1998) - Enders(2010) AETS 3rdEdn Chap7 p.433 & p.445

Econometrics questions and discussions

Rothman(1998) - Enders(2010) AETS 3rdEdn Chap7 p.433 & p.445

Unread postby ac_1 » Sun Feb 14, 2021 7:30 am

Hi Tom,

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}

1. I am not certain this is the correct data? Data does get revised.
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


I would be very grateful if you would correct any errors.

many thanks,
Amarjit
ac_1
 
Posts: 201
Joined: Thu Apr 15, 2010 6:30 am
Location: London, UK

Re: Rothman(1998) - Enders(2010) AETS 3rdEdn Chap7 p.433 & p

Unread postby ac_1 » Tue Feb 16, 2021 10:41 am

Hi Tom,

I have attempted to undo the transformations to get a fan chart for the ORIGINAL LEVEL series: i.e. untrend and unlog, but I don't think this is correct, please can you correct.

Code: Select all
*===============================
* Fan chart unrate
*
linreg(define=detrend2) rfore 1980:1 1982:4 resids1
# constant trend trend2 trend3
prj fitted1
*
* OR
comp beta1 = %beta(1)
comp beta2 = %beta(2)
comp beta3 = %beta(3)
comp beta4 = %beta(4)
set fitted2 1980:1 1982:4 = beta1 + (beta2*trend) + (beta3*trend2) + (beta4*trend3)
*
set resids2 1980:1 1982:4 = rfore - fitted2
prin 1980:1 1982:4 fitted1 fitted2 resids1 resids2
*
set unrfore 1980:1 1982:4 = unrate(1979:4) * exp(resids2)
prin 1980:1 1982:4 unrfore
*
set explower95 1980:1 1982:4 = unrate(1979:4) * exp(resids2+%invnormal(.025)*stderrs)
set expupper95 1980:1 1982:4 = unrate(1979:4) * exp(resids2+%invnormal(.975)*stderrs)
set explower80 1980:1 1982:4 = unrate(1979:4) * exp(resids2+%invnormal(.1)*stderrs)
set expupper80 1980:1 1982:4 = unrate(1979:4) * exp(resids2+%invnormal(.9)*stderrs)
*
graph(footer="Forecasts and Prediction Intervals",ovcount=4,overlay=fan,ovsame) 6
# unrate 1948:1 1979:4
# unrfore
# explower95
# explower80
# expupper80
# expupper95


Also, for the Bilinear model why are there less data points 84pts vs. 126pts in the estimation, with the interaction term eps{3} vs.e.g. eps{2} ?

many tahnks,
Amarjit
ac_1
 
Posts: 201
Joined: Thu Apr 15, 2010 6:30 am
Location: London, UK

Re: Rothman(1998) - Enders(2010) AETS 3rdEdn Chap7 p.433 & p

Unread postby TomDoan » Tue Feb 16, 2021 1:28 pm

ac_1 wrote:Hi Tom,

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}

1. I am not certain this is the correct data? Data does get revised.


Almost certainly not. However, unemployment rate doesn't get revised as dramatically as (say) GDP.

ac_1 wrote:2. How has Rothman detrended the U.S. unemployment rate?


The paper says "log-linear detrended" which I assume means a linear detrend on the log. You're doing a cubic detrend.

ac_1 wrote: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.


You're starting at 1948:3 which isn't computable with the eps{3} term.

ac_1 wrote:4. For the SETAR model the breakvalue is different, presumably as to the data.


Likely.

ac_1 wrote: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?


If you have the forecast, upper and lower bounds for the log detrended data, you would add the trend back (your FITTED series) to each of those components and exp them.

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


I would be very grateful if you would correct any errors.

many thanks,
Amarjit[/quote]
TomDoan
 
Posts: 7240
Joined: Wed Nov 01, 2006 5:36 pm

Re: Rothman(1998) - Enders(2010) AETS 3rdEdn Chap7 p.433 & p

Unread postby ac_1 » Wed Feb 17, 2021 4:37 am

Thanks for the reply. I will stick with a cubic detrend, IMHO it's a better fit for this particular data-set.

TomDoan wrote:
If you have the forecast, upper and lower bounds for the log detrended data, you would add the trend back (your FITTED series) to each of those components and exp them.


The FITTED series is only until 1979:04, to add the trend back to each component I have forecast to 1982:4, then exp'ed. Correct?

Code: Select all
*===============================
* Fan chart unrate
*
linreg(define=detrend) lunrate
# constant trend trend2 trend3
uforecast(equation=detrend) ftrend 1980:1 1982:4
*
prin / rfore lower95 upper95 lower80 upper80 fitted ftrend
*
set fore 1948:1 1982:4 = exp(rfore + ftrend)
set flower95 1948:1 1982:4 = exp(lower95 + ftrend)
set fupper95 1948:1 1982:4 = exp(upper95 + ftrend)
set flower80 1948:1 1982:4 = exp(lower80 + ftrend)
set fupper80 1948:1 1982:4 = exp(upper80 + ftrend)
*
graph(footer="Forecasts and Prediction Intervals",ovcount=4,overlay=fan,ovsame) 6
# unrate 1948:1 1979:4
# fore
# flower95
# flower80
# fupper80
# fupper95
ac_1
 
Posts: 201
Joined: Thu Apr 15, 2010 6:30 am
Location: London, UK

Re: Rothman(1998) - Enders(2010) AETS 3rdEdn Chap7 p.433 & p

Unread postby TomDoan » Wed Feb 17, 2021 8:08 am

Yes. The trend is deterministic, so you can define it for as long as you need. However, to use a cubic trend because "it's a better fit" is almost always a mistake---better fit in-sample doesn't necessarily translate to better forecasts out-of-sample. For a forecasting model of the US unemployment rate, I'm not even sure that including a linear trend is a good idea.
TomDoan
 
Posts: 7240
Joined: Wed Nov 01, 2006 5:36 pm


Return to General Econometrics

Who is online

Users browsing this forum: No registered users and 2 guests

cron