0% found this document useful (0 votes)
330 views10 pages

Forecast Matlab ARIMA

This document provides a summary of the forecast function in MATLAB. The forecast function generates forecasts for an ARIMA or ARIMAX model. It returns the forecasts as well as mean squared errors by default. Additional optional outputs include conditional variances. Name-value pair arguments can specify presample innovations, conditional variances, and predictor data to initialize the forecasts. These optional inputs provide initial values for the forecasting process.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
330 views10 pages

Forecast Matlab ARIMA

This document provides a summary of the forecast function in MATLAB. The forecast function generates forecasts for an ARIMA or ARIMAX model. It returns the forecasts as well as mean squared errors by default. Additional optional outputs include conditional variances. Name-value pair arguments can specify presample innovations, conditional variances, and predictor data to initialize the forecasts. These optional inputs provide initial values for the forecasting process.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

9 Functions — Alphabetical List

forecast

F

9(3%!((3%!(G

Syntax
[Y,YMSE] = forecast(Mdl,numPeriods)
[Y,YMSE,V] = forecast(Mdl,numPeriods)
[Y,YMSE,V] = forecast(Mdl,numPeriods,Name,Value)

Description
[Y,YMSE] = forecast(Mdl,numPeriods)77
(3%!(  $ 8 8<$YMSE&

[Y,YMSE,V] = forecast(Mdl,numPeriods)  7 


7(3%!(       &

[Y,YMSE,V] = forecast(Mdl,numPeriods,Name,Value)87
  7 6Name,Value8&

Input Arguments
Mdl — ARIMA or ARIMAX model
arima 

(3%!((3%!(G  $7    6arima&

7MdlNaN&

numPeriods — Forecast horizon


8

9F$7 8&

D8AA
forecast

 7F6  7Mdl 


  &
*
double

Name-Value Pair Arguments


7  7Name,Value8&Name
8 Value 8 &Name 8 
<>' '?&27   8 
Name1,Value1,...,NameN,ValueN&

'E0' — Presample innovations


 QC

     7  $


7  87'E0'  
C&E0 Mdl.Q &%77 
  $E08<Mdl.Q &%7E0C $
forecast   &  
 &%7E0 $7  
7 &

= 7 $7Y08 > Mdl.PWMdl.Q?$forecast


infer   7E0&9   8$
7forecast7E0$6X0 8 > 67
 7Y05Mdl.P?$forecast  &%767 7Y0
77$E0&
*
double

'V0' — Presample conditional variances


  QC 

    8  7  


  $7  87'V0'  
C &%77  $V0
&V0 C numPaths  8
  F  &%7V0C $forecast 
   &     &%7
V0 $forecast 7 &

D8AD
9 Functions — Alphabetical List

= 7 $7E077 87    $forecast


7   7 8
E0&%7E0 77 8$forecastV0 
7&
*
double

'X0' — Presample predictor data


C

    78


    $7  7'X0' 
C& 7X0&X0 XF
67 &X0 67 7Y05Mdl.P&%7X0
C $forecast  6& 
  67&

= 7 $forecast   8  


  8 7 7877Mdl.Beta&
*
double

'XF' — Predictor forecasts


C

 7$7  7'XF' C&


 7XF&XF X067
 &XF numPeriods &3  7XF  
 77X0&%7XFC numPeriods $forecast 7
numPeriods7&forecastXF7C >?C&

= 7 $forecast   8  


  8 7 7877Mdl.Beta&

'Y0' — Presample responses


 QC

    7  $7 


 87'Y0'  C&Y0
 Mdl.P &%767 C Mdl.P$forecast
  Mdl.P6&   6&%7
Y0 $  7 &

D8DE
forecast

= 7 $7 Mdl 8


$forecast 6
  7&1 $Y0&
*
double

Notes

I %77E0$V0$Y0numPathsc, $
numPaths  $ &9C $7Y0

7 $E0 V07  &%7E0


 $  Y0&
I NaN 8  forecast&7 8
  $    NaN&38NaN
   F$  8 &
I forecastF   
67   &
I X0 CX $ $
77Mdl&87E0&

Output Arguments
Y — Minimum mean square error forecasts of response data
C

!<>!! :?77  7


$ C&YnumPeriods  numPaths &

forecast67 7Y>numPaths? 867 


7 Y0$E0$ V0&%7 7Y0$E0$V0$Y
numPeriods &

% $    77  &


*
double

YMSE — Mean square errors forecasts of conditional mean


C

D8D
9 Functions — Alphabetical List

!<>! :?77  Y$ 


C&YMSEnumPeriods  numPaths &

forecast67 7YMSE>numPaths? 867


 7 Y0$E0$ V0&%7 7Y0$E0$V0$
YnumPeriods &

% $  77  &

<7YMSE  777Y&

   66 YMSE6forecastXF


C&
*
double

V — Minimum mean square error forecasts of conditional variances of future model innovations
C

!<>!! :?77  77


  $ C&VnumPeriods 
numPaths &

forecast67 7V>numPaths? 867 


7 Y0$E0$ V0&%7 7Y0$E0$ V0$V
numPeriods &

% $    77  &


*
double

Examples
Forecast the Conditional Mean Response

9  7   ' F&

 ,'67   !(   # 


 &

Mdl = arima('MA',{0.5,-0.3},'SMA',0.4,'SMALags',12,...

D8D$
forecast

'Constant',0.04,'Variance',0.2);
rng(200);
Y = simulate(Mdl,130);

9 !(  7,6$ 8'


6 77&

ToEstMdl = arima('MALags',1:2,'SMALags',12);
EstMdl = estimate(ToEstMdl,Y(1:100));

ARIMA(0,0,2) Model with Seasonal MA(12):


-----------------------------------------
Conditional Probability Distribution: Gaussian

Standard t
Parameter Value Error Statistic
----------- ----------- ------------ -----------
Constant 0.20403 0.0690637 2.95424
MA{1} 0.502116 0.0972984 5.16058
MA{2} -0.20174 0.104466 -1.93115
SMA{12} 0.27028 0.109071 2.47803
Variance 0.18681 0.0327319 5.70728

EstMdl arima    &

7   7' F$  7


  &

[YF YMSE] = forecast(EstMdl,30,'Y0',Y(1:100));

figure
h1 = plot(Y,'Color',[.7,.7,.7]);
hold on
h2 = plot(101:130,YF,'b','LineWidth',2);
h3 = plot(101:130,YF + 1.96*sqrt(YMSE),'r:',...
'LineWidth',2);
plot(101:130,YF - 1.96*sqrt(YMSE),'r:','LineWidth',2);
legend([h1 h2 h3],'Observed','Forecast',...
'95% Confidence Interval','Location','NorthWest');
title(['30-Period Forecasts and Approximate 95% '...
'Confidence Intervals'])
hold off

D8D2
9 Functions — Alphabetical List

Forecast the NASDAQ Composite Index

9  +( *(;0% C F&

 +( *(;      6C$ C7,


6&

load Data_EquityIdx
nasdaq = DataTable.NASDAQ(1:1500);

9(3%!(>,$,$,?   &

nasdaqModel = arima(1,1,1);
nasdaqFit = estimate(nasdaqModel,nasdaq);

D8D8
forecast

ARIMA(1,1,1) Model:
--------------------
Conditional Probability Distribution: Gaussian

Standard t
Parameter Value Error Statistic
----------- ----------- ------------ -----------
Constant 0.430311 0.185555 2.31905
AR{1} -0.0743926 0.0819849 -0.907394
MA{1} 0.311259 0.0772656 4.02843
Variance 27.826 0.636248 43.7346

90% C7 87   &6  


  &

[Y,YMSE] = forecast(nasdaqFit,500,'Y0',nasdaq);

 7 .e7 &

lower = Y - 1.96*sqrt(YMSE);
upper = Y + 1.96*sqrt(YMSE);

figure
plot(nasdaq,'Color',[.7,.7,.7]);
hold on
h1 = plot(1501:2000,lower,'r:','LineWidth',2);
plot(1501:2000,upper,'r:','LineWidth',2)
h2 = plot(1501:2000,Y,'k','LineWidth',2);
legend([h1 h2],'95% Interval','Forecast',...
'Location','NorthWest')
title('NASDAQ Composite Index Forecast')
hold off

D8D<
9 Functions — Alphabetical List

$  77 8  &

I J9!  (3%!(!  K8,.,


I J087(39K8,
I J!    8:778% A6 K8,,
I J90  ! A!  K8,.
I J9%4*38(3%!(G!  K8,--

D8D>
forecast

References
S,T= $3&$ &=  &J *!   * 
0  A&K5

 &A &-$,..-$&.,5,,'&

S-T=  $&J4 F (80  )# &K5




 &A &',$,..$&' 5'- &

S'T=  $&J(0  )#  !  7  
 373&K !2$       &A &.$,. $
&-5 &

ST=C$4&:&&$4&!&H#$ 4&0&3 & 


 /" 84
 )

'  &:8   0 77$+H
) $,..&

ST: $"&/ 


 
 &)6#$+H
H" X $,..&

ST:8 $3&9&J(80  )#  :7


A7 B8 %7 &K
&A &$,.-$&. 5
, &

S T) $H&*& 


 /" &$+H
$
,..&

See Also
QQ7 Q Q7QQ 

More About
I J!! :9870  !!  K8,,
I J!0 9870  !!  K8,

D8D?

You might also like