Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Home
- /
- Analytics
- /
- Forecasting
- /
- Prediction intervals for the linear combination of forecasts of an ARI...

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

🔒 This topic is **solved** and **locked**.
Need further help from the community? Please
sign in and ask a **new** question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 01-05-2015 07:16 AM
(2070 views)

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

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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

4 REPLIES 4

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Post it at SAS Forecasting and Econometrics

Udo@sas is good at it .

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Hello -

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

Thanks,

Udo

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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

**Don't miss out on SAS Innovate - Register now for the FREE Livestream!**

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.