Accelerating the pace of engineering and science

# Documentation

## Simulate Multiplicative ARIMA Models

This example shows how to simulate sample paths from a multiplicative seasonal ARIMA model using simulate. The time series is monthly international airline passenger numbers from 1949 to 1960.

Load the Data and Estimate a Model.

Load the data set Data_Airline.

```load(fullfile(matlabroot,'examples','econ','Data_Airline.mat'))
y = log(Data);
T = length(y);

Mdl = arima('Constant',0,'D',1,'Seasonality',12,...
'MALags',1,'SMALags',12);
EstMdl = estimate(Mdl,y);
res = infer(EstMdl,y);
```
```
ARIMA(0,1,1) Model Seasonally Integrated with Seasonal MA(12):
---------------------------------------------------------------
Conditional Probability Distribution: Gaussian

Standard          t
Parameter       Value          Error       Statistic
-----------   -----------   ------------   -----------
Constant              0         Fixed          Fixed
MA{1}      -0.377162     0.0667944       -5.64661
SMA{12}      -0.572378     0.0854395       -6.69923
Variance     0.00126337    0.00012395        10.1926
```

Simulate Airline Passenger Counts.

Use the fitted model to simulate 25 realizations of airline passenger counts over a 60-month (5-year) horizon. Use the observed series and inferred residuals as presample data.

```rng 'default'
Ysim = simulate(EstMdl,60,'NumPaths',25,'Y0',y,'E0',res);
mn = mean(Ysim,2);

figure
plot(y,'k')
hold on
plot(T+1:T+60,Ysim,'Color',[.85,.85,.85]);
h = plot(T+1:T+60,mn,'k--','LineWidth',2)
xlim([0,T+60])
title('Simulated Airline Passenger Counts')
legend(h,'Simulation Mean','Location','NorthWest')
hold off
```
```h =

Line with properties:

Color: [0 0 0]
LineStyle: '--'
LineWidth: 2
Marker: 'none'
MarkerSize: 6
MarkerFaceColor: 'none'
XData: [1x60 double]
YData: [1x60 double]
ZData: [1x0 double]

Use GET to show all properties

```

The simulated forecasts show growth and seasonal periodicity similar to the observed series.

Estimate the Probability of a Future Event.

Use simulations to estimate the probability that log airline passenger counts will meet or exceed the value 7 sometime during the next 5 years. Calculate the Monte Carlo error associated with the estimated probability.

```rng default
Ysim = simulate(EstMdl,60,'NumPaths',1000,'Y0',y,'E0',res);

g7 = sum(Ysim >= 7) > 0;
phat = mean(g7)
err = sqrt(phat*(1-phat)/1000)
```
```phat =

0.3910

err =

0.0154

```

There is approximately a 39% chance that the (log) number of airline passengers will meet or exceed 7 in the next 5 years. The Monte Carlo standard error of the estimate is about 0.02.

Plot the Distribution of Passengers at a Future Time.

Use the simulations to plot the distribution of (log) airline passenger counts 60 months into the future.

```figure
hist(Ysim(60,:))
title('Distribution of Passenger Counts in 60 months')
```