ARIMA Models | Extreme Optimization Numerical Libraries for .NET Professional |

Auto-Regressive Integrated Moving Average (ARIMA) models are used to model time series data and produce forecasts for future values.

The type of ARIMA model is usually specified as ARIMA(p,d,q). p is the autoregressive (AR)order, or the number of autoregressive components. q is the moving average (MA) order, or the number of moving average components in the model. d is the degree of differencing. When d is zero, the model is called an ARMA(p,q) model. When in addition p or q is zero, the model is called an MA(q) model or AR(p) model, respectively.

ARIMA models are implemented by the ArimaModel class.

The ArimaModel
class has two constructors. The first takes three arguments and is used
to construct an ARMA(p,q) model. The first argument is a
Vector

The second constructor takes four arguments and is used to construct
ARIMA(p,d,q) models. The first argument is once again the
Vector

For an ARMA(p,q) model, the mean is usually not zero, and it is estimated by default. When a series is differenced enough times, the mean of the differenced series will be close to zero. For ARIMA models with nonzero degree of differencing, the mean is not estimated by default. In each case, the default behavior can be overridden by setting the EstimateMean property.

The Compute method estimates the parameters of the model by minimizing the exact maximum likelihood function.

The parameters of the model can be retrieved through the Parameters collection. The first p parameters are the coefficients of the autoregressive components. The next q parameters are the coefficients of the moving average components. If the mean was estimated also, it is returned as the last parameter. The autoregressive and moving average coefficients can also be retrieved separately through the AutoRegressiveParameters and MovingAverageParameters properties.

The members of these collections are of type Parameter, and can be used to obtain a wide range of information about the computed values, including the standard error, significance tests and confidence intervals.

model1.Compute(); Console.WriteLine("AR(0): {0}", model1.AutoRegressiveParameters[0].Value); Console.WriteLine("MA(0): {0}", model1.MovingAverageParameters[0].Value); Console.WriteLine("Mean: {0}", model1.Parameters[3].Value); Console.WriteLine(model1.ParameterValues);

Because an ARIMA model is computed by directly maximizing the likelihood function, it does not have the same range of diagnostic values available for linear regression models. Still, a number of standard measures are available.

The GetLogLikelihood method returns the logarithm of the likelihood of the computed model. The GetAkaikeInformationCriterion method returns the Akaike Information Criterion (AIC) value. This is commonly used to compare different models. The GetBayesianInformationCriterion method returns the Bayesian Information Criterion (BIC) value, which is sometimes used instead of the AIC.

var ll = model1.LogLikelihood; var aic = model1.GetAkaikeInformationCriterion(); var bic = model1.GetBayesianInformationCriterion();

Another way to test the model is by looking at the residuals. If the model is adequate, the residuals should no longer be correlated. This can be tested using the Ljung-Box test. This test is implemented by the LjungBoxTest class. The ARIMA model object provides a convenience method, GetLjungBoxTest, that returns the Ljung-Box test with the correct degrees of freedom. The method takes one argument: the number of auto-correlations to include in the test.

var lb = model1.GetLjungBoxTest(5); Console.WriteLine("Ljung-Box χ2: {0:F2}", lb.Statistic); Console.WriteLine("Ljung-Box p: {0:F4}", lb.PValue);

Once the model has been computed, the Forecast method can then be used to forecast new values. This method has three overloads.

Without arguments, the method returns the one step ahead forecast based on
the computed model. With a single argument, it computes a point forecast
the specified number of steps ahead. It returns a
Vector

#### Reference

Copyright © 2004-20116,
Extreme Optimization. All rights reserved.

*Extreme Optimization,* *Complexity made simple*, *M#*, and *M
Sharp* are trademarks of ExoAnalytics Inc.

*Microsoft*, *Visual C#, Visual Basic, Visual Studio*, *Visual
Studio.NET*, and the *Optimized for Visual Studio* logo

are
registered trademarks of Microsoft Corporation.