Tutorials › Econometrics (Graduate) › Numerical Maximum Likelihood with ARMA Constraints

ARMA Estimation and Forecasting · Tutorial 372 of 952

Numerical Maximum Likelihood with ARMA Constraints

Build a constrained ARMA likelihood optimization workflow, from stable parameter transformations to gradient and multi-start convergence checks.

Intermediate 10 min read

What You'll Learn

  • Define a likelihood objective from recursively computed ARMA innovations.
  • Profile out the innovation variance when the residual sum of squares is positive.
  • Transform unconstrained optimizer coordinates into causal and invertible ARMA parameters.
  • Use moment-based estimates and multiple starts to initialize optimization.
  • Check gradients, constraints, and competing solutions before accepting a fit.

Why Numerical Optimization Needs Care

An ARMA likelihood is a function of several parameters whose effects interact: changing an autoregressive coefficient changes the innovations, and changing a moving-average coefficient changes them again. A numerical optimizer can search this function, but an unconstrained search may propose coefficients that violate causality or invertibility. Even when every candidate is admissible, a poor starting point or an inadequately checked stopping rule can produce an unreliable result.

The goal here is a practical and mathematically controlled workflow. We define the likelihood being optimized, map unconstrained numerical coordinates to valid ARMA parameters, choose starting values, and check whether an apparent optimum is credible. The worked calculations use a conditional Gaussian likelihood with a specified initial-value approximation; the same optimization principles apply when the likelihood is evaluated by the innovations algorithm.

Model and Objective Function

Use the lag-polynomial convention \(y_t-\mu=\phi(B)^{-1}\theta(B)\varepsilon_t\), where \(\phi(B)=1-\phi_1B-\cdots-\phi_pB^p\) and \(\theta(B)=1+\theta_1B+\cdots+\theta_qB^q\). The innovations satisfy \(\varepsilon_t\sim N(0,\sigma^2)\). The usual likelihood interpretation assumes Gaussian innovations; a conditional Gaussian likelihood is also a useful objective when Gaussianity is treated as a working assumption. Causality requires the roots of \(\phi(z)\) to lie outside the unit circle, and invertibility requires the roots of \(\theta(z)\) to lie outside it.

For a conditional likelihood, fix an initialization rule for the unobserved initial values and compute innovations recursively. Write the resulting residuals as \(e_1,\ldots,e_m\), with \(m\) the number of contributions included in the chosen conditional objective. Conditional on the initialization, the Gaussian log-likelihood is

$$ \ell(\boldsymbol\beta,\sigma^2) =-\frac{m}{2}\log(2\pi\sigma^2) -\frac{1}{2\sigma^2}\sum_{t=1}^{m}e_t(\boldsymbol\beta)^2, $$

where \(\boldsymbol\beta\) collects the mean and ARMA coefficients. For fixed coefficients, let \(S(\boldsymbol\beta)=\sum_{t=1}^{m}e_t(\boldsymbol\beta)^2\). If \(S(\boldsymbol\beta)>0\), maximizing over positive \(\sigma^2\) gives \(\widehat{\sigma}^2=S(\boldsymbol\beta)/m\). Substitution yields a profiled likelihood, so maximizing it over the ARMA coefficients is equivalent to minimizing \(S(\boldsymbol\beta)\). If \(S(\boldsymbol\beta)=0\), this formula does not apply: the likelihood increases without bound as \(\sigma^2\downarrow0\), and there is no positive-variance maximum-likelihood estimate at those coefficients.

Definition: A constrained numerical maximum-likelihood estimate is a parameter value that maximizes the specified likelihood over the admissible parameter region. In practice, an optimizer searches numerical coordinates; a valid implementation must ensure that the corresponding ARMA coefficients satisfy the model's causality and invertibility constraints.

Transforming Parameters to Preserve Stability

For AR(1), causality requires \(|\phi_1|<1\). An unconstrained coordinate \(\eta\in\mathbb R\) can be mapped into this interval by \(\phi_1=\tanh(\eta)\). The map is smooth and one-to-one, with derivative \(d\phi_1/d\eta=1-\tanh^2(\eta)\). It guarantees an admissible coefficient for every finite \(\eta\).

