how to forecast level and CIs from difference eq using RATS

Questions and discussions on Time Series Analysis
anozman
Posts: 59
Joined: Mon Jan 30, 2012 5:16 pm

how to forecast level and CIs from difference eq using RATS

Unread post by anozman »

Hi All,

I was wondering any one knows how to fix the following problem:

I tried to get some level forecasts out of the differenced forecast numbers without much success so far. The following is my simple program:

Quarterly data set is from 1950:1 to 2010:4


diff LogA / DLogA
diff LogB / DLogB
diff LogC / DLogC
diff LogD / DLogD

linreg(define=eq_DLogA,ROBUST,LAGS=2,LWINDOW=NEWEY)
DLogA / Res_ DLogA
# constant $
DLogA {1 2 3 4 } $
DLogB {1 2 3 } $
DLogC {0 1 2 3 } $
DLogD {0 1 2 3 }

FORECAST(FROM=2010:1,steps=10,STDERRS=Error_DLogA, nostatic)
# eq_DLogA DLogA
equation(identity, coeffs=||1.0,1.0||) LogA_ID LogA
# DLogA LogA{1}
set lower = DLogA+Err_DLogA(1)*%invnormal(0.025)
set upper = DLogA+Err_DLogA(1)*%invnormal(0.975)
print / LogA DLogA lower upper Error_DLogA

All the forecasts can be computed except LogA (the level of DLogA), which does not have any forecast values (all NAs).

I was wondering whether someone could kindly point out which part of the code is not right and any example code will be greatly appreciated.

In addition, is it possible to also compute standard errors for the LogA (the level) as well so that I can construct the confidence intervals for the LogA forecasts.

Thank you very much in advance!

Regards
anozman
Posts: 59
Joined: Mon Jan 30, 2012 5:16 pm

Re: how to forecast level and CIs from difference eq using R

Unread post by anozman »

sorry, there are two typos:

set lower = DLogA+Errror_DLogA(1)*%invnormal(0.025)
set upper = DLogA+Error_DLogA(1)*%invnormal(0.975)
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: how to forecast level and CIs from difference eq using R

Unread post by TomDoan »

FORECAST(FROM=2010:1,steps=10,STDERRS=Error_DLogA, nostatic)
# eq_DLogA DLogA
equation(identity, coeffs=||1.0,1.0||) LogA_ID LogA
# DLogA LogA{1}

doesn't incorporate the identity into the forecasts. You need to define the identity first, then include it in the FORECAST instruction, that is:

equation(identity, coeffs=||1.0,1.0||) LogA_ID LogA
# DLogA LogA{1}
FORECAST(FROM=2010:1,steps=10,STDERRS=Error_DLogA, nostatic) 2
# eq_DLogA DLogA
# loga_id LogA
anozman
Posts: 59
Joined: Mon Jan 30, 2012 5:16 pm

Re: how to forecast level and CIs from difference eq using R

Unread post by anozman »

Thank you very much Tom, appreciate your help! :D
anozman
Posts: 59
Joined: Mon Jan 30, 2012 5:16 pm

Re: how to forecast level and CIs from difference eq using R

Unread post by anozman »

Hi Tom,

the program runs nicely. Could you please tell me whether the second error term - Error_DlogA(2) reported based on PRINT instruction is in fact related to logA, as it is the second equation included in the forecast insttruction?

Many thanks
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: how to forecast level and CIs from difference eq using R

Unread post by TomDoan »

anozman wrote:Hi Tom,

the program runs nicely. Could you please tell me whether the second error term - Error_DlogA(2) reported based on PRINT instruction is in fact related to logA, as it is the second equation included in the forecast insttruction?

Many thanks
Yes. It will be the standard errors of forecast of the logA. Those should be increasing with horizon.
anozman
Posts: 59
Joined: Mon Jan 30, 2012 5:16 pm

Re: how to forecast level and CIs from difference eq using R

Unread post by anozman »

Thank you very much Tom, much appreciated! :lol:
Post Reply