how to forecast level and CIs from difference eq using RATS
how to forecast level and CIs from difference eq using RATS
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
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
sorry, there are two typos:
set lower = DLogA+Errror_DLogA(1)*%invnormal(0.025)
set upper = DLogA+Error_DLogA(1)*%invnormal(0.975)
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
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
# 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
Thank you very much Tom, appreciate your help! 
Re: how to forecast level and CIs from difference eq using R
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
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
Yes. It will be the standard errors of forecast of the logA. Those should be increasing with horizon.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
Re: how to forecast level and CIs from difference eq using R
Thank you very much Tom, much appreciated! 