ISlARMA.CoefficientsARSeas

Fore Syntax

CoefficientsARSeas: ICoefficients;

Fore.NET Syntax

CoefficientsARSeas: Prognoz.Platform.Interop.Stat.ICoefficients;

Description

The CoefficientsARSeas property returns seasonal autoregression coefficients.

Comments

The coefficients are estimated if the order of seasonal autoregression is defined in ISlARMA.OrderARSeas.

Fore Example

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

Sub UserProc;
Var
    lr: ISmLinearRegress;
    W: Array[20Of Double;
    ARMA: ISlARMA;
    Inits: Array[2Of Double;
    res: Integer;
    d: Double;
    CoefficientsAR, CoefficientsMA: ICoefficients;
    ModelCoefficients: IModelCoefficients;
    i: Integer;
    Forecast: Array Of Double;
Begin
    lr := New SmLinearRegress.Create;
// explained series values
    w[0] := 2; w[4] := -1.9; w[8] := -0.7; w[12] := 5.4; w[16] := 2.8;
    w[1] := 0.8; w[5] := Double.Nan; w[9] := Double.Nan; w[13] := 6.4;w[17] := 0.8;
    w[2] := -0.3; w[6] := 3.2; w[10] := 4.3; w[14] := 7.4; w[18] := -0.7;
    w[3] := -0.3; w[7] := 1.6; w[11] := 1.1;w[15] := 2;w[19] := Double.Nan;
// Sample period
    lr.ModelPeriod.FirstPoint := 1;
    lr.ModelPeriod.LastPoint := 13;
    lr.Forecast.LastPoint := 19;
    lr.MissingData.Method := MissingDataMethod.AnyValue;
    lr.Explained.Value := w;
    ModelCoefficients := lr.ModelCoefficients;
// a constant is used in the model
    ModelCoefficients.Intercept.Mode := InterceptMode.AutoEstimate;
    ARMA := lr.ARMA;
// seasonal autoregression order
    ARMA.ParseARSeas("1");
// seasonal moving average order

    ARMA.ParseMASeas("1");
// seasonal  autoregression initial approximations
    Inits[0] := 0.0025;
    ARMA.InitARSeas := Inits;
// initial approximations of seasonal moving average
    Inits[0] := 0.0035;
    ARMA.InitMASeas := Inits;
// seasonal difference
    ARMA.DiffSeas := 0;
// seasonality period
    ARMA.PeriodSeas := 4;
// difference
    ARMA.Diff := 2;
// optimization method
    ARMA.EstimationMethod := ARMAEstimationMethodType.LevenbergMarquardt;
// model calculation
    res := lr.Execute;
    Debug.WriteLine(lr.Errors);
    If (res = 0Then
    // forecast values
        Forecast := lr.Forecast.Value;
        Debug.WriteLine("Forecast values:"); Debug.Indent;
        For i := 0 To Forecast.Length - 1 Do
            Debug.WriteLine(Forecast[i]);
        End For;
        Debug.Unindent;
    // seasonal autoregression coefficients
        Debug.WriteLine("Seasonal autoregression coefficients' estimates");
        CoefficientsAR := ARMA.CoefficientsARSeas;
        d := CoefficientsAR.Estimate[0];
        Debug.WriteLine(" Value: " + d.ToString);
        d := CoefficientsAR.Probability[0];
        Debug.WriteLine(" Probability: " + d.ToString);
    // seasonal moving average coefficients
        Debug.WriteLine("Seasonal moving average coefficients' estimates");
        CoefficientsMA := ARMA.CoefficientsMASeas;
        d := CoefficientsMA.Estimate[0];
        Debug.WriteLine(" Value: " + d.ToString);
        d := CoefficientsMA.Probability[0];
        Debug.WriteLine(" Probability: " + d.ToString);
    End If;
End Sub UserProc;

After executing the example a linear regression model is created and its parameters are defined. Seasonal autoregression and seasonal moving average orders are to be parsed from string representation. The console window displays forecast values and estimates of model coefficients.

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 UserProc();
Var
    lr: ISmLinearRegress;
    W: Array[20Of Double;
    ARMA: ISlARMA;
    Inits: Array[2Of Double;
    res: Integer;
    d: Double;
    CoefficientsAR, CoefficientsMA: ICoefficients;
    ModelCoefficients: IModelCoefficients;
    i: Integer;
    Forecast: System.Array;
Begin
    lr := New SmLinearRegress.Create();
// explained series values
    w[0] := 2; w[4] := -1.9; w[8] := -0.7; w[12] := 5.4; w[16] := 2.8;
    w[1] := 0.8; w[5] := Double.Nan; w[9] := Double.Nan; w[13] := 6.4;w[17] := 0.8;
    w[2] := -0.3; w[6] := 3.2; w[10] := 4.3; w[14] := 7.4; w[18] := -0.7;
    w[3] := -0.3; w[7] := 1.6; w[11] := 1.1;w[15] := 2;w[19] := Double.Nan;
// Sample period
    lr.ModelPeriod.FirstPoint := 1;
    lr.ModelPeriod.LastPoint := 13;
    lr.Forecast.LastPoint := 19;
    lr.MissingData.Method := MissingDataMethod.mdmAnyValue;
    lr.Explained.Value := w;
    ModelCoefficients := lr.ModelCoefficients;
// a constant is used in the model
    ModelCoefficients.Intercept.Mode := InterceptMode.imAutoEstimate;
    ARMA := lr.ARMA;
// seasonal autoregression order
    ARMA.ParseARSeas("1"True);
// seasonal moving average order

    ARMA.ParseMASeas("1"True);
// seasonal  autoregression initial approximations
    Inits[0] := 0.0025;
    ARMA.InitARSeas := Inits;
// initial approximations of seasonal moving average
    Inits[0] := 0.0035;
    ARMA.InitMASeas := Inits;
// seasonal difference
    ARMA.DiffSeas := 0;
// seasonality period
    ARMA.PeriodSeas := 4;
// difference
    ARMA.Diff := 2;
// optimization method
    ARMA.EstimationMethod := ARMAEstimationMethodType.armaemtLevenbergMarquardt;
// model calculation
    res := lr.Execute();
    System.Diagnostics.Debug.WriteLine(lr.Errors);
    If (res = 0Then
    // forecast values
        Forecast := lr.Forecast.Value;
        System.Diagnostics.Debug.WriteLine("Forecast values:"); System.Diagnostics.Debug.Indent();
        For i := 0 To Forecast.Length - 1 Do
            System.Diagnostics.Debug.WriteLine(Forecast[i]);
        End For;
        System.Diagnostics.Debug.Unindent();
    // seasonal autoregression coefficients
        System.Diagnostics.Debug.WriteLine("Estimates of seasonal autoregression coefficients");
        CoefficientsAR := ARMA.CoefficientsARSeas;
        d := CoefficientsAR.Estimate.GetValue(0As double;
        System.Diagnostics.Debug.WriteLine(" Value: " + d.ToString());
        d := CoefficientsAR.Probability.GetValue(0As double;
        System.Diagnostics.Debug.WriteLine(" Probability: " + d.ToString());
    // seasonal moving average coefficients
        System.Diagnostics.Debug.WriteLine("Estimates of seasonal moving average coefficients");
        CoefficientsMA := ARMA.CoefficientsMASeas;
        d := CoefficientsMA.Estimate.GetValue(0As double;
        System.Diagnostics.Debug.WriteLine(" Value: " + d.ToString());
        d := CoefficientsMA.Probability.GetValue(0As double;
        System.Diagnostics.Debug.WriteLine(" Probability: " + d.ToString());
    End If;
End Sub UserProc;

See also:

ISlARMA