For higher orders, independently applying \(\tanh\) to each ordinary AR coefficient is not sufficient: the stationary region is jointly constrained. One standard approach uses reflection coefficients \(\kappa_j\in(-1,1)\). In one common recursion, begin with the order-one coefficient \(\phi_{1,1}=\kappa_1\), then construct coefficients at order \(r\) by \(\phi_{r,r}=\kappa_r\) and \(\phi_{r,j}=\phi_{r-1,j}-\kappa_r\phi_{r-1,r-j}\), for \(j=1,\ldots,r-1\). This parameterization maps the reflection coefficients into a causal AR polynomial. Set each \(\kappa_j=\tanh(\eta_j)\) to give the optimizer unconstrained coordinates. For the MA polynomial under the convention above, apply the same stable-polynomial construction to coefficients \(a_j=-\theta_j\), then set \(\theta_j=-a_j\); this enforces invertibility.

A variance parameter can be represented as \(\sigma^2=\exp(\lambda)\), which ensures positivity. If the variance is profiled out analytically, however, there is no need for the optimizer to search over \(\lambda\). These transformations re-express the likelihood optimization; they do not add a Jacobian term to a maximum-likelihood objective.

Worked Example: Mapping an AR(1) Starting Value

Suppose a hypothetical zero-mean series has observations \(y=(0.8,0.4,-0.1,0.2)\). Use the conditional initial-value approximation \(e_1=y_1\) and \(e_t=y_t-\phi_1y_{t-1}\) for \(t=2,3,4\). Start the optimizer at \(\eta=-1\).

The transformation gives \(\phi_1=\tanh(-1)\approx-0.761594\), which satisfies the AR(1) causality condition \(|\phi_1|<1\). The recursively computed residuals are

$$ e_1=0.8,\qquad e_2=0.4-(-0.761594)(0.8)=1.009275,\qquad e_3=-0.1-(-0.761594)(0.4)=0.204638, $$
$$ e_4=0.2-(-0.761594)(-0.1)=0.123841. $$

Thus the sum of squares is \(S=0.8^2+1.009275^2+0.204638^2+0.123841^2\approx1.71585\). Because this is positive, the profiled variance estimate at this coefficient is \(\widehat{\sigma}^2=1.71585/4\approx0.42896\), in squared units of the series. This calculation checks both the transformation and the residual recursion; a sign error in the final AR term would change the objective supplied to the optimizer.

Starting Values, Gradients, and Stopping Checks

Starting values should be plausible, not merely convenient. Moment estimates can provide an initial ARMA approximation, and a simpler nested model can supply additional candidate starts. For a particular data set, use more than one start when feasible: a small grid of plausible values, perturbations around a moment estimate, or a combination of these. Transform every start into the optimizer's unconstrained coordinates. If the mean is estimated, initialize it with a sensible estimate of the series level, and keep its treatment consistent across evaluations.

Gradient-based algorithms use derivatives of the objective to propose improvements. Derivatives can be computed analytically, by automatic differentiation, or by carefully checked finite differences. Scaling matters: a poorly scaled objective or parameter can lead to small numerical steps even when a meaningful improvement remains. After optimization, do not rely solely on a software message saying “converged.” Check that the objective is finite, the transformed coefficients map to admissible values, and the gradient is small at the reported solution. When using transformed parameters, also inspect the gradient with respect to the original coefficients where practical. Near a transformation boundary, the derivative of \(\tanh(\eta)\) is close to zero, so a small transformed-coordinate gradient alone may be misleading.

For several starts, compare the final objective values and parameter values. Similar best objective values with materially different parameters can indicate a flat region or competing solutions; a substantially worse endpoint suggests that a run found a poorer optimum. Restarting from the best candidate, tightening tolerances, or checking derivatives can help distinguish numerical trouble from a genuine feature of the likelihood. The goal is not to claim global optimality from a single run, but to gather evidence that the reported solution is stable and best among the candidates examined.

Worked Example: Profiling the AR(1) Objective

Continue with the hypothetical observations and initialization above. As a function of \(\phi_1\), the objective is

$$ S(\phi_1)=0.8^2+(0.4-0.8\phi_1)^2+(-0.1-0.4\phi_1)^2+(0.2+0.1\phi_1)^2. $$

Differentiating and setting the derivative to zero gives \(\widehat\phi_1=\sum_{t=2}^4y_ty_{t-1}/\sum_{t=2}^4y_{t-1}^2\). Substituting the data,

$$ \widehat\phi_1= \frac{(0.4)(0.8)+(-0.1)(0.4)+(0.2)(-0.1)} {0.8^2+0.4^2+(-0.1)^2} =\frac{0.26}{0.81}\approx0.320988. $$

This estimate is causal because its absolute value is less than one. The residuals are approximately \(0.8,\ 0.143210,\ -0.228395,\ 0.232099\), giving \(S(\widehat\phi_1)\approx0.76654\). Consequently, the profiled variance is approximately \(0.76654/4=0.19164\), in squared series units. This closed-form result is a useful check on a numerical AR(1) implementation. In a general ARMA model, the residuals depend nonlinearly on the parameters, so the objective usually requires numerical optimization.

Worked Example: Comparing Multiple Starts

For the same conditional AR(1) objective, compare three hypothetical starts in the transformed coordinate: \(\eta=-1,0,1\). Their coefficients are approximately \(-0.761594,0,0.761594\). The corresponding sums of squares, calculated from the objective above, are approximately \(1.71585,\ 0.85000,\ 0.92379\). These are starting-point values, not estimates of the optimum.

Suppose each run is allowed to optimize the same objective and parameterization. Since this particular objective is a quadratic in \(\phi_1\), its unconstrained minimum is the value calculated in the previous example, \(0.320988\), which is inside the causal interval. A well-converged run from each of the three starts should therefore approach that coefficient and \(S\approx0.76654\). In a higher-order ARMA problem, those outcomes are not guaranteed: compare the actual final objective values, check admissibility and gradients, and rerun any suspicious endpoint. Agreement across starts supports the numerical result but is not a proof that no better solution exists elsewhere.

A Short Justification for Profiling the Variance

For fixed coefficients with \(S>0\), differentiate the log-likelihood with respect to \(\sigma^2\):

$$ \frac{\partial\ell}{\partial\sigma^2} =-\frac{m}{2\sigma^2}+\frac{S}{2(\sigma^2)^2}. $$

Setting this derivative to zero gives \(m\sigma^2=S\), hence \(\widehat{\sigma}^2=S/m\). The second derivative at that value is negative, so it is a maximum. If \(S=0\), the log-likelihood is \(-\frac{m}{2}\log(2\pi\sigma^2)\), which tends to \(+\infty\) as \(\sigma^2\downarrow0\); there is then no finite maximizer with positive variance. This is why the positive-sum-of-squares condition is essential when profiling.

Common Pitfalls and Practical Interpretation

Numerical optimization is part of statistical modeling, not a black box that makes the modeling decisions automatically. In particular, the likelihood must correspond to a declared initialization or exact-likelihood calculation, and all runs being compared must use the same definition.

  • Bounding each ordinary coefficient separately. Having every coefficient between \(-1\) and \(1\) does not generally make a higher-order AR or MA polynomial stable. Use a parameterization designed to enforce the joint root constraints, and verify the resulting roots or equivalent stability conditions.
  • Trusting a single start or a status message. One successful-looking run does not rule out a better candidate or a numerical failure. Compare starts and objective values, inspect gradients, and verify that the result is admissible.
  • Using the wrong sign in the residual recursion. Under the stated lag-polynomial convention, AR(1) residuals are \(e_t=y_t-\phi_1y_{t-1}\). Substituting a negative coefficient requires careful sign handling; compute residuals directly from the model before evaluating the likelihood.
  • Applying the variance formula when the residual sum of squares is zero. The formula \(S/m\) is the positive-variance MLE only for \(S>0\). At zero residual sum of squares the likelihood is unbounded as the variance approaches zero.
Key takeaway: A credible numerical ARMA maximum-likelihood fit combines a clearly specified likelihood, a stability-preserving parameterization, defensible starting values, and explicit checks of the final objective, gradient, and admissibility.

Check Your Understanding

Answer these questions using the definitions and procedures in this tutorial.

  1. Why does the transformation \(\phi_1=\tanh(\eta)\) guarantee causality for an AR(1) model?
  2. For fixed ARMA coefficients, under what condition is \(S/m\) the Gaussian maximum-likelihood estimate of \(\sigma^2\), and what happens if \(S=0\)?
  3. Why is it unsafe to constrain each coefficient of an AR(2) model independently to \((-1,1)\)?
  4. What evidence can be obtained by optimizing the same likelihood from several starting values?
  5. Why can a small gradient in transformed coordinates require additional checking near a parameter boundary?
Clinical Biostats