# Simulating ARIMA Models

### Introduction

Autoregressive integrated moving average models (ARIMA) are one of the fundamental workhouse time-series models. If data follows a stochastic ARIMA process, past values have an effect on current values. Autoregressive models take the general form

$$y_t = x_t\beta_t + \mu_t$$ where

$$\mu_t - \omega_1\mu_{t-1} - \cdots\ \omega_p\mu_{t-p} = \epsilon_{t}$$

and

$$\epsilon_t \sim N(0, \sigma^2).$$

The GAUSS TSMT application module provides a number of routines for performing pre-estimation data analysis, model parameter estimation, and post-estimation diagnosis of autoregressive time series. A natural starting point is simulating ARIMA data for estimation.

## Simulate ARIMA data

Realizations of any ARIMA data generation process can be simulated using the GAUSS function simarmamt. For example, consider a time series that follows the purely autoregressive data generation process given by:

$$y_t = 1.5 + \mu_t$$ $$\mu_t - 0.5\mu_{t-1} + 0.8\mu_{t-2} = \epsilon_{t}$$ $$\epsilon_t \sim N(0, 1)$$.

// Load TSMT library
library tsmt;

// Specify ARMA Parameters
b =  { 0.5, -0.8 };

// Specify MA order
q = 0;

// Specify AR order
p = 2;

// Specify deterministic features (constant and trend)
const = 1.5;
tr = 0;

// Number of observations
n = 200;

// Number of series to simulate
// and number of columns of simulated data
k = 1;

// Standard deviation of the error terms
std = 1;

// Set seed for repeatable simulations
seed = 5012;

// Perform simulation
y_sim = simarmamt(b, p, q, const, tr, n, k, std, seed);

The code above will produce a 200 x 1 matrix of data that follows the AR(2) data generating process specified. Each column of the matrix represents a different random realization of the process. The graph at the top of this tutorial shows the y_sim created by the above code.

### Conclusion

You have learned how to use the simarmamt function to simulate an AR model. The next tutorial demonstrates finding the ACF and PACF in GAUSS.

### Have a Specific Question?

Get a real answer from a real person

### Need Support?

Get help from our friendly experts.