Page 1 of 1

how to forecast level and CIs from difference eq using RATS

Posted: Sat Jun 02, 2012 8:29 am
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

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

Posted: Sat Jun 02, 2012 8:36 am
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)

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

Posted: Sun Jun 03, 2012 9:25 am
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

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

Posted: Sun Jun 03, 2012 4:40 pm
by anozman
Thank you very much Tom, appreciate your help! :D

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

Posted: Mon Jun 04, 2012 1:38 am
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

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

Posted: Mon Jun 04, 2012 7:53 am
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.

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

Posted: Mon Jun 04, 2012 5:12 pm
by anozman
Thank you very much Tom, much appreciated! :lol: