# ARMAX_GOF - Goodness of fit of an ARMAX Model

Computes the goodness of fit measure (e.g. log-likelihood function (LLF), AIC, etc.) of the estimated ARIMA model.

## Syntax

ARMAX_GOF(Y, X, Order, Beta, mean, sigma, phi, theta, Type)

Y is the response, AKA the dependent variable time series data array (one dimensional array of cells (e.g. rows or columns)).

X is the independent variables (exogenous factors) time series data matrix, such that each column represents one variable.

Order is the time order in the data series (i.e. the first data point's corresponding date (earliest date=1 (default), latest date=0)).

Order Description
1 ascending (the first data point corresponds to the earliest date) (default)
0 descending (the first data point corresponds to the latest date)

Beta is the coefficients array of the exogenous factors.

mean is the ARMA long-run mean (i.e. mu).

sigma is the standard deviation of the model's residuals.

phi are the parameters of the AR(p) component model (starting with the lowest lag).

theta are the parameters of the MA(q) component model (starting with the lowest lag).

Type is an integer switch to select the goodness of fitness measure: (1=LLF (default), 2=AIC, 3=BIC, 4=HQC).

Order Description
1 Log-Likelihood Function (LLF) (default)
2 Akaike Information Criterion (AIC)
3 Schwarz/Bayesian Information Criterion (SIC/BIC)
4 Hannan-Quinn information criterion (HQC)

## Remarks

1. The underlying model is described here.
2. The Log-Likelihood Function (LLF) is described here.
3. Each column in the explanatory factors input matrix (i.e. X) corresponds to a separate variable.
4. Each row in the explanatory factors input matrix (i.e. X) corresponds to an observation.
5. Observations (i.e. rows) with missing values in X or Y are assumed missing.
6. The number of rows of the explanatory variable (X) must be equal to the number of rows of the response variable (Y).
7. The time series is homogeneous or equally spaced.
8. The time series may include missing values (e.g. #N/A) at either end.
9. The residuals/innovations standard deviation (i.e. $\sigma$) should be greater than zero.
10. The ARMA model has independent and normally distributed residuals with constant variance. The ARMA log-likelihood function becomes:

$$\ln L^* = -T\left(\ln 2\pi \hat \sigma^2+1\right)/2$$

Where:
• $\hat \sigma$ is the standard deviation of the residuals.
11. The maximum likelihood estimation (MLE) is a statistical method for fitting a model to the data and provides estimates for the model's parameters.
12. The long-run mean can take any value or be omitted, in which case a zero value is assumed.
13. The residuals/innovations standard deviation (sigma) must be greater than zero.
14. For the input argument (beta):
• The input argument is optional and can be omitted, in which case no regression component is included (i.e. plain ARMA).
• The order of the parameters defines how the exogenous factor input arguments are passed.
• One or more parameters may have missing values or error codes (i.e. #NUM!, #VALUE!, etc.).
15. For the input argument (phi):
• The input argument is optional and can be omitted, in which case no AR component is included.
• The order of the parameters starts with the lowest lag.
• One or more parameters may have missing values or error codes (i.e. #NUM!, #VALUE!, etc.).
• The order of the AR component model is solely determined by the order of the last value in the array with a numeric value (vs. missing or error).
16. For the input argument (theta):
• The input argument is optional and can be omitted, in which case no MA component is included.
• The order of the parameters starts with the lowest lag.
• One or more values in the input argument can be missing or an error code (i.e. #NUM!, #VALUE!, etc.).
• The order of the MA component model is solely determined by the order of the last value in the array with a numeric value (vs. missing or error).
17. The function was added in version 1.63 SHAMROCK.