Example 2: ARMA

The data for this example are the same as that for Example 1. Preliminary method of moments estimates are computed by default, and the method of least squares is used to find the final estimates. Note that at the end of the output, a warning message appears. In most cases, this warning message can be ignored. There are three general reasons this warning can occur:

  1. Convergence is declared using the criterion based on tolerance, but the gradient of the residual sum-of-squares function is nonzero. This occurs in this example. Either the message can be ignored or ConvergenceTolerance can be reduced to allow more iterations and a slightly more accurate solution.
  2. Convergence is declared based on the fact that a very small step was taken, but the gradient of the residual sum-of-squares function was nonzero. This message can usually be ignored. Sometimes, however, the algorithm is making very slow progress and is not near a minimum.
  3. Convergence is not declared after 100 iterations.

Trying a smaller value for ConvergenceTolerance can help determine what caused the error message.

using System;
using Imsl.Stat;
using PrintMatrix = Imsl.Math.PrintMatrix;

public class ARMAEx2
{
    public static void  Main(String[] args)
    {
        double[] arInit = new double[]{1.24426e0, - 5.75149e-1};
        double[] maInit = new double[]{- 1.24094e-1};
        double[] z = new double[]{  100.8, 81.6, 66.5, 34.8, 30.6, 
                                     7, 19.8, 92.5, 154.4, 125.9, 
                                     84.8, 68.1, 38.5, 22.8, 10.2,
                                     24.1, 82.9, 132, 130.9, 118.1, 
                                     89.9, 66.6, 60, 46.9, 41,
                                     21.3, 16, 6.4, 4.1, 6.8,
                                     14.5, 34, 45, 43.1, 47.5, 
                                     42.2, 28.1, 10.1, 8.1, 2.5, 
                                     0, 1.4, 5, 12.2, 13.9, 
                                     35.4, 45.8, 41.1, 30.4, 23.9, 
                                     15.7, 6.6, 4, 1.8, 8.5,
                                     16.6, 36.3, 49.7, 62.5, 67,
                                     71, 47.8, 27.5, 8.5, 13.2, 
                                     56.9, 121.5, 138.3, 103.2, 85.8, 
                                     63.2, 36.8, 24.2, 10.7, 15, 
                                     40.1, 61.5, 98.5, 124.3, 95.9, 
                                     66.5, 64.5, 54.2, 39, 20.6, 
                                     6.7, 4.3,  22.8, 54.8, 93.8,
                                     95.7, 77.2, 59.1, 44, 47,  
                                     30.5, 16.3, 7.3, 37.3, 73.9};
        
        ARMA arma = new ARMA(2, 1, z);
        arma.Method = Imsl.Stat.ARMA.ParamEstimation.LeastSquares;
        arma.SetInitialEstimates(arInit, maInit);
        arma.ConvergenceTolerance = 0.125;
        arma.Mean = 46.976;
        arma.Compute();
        
        new PrintMatrix("AR estimates are:  ").Print(arma.GetAR());
        Console.Out.WriteLine();
        new PrintMatrix("MA estimate is:  ").Print(arma.GetMA());
    }
}

Output

  AR estimates are:  
           0           
0   1.39325700313638   
1  -0.733660553488482  


   MA estimate is:  
           0           
0  -0.137145395974998  

Imsl.Stat.ARMA: Relative function convergence - Both the scaled actual and 
predicted reductions in the function are less than or equal to the relative 
function convergence tolerance "ConvergenceTolerance" = 0.0645856533065147.
Imsl.Stat.ARMA: Least squares estimation of the parameters has failed to 
converge.  Increase "length" and/or "tolerance" and/or "convergence_tolerance".  
The estimates of the parameters at the last iteration may be used as new 
starting values.

Link to C# source.