Forecasting using SAS Forecast Server, SAS/ETS, and more

Prediction intervals for the linear combination of forecasts of an ARIMA model

Accepted Solution Solved
Reply
SAS Employee
Posts: 340
Accepted Solution

Prediction intervals for the linear combination of forecasts of an ARIMA model

Hi,

I have an estimated ARIMA model, and based on that I have the forecast for the next x periods.

I need the prediction and prediction (forecast) intervals for the following:

0.5*forecast_lead_2+forecast_lead_7

In the below example the prediction (forecast) is:

0.5*118440.4517 + 119798.8033

How can I calculate intervals?


proc arima data=sashelp.citimon;

      i var=CCIUAC(1);

      e p=6 q=1;

      f lead=12 out=forecast;

run;

quit;

In a general case I need prediction for the linear combination of forecasts with prediction intervals.

Thx


Accepted Solutions
Solution
‎01-06-2015 09:17 AM
SAS Employee
Posts: 340

Re: Prediction intervals for the linear combination of forecasts of an ARIMA model

Posted in reply to gergely_batho

I tried to use the Inpulse Respoonse Function of the model to get the mentioned forecast intervals:

Each random shock is independent, so I can add the variance (sigma**2) weighted by the IRF. Then take the square root.

This is also how the simple forecast intervals (Standard Errors) are calculated.

Now I only need to be careful with the linear combination. For example the effect of the random shock at lead(2)  - remember, we are calculating std error for lead(7) – is: 0.5*irf(0) + irf(5)

Anybody can see a theoretical error in this approach?

PROC VARMAX can be used, to get the IRF.

Here's a code:

proc varmax data=sashelp.citimon;

  model CCIUAC / dif(CCIUAC(1)) q=1 p=4 /*6*/ method=ml print=(impulse=(simple accum )) lagmax=6 ;

  output out=vforecast lead=12;

run;

data _null_;

  sigma=sqrt(586153.48852); /* number copied here from the output of VARMAX*/

  array irf[0:7] (1, 0.33369, 0.29371, 0.46347, 0.23512, 0.21355, 0.22610, 0.14592);/*Impulse Response - numbers copied here from the output of VARMAX*/

  array airf[0:7];/*Accumulated Impulse Response*/

  airf[0]=1; do i=1 to 7; airf=airf[i-1]+irf;end;/*calculating airf from irf*/

  /*Calculating StdErr for forecast lead 2*/

  do i=0 to 1;

  std_2+airf**2;

  end;

  std_2=sqrt(std_2)*sigma;

  /*Calculating StdErr for forecast lead 7*/

  do i=0 to 6;

  std_7+airf**2;

  end;

  std_7=sqrt(std_7)*sigma;

  /*Calculating StdErr for the linear combination*/

  /*It is similar to a convolution operator, but you sum the squares*/

  do i=0 to 6;

  if 0<=i<=4 then do;/**/

lincomb+airf**2;

  end;

  else do;/*5 and 6*/

lincomb+(airf+0.5*airf[i-5])**2;

  end;

  end;

  lincomb=sqrt(lincomb)*sigma;

  putlog sigma= std_2= std_7= lincomb=;

run;

Perhaps SAS/IML can do this with less coding.

Thx

View solution in original post


All Replies
Super User
Posts: 10,018

Re: Prediction intervals for the linear combination of forecasts of an ARIMA model

Posted in reply to gergely_batho

Post it at SAS Forecasting and Econometrics

Udo@sas is good at it .

SAS Employee
Posts: 416

Re: Prediction intervals for the linear combination of forecasts of an ARIMA model

Hello -

This paper might be of interest: http://support.sas.com/resources/papers/proceedings12/341-2012.pdf

Thanks,

Udo

SAS Employee
Posts: 340

Re: Prediction intervals for the linear combination of forecasts of an ARIMA model

Thank you Udo,

The mentioned paper is about combining forecasts of different models. But I have only one model, and I want to forecast (calculate) the linear combination of forecasts of two different periods.

On the other hand the suggested paper contains a description about calculating forecast confidence intervals using the sample cross correlation. Maybe that idea could be useful in my situation.

I still think it should be possible (somehow) to derive the cross correlation between forecast_lead_2 and forecast_lead_7 simply by using the model parameter estimates.

Or maybe this (linear combination) forecast interval could be directly calculated using the forecast intervals of the original forecasts.

Thx

Solution
‎01-06-2015 09:17 AM
SAS Employee
Posts: 340

Re: Prediction intervals for the linear combination of forecasts of an ARIMA model

Posted in reply to gergely_batho

I tried to use the Inpulse Respoonse Function of the model to get the mentioned forecast intervals:

Each random shock is independent, so I can add the variance (sigma**2) weighted by the IRF. Then take the square root.

This is also how the simple forecast intervals (Standard Errors) are calculated.

Now I only need to be careful with the linear combination. For example the effect of the random shock at lead(2)  - remember, we are calculating std error for lead(7) – is: 0.5*irf(0) + irf(5)

Anybody can see a theoretical error in this approach?

PROC VARMAX can be used, to get the IRF.

Here's a code:

proc varmax data=sashelp.citimon;

  model CCIUAC / dif(CCIUAC(1)) q=1 p=4 /*6*/ method=ml print=(impulse=(simple accum )) lagmax=6 ;

  output out=vforecast lead=12;

run;

data _null_;

  sigma=sqrt(586153.48852); /* number copied here from the output of VARMAX*/

  array irf[0:7] (1, 0.33369, 0.29371, 0.46347, 0.23512, 0.21355, 0.22610, 0.14592);/*Impulse Response - numbers copied here from the output of VARMAX*/

  array airf[0:7];/*Accumulated Impulse Response*/

  airf[0]=1; do i=1 to 7; airf=airf[i-1]+irf;end;/*calculating airf from irf*/

  /*Calculating StdErr for forecast lead 2*/

  do i=0 to 1;

  std_2+airf**2;

  end;

  std_2=sqrt(std_2)*sigma;

  /*Calculating StdErr for forecast lead 7*/

  do i=0 to 6;

  std_7+airf**2;

  end;

  std_7=sqrt(std_7)*sigma;

  /*Calculating StdErr for the linear combination*/

  /*It is similar to a convolution operator, but you sum the squares*/

  do i=0 to 6;

  if 0<=i<=4 then do;/**/

lincomb+airf**2;

  end;

  else do;/*5 and 6*/

lincomb+(airf+0.5*airf[i-5])**2;

  end;

  end;

  lincomb=sqrt(lincomb)*sigma;

  putlog sigma= std_2= std_7= lincomb=;

run;

Perhaps SAS/IML can do this with less coding.

Thx

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 1332 views
  • 3 likes
  • 3 in conversation