INNOVATIONS_MLE
This function estimates parameters of a SARIMA specification by maximizing the likelihood using the innovations algorithm.
The model order is controlled by non-seasonal (p,d,q) and seasonal (P,D,Q,s) components. The estimation method enforces stationarity and can enforce invertibility constraints for moving-average terms.
The result is returned as a row vector of estimated parameter values.
Excel Usage
=INNOVATIONS_MLE(endog, p, d, q, seasonal_p, seasonal_d, seasonal_q, seasonal_s, demean, enforce_invertibility)
endog(list[list], required): Time-series observations as a 2D range (data points).p(int, optional, default: 0): Non-seasonal autoregressive order (lags).d(int, optional, default: 0): Non-seasonal differencing order (differences).q(int, optional, default: 0): Non-seasonal moving-average order (lags).seasonal_p(int, optional, default: 0): Seasonal autoregressive order (lags).seasonal_d(int, optional, default: 0): Seasonal differencing order (differences).seasonal_q(int, optional, default: 0): Seasonal moving-average order (lags).seasonal_s(int, optional, default: 0): Seasonal period length (periods).demean(bool, optional, default: true): Whether to remove the mean before estimation (true/false).enforce_invertibility(bool, optional, default: true): Whether to enforce invertibility constraints (true/false).
Returns (list[list]): Row vector containing estimated SARIMA parameter values.
Example 1: Innovations MLE for ARMA(1,1)
Inputs:
| endog | p | d | q | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 10 | 10.5 | 11.2 | 10.9 | 11.5 | 12 | 11.8 | 12.3 | 12.1 | 12.7 | 1 | 0 | 1 |
Excel formula:
=INNOVATIONS_MLE({10,10.5,11.2,10.9,11.5,12,11.8,12.3,12.1,12.7}, 1, 0, 1)
Expected output:
| Result | ||
|---|---|---|
| 0.906275 | -0.045126 | 0.231343 |
Example 2: Innovations MLE for AR(1)
Inputs:
| endog | p | d | q | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 4 | 4.4 | 4.1 | 4.6 | 4.3 | 4.8 | 4.5 | 5 | 4.7 | 5.1 | 1 | 0 | 0 |
Excel formula:
=INNOVATIONS_MLE({4,4.4,4.1,4.6,4.3,4.8,4.5,5,4.7,5.1}, 1, 0, 0)
Expected output:
| Result | |
|---|---|
| 0.239045 | 0.113806 |
Example 3: Innovations MLE for MA(1)
Inputs:
| endog | p | d | q | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 7 | 6.9 | 7.2 | 7.1 | 7.4 | 7.3 | 7.6 | 7.5 | 7.7 | 7.8 | 0 | 0 | 1 |
Excel formula:
=INNOVATIONS_MLE({7,6.9,7.2,7.1,7.4,7.3,7.6,7.5,7.7,7.8}, 0, 0, 1)
Expected output:
| Result | |
|---|---|
| 0.433657 | 0.0600301 |
Example 4: Innovations MLE without demeaning
Inputs:
| endog | p | d | q | demean | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2 | 2.2 | 2.5 | 2.7 | 2.9 | 3.1 | 3 | 3.3 | 3.5 | 3.6 | 1 | 0 | 1 | false |
Excel formula:
=INNOVATIONS_MLE({2,2.2,2.5,2.7,2.9,3.1,3,3.3,3.5,3.6}, 1, 0, 1, FALSE)
Expected output:
| Result | ||
|---|---|---|
| 0.996018 | 0.413066 | 0.0338986 |
Python Code
import numpy as np
from statsmodels.tsa.arima.model import innovations_mle as sm_innovations_mle
def innovations_mle(endog, p=0, d=0, q=0, seasonal_p=0, seasonal_d=0, seasonal_q=0, seasonal_s=0, demean=True, enforce_invertibility=True):
"""
Estimate SARIMA parameters using innovations maximum likelihood.
See: https://www.statsmodels.org/stable/generated/statsmodels.tsa.arima.model.innovations_mle.html
This example function is provided as-is without any representation of accuracy.
Args:
endog (list[list]): Time-series observations as a 2D range (data points).
p (int, optional): Non-seasonal autoregressive order (lags). Default is 0.
d (int, optional): Non-seasonal differencing order (differences). Default is 0.
q (int, optional): Non-seasonal moving-average order (lags). Default is 0.
seasonal_p (int, optional): Seasonal autoregressive order (lags). Default is 0.
seasonal_d (int, optional): Seasonal differencing order (differences). Default is 0.
seasonal_q (int, optional): Seasonal moving-average order (lags). Default is 0.
seasonal_s (int, optional): Seasonal period length (periods). Default is 0.
demean (bool, optional): Whether to remove the mean before estimation (true/false). Default is True.
enforce_invertibility (bool, optional): Whether to enforce invertibility constraints (true/false). Default is True.
Returns:
list[list]: Row vector containing estimated SARIMA parameter values.
"""
try:
def to2d(x):
return [[x]] if not isinstance(x, list) else x
endog = to2d(endog)
if not isinstance(endog, list) or not all(isinstance(row, list) for row in endog):
return "Error: Invalid input - endog must be a 2D list"
series = []
for row in endog:
for value in row:
try:
series.append(float(value))
except (TypeError, ValueError):
continue
if len(series) < 6:
return "Error: endog must contain at least 6 numeric values"
params, _ = sm_innovations_mle(
series,
order=(int(p), int(d), int(q)),
seasonal_order=(int(seasonal_p), int(seasonal_d), int(seasonal_q), int(seasonal_s)),
demean=bool(demean),
enforce_invertibility=bool(enforce_invertibility)
)
if hasattr(params, "params"):
values = np.asarray(params.params, dtype=float).ravel()
elif hasattr(params, "to_array"):
values = np.asarray(params.to_array(), dtype=float).ravel()
else:
values = np.asarray(params, dtype=float).ravel()
return [values.tolist()]
except Exception as e:
return f"Error: {str(e)}"Online Calculator
Time-series observations as a 2D range (data points).
Non-seasonal autoregressive order (lags).
Non-seasonal differencing order (differences).
Non-seasonal moving-average order (lags).
Seasonal autoregressive order (lags).
Seasonal differencing order (differences).
Seasonal moving-average order (lags).
Seasonal period length (periods).
Whether to remove the mean before estimation (true/false).
Whether to enforce invertibility constraints (true/false).