ISlARMA.MARootsIm

Fore Syntax

MARootsIm: Array;

Fore.NET Syntax

MARootsIm: System.Array;

Description

The MARootsIm property returns values of the imaginary part of MA process characteristic roots.

Comments

To get values of the real part of MA process characteristic roots, use the ISlARMA.MARootsRe property.

Fore Example

To execute the example, add a link to the Stat system assembly.

Sub UserProc;
Var
    lr: ISmLinearRegress;
    x: Array[30Of Double;
    Intercept: IIntercept;
    res, i: Integer;
    d: Double;
    CoefficientsMa, CoefficientsSMA: ICoefficients;
Begin
    lr := New SmLinearRegress.Create;
    // Values of explained series:
    x[0]:=0.00576;  x[1]:=0.0078;    x[2]:=0.00851;   x[3]:=0.00691;
    x[4]:=0.00585;  x[5]:=0.00127;   x[6]:=-0.00431;  x[7]:=0.00305;
    x[8]:=0.00455;  x[9]:=0.00829;   x[10]:=0.01095;  x[11]:=0.0042;
    x[12]:=0.00172; x[13]:=0.00221;  x[14]:=0.00685;  x[15]:=0.00317;
    x[16]:=0.00073; x[17]:=0.00267;  x[18]:=0.00073;  x[19]:=0.00218;
    x[20]:=0.0041;  x[21]:=-0.00144; x[22]:=-0.00507; x[23]:=0.00964;
    x[24]:=0.00455; x[25]:=0.00334;  x[26]:=0.00166;  x[27]:=0.00781;
    x[28]:=0.01055; x[29]:=0.00512;
    lr.Explained.Value := x;
    // Sample period:
    lr.ModelPeriod.FirstPoint := 1;
    lr.ModelPeriod.LastPoint := 20;
    lr.Forecast.LastPoint := 30;
    // A constant will be used in the model:
    Intercept:= lr.ModelCoefficients.Intercept;
    Intercept.Mode := InterceptMode.ManualEstimate;
    // ARIMA options:
    lr.ARMA.ParseMA("3");
    lr.ARMA.ParseMASeas("2");
    // Method of initial approximations detection:
    lr.ARMA.CalcInitMode := ARMAInitType.Auto;
    // Optimization method:
    lr.ARMA.EstimationMethod := ARMAEstimationMethodType.GaussNewton;
    // Number of iterations and accuracy for optimization method:
    lr.ARMA.MaxIteration := 500;
    lr.ARMA.Tolerance := 0.000100;
    // Calculate model:
    res := lr.Execute;
    If (res = 0Then
        Debug.WriteLine("===Estimates of moving average coefficients===");
        CoefficientsMA := lr.ARMA.CoefficientsMA;
        For i:=0 To  CoefficientsMA.Estimate.Length-1 Do
            d := CoefficientsMA.Estimate[i];
            Debug.WriteLine("Value: " + d0.ToString);
            d := CoefficientsMA.StandardError[i];
            Debug.WriteLine("Standard error: " + d.ToString);
            d := CoefficientsMA.TStatistic[i];
            Debug.WriteLine("t-statistic: " + d.ToString);
            d := CoefficientsMA.Probability[i];
            Debug.WriteLine("Probability: " + d.ToString);
        End For;
        Debug.WriteLine("===Estimates of moving average coefficients===");
        CoefficientsSMA := lr.ARMA.CoefficientsMASeas;
        For i:=0 To  CoefficientsSMA.Estimate.Length-1 Do
            d := CoefficientsSMA.Estimate[i];
            Debug.WriteLine("Value: " + d0.ToString);
            d := CoefficientsSMA.StandardError[i];
            Debug.WriteLine("Standard error: " + d.ToString);
            d := CoefficientsSMA.TStatistic[i];
            Debug.WriteLine("t-statistic: " + d.ToString);
            d := CoefficientsSMA.Probability[i];
            Debug.WriteLine("Probability: " + d.ToString);
        End For;
        //Characteristicroo ts:
        Debug.WriteLine("MA roots:");   
        For i:=0 To lr.ARMA.MARootsRe.Length-1 Do
            Debug.WriteLine((lr.ARMA.MARootsRe[i] As Double).ToString + " + " + (lr.ARMA.MARootsIm[i] As Double).ToString + "i");
        End For;
        Else
            Debug.WriteLine(lr.Errors);
    End If
End Sub UserProc;

After executing the example the console window displays estimates of moving average coefficients and MA roots.

Fore.NET Example

The requirements and result of the Fore.NET example execution match with those in the Fore example.

Imports Prognoz.Platform.Interop.Stat;

Public Shared Sub Main(Params: StartParams);
Var
    lr: ISmLinearRegress;
    x: Array[30Of Double;
    Intercept: IIntercept;
    res, i: Integer;
    CoefficientsMa, CoefficientsSMA: ICoefficients;
    d, RootsRe, RootsIm: System.Array;
Begin
    lr := New SmLinearRegress.Create();
    // Values of explained series:
    x[0]:=0.00576;  x[1]:=0.0078;    x[2]:=0.00851;   x[3]:=0.00691;
    x[4]:=0.00585;  x[5]:=0.00127;   x[6]:=-0.00431;  x[7]:=0.00305;
    x[8]:=0.00455;  x[9]:=0.00829;   x[10]:=0.01095;  x[11]:=0.0042;
    x[12]:=0.00172; x[13]:=0.00221;  x[14]:=0.00685;  x[15]:=0.00317;
    x[16]:=0.00073; x[17]:=0.00267;  x[18]:=0.00073;  x[19]:=0.00218;
    x[20]:=0.0041;  x[21]:=-0.00144; x[22]:=-0.00507; x[23]:=0.00964;
    x[24]:=0.00455; x[25]:=0.00334;  x[26]:=0.00166;  x[27]:=0.00781;
    x[28]:=0.01055; x[29]:=0.00512;
    lr.Explained.Value := x;    
    // Sample period:
    lr.ModelPeriod.FirstPoint := 1;
    lr.ModelPeriod.LastPoint := 20;
    lr.Forecast.LastPoint := 30;
    // A constant will be used in the model:
    Intercept:= lr.ModelCoefficients.Intercept;
    Intercept.Mode := InterceptMode.imManualEstimate;
    // ARIMA options:
    lr.ARMA.ParseMA("3"True); 
    lr.ARMA.ParseMASeas("2"True);
    // Method of initial approximations detection:
    lr.ARMA.CalcInitMode := ARMAInitType.armaitAuto;
    // Optimization method:
    lr.ARMA.EstimationMethod := ARMAEstimationMethodType.armaemtGaussNewton;
    // Number of iterations and accuracy for optimization method:
    lr.ARMA.MaxIteration := 500;
    lr.ARMA.Tolerance := 0.000100;
    // Calculate model:
    res := lr.Execute();
    If (res = 0Then
        System.Diagnostics.Debug.WriteLine("===Estimates of moving average coefficients===");
        CoefficientsMA := lr.ARMA.CoefficientsMA;
        For i:=0 To  CoefficientsMA.Estimate.Length-1 Do
            d := CoefficientsMA.Estimate;
            System.Diagnostics.Debug.WriteLine("Value: " + d[i].ToString());
            d := CoefficientsMA.StandardError;
            System.Diagnostics.Debug.WriteLine("Standard error: " + d[i].ToString());
            d := CoefficientsMA.TStatistic;
            System.Diagnostics.Debug.WriteLine("t-statistic: " + d[i].ToString());
            d := CoefficientsMA.Probability;
            System.Diagnostics.Debug.WriteLine("Probability: " + d[i].ToString());
        End For;
        System.Diagnostics.Debug.WriteLine("===Estimates of seasonal moving average coefficients===");
        CoefficientsSMA := lr.ARMA.CoefficientsMASeas;
        For i:=0 To  CoefficientsSMA.Estimate.Length-1 Do
            d := CoefficientsSMA.Estimate;
            System.Diagnostics.Debug.WriteLine("Value: " + d[i].ToString());
            d := CoefficientsSMA.StandardError;
            System.Diagnostics.Debug.WriteLine("Standard error: " + d[i].ToString());
            d := CoefficientsSMA.TStatistic;
            System.Diagnostics.Debug.WriteLine("t-statistic: " + d[i].ToString());
            d := CoefficientsSMA.Probability;
            System.Diagnostics.Debug.WriteLine("Probability: " + d[i].ToString());
        End For;
        //Characteristicroo ts:
        System.Diagnostics.Debug.WriteLine("MA roots:");
        RootsRe := lr.ARMA.MARootsRe;
        RootsIm := lr.ARMA.MARootsIm;
        For i:=0 To lr.ARMA.MARootsRe.Length-1 Do
            System.Diagnostics.Debug.WriteLine((RootsRe[i] As Double).ToString() + " + " + (RootsIm[i] As Double).ToString() + "i");
        End For;
        Else
            System.Diagnostics.Debug.WriteLine(lr.Errors);
    End If;     
End Sub;

See also:

ISlARMA