ISlARMA.PeriodSeas

Syntax

PeriodSeas: Integer;

Description

The PeriodSeas property determines seasonality period to calculate seasonal difference.

Comments

PeriodSeas is used to calculate autoregression and moving average in the ARIMA model.

Example

This example creates and calculates a model taking into account seasonality period in data.

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

Sub UserProc;
Var
    lr: ISmLinearRegress;
    W: Array[50Of Double;
    ARMA: ISlARMA;
    AR, MA: Array[1Of Integer;
    Inits: Array[2Of Double;
    res: Integer;
    d: Double;
    CoefficientsAR, CoefficientsMA: ICoefficients;
    ModelCoefficients: IModelCoefficients;
Begin
    lr := New SmLinearRegress.Create;
    // explanatory series values
    w[00] := 6209; w[10] := 7132; w[20] := 9907; w[30] := 14242;
    w[01] := 6385; w[11] := 7137; w[21] := 10333; w[31] := 14704;
    w[02] := 6752; w[12] := 7473; w[22] := 10863; w[32] := 13802;
    w[03] := 6837; w[13] := 7722; w[23] := 11693; w[33] := 14197;
    w[04] := 6495; w[14] := 8088; w[24] := 12242; w[34] := Double.Nan;
    w[05] := 6907; w[15] := 8516; w[25] := 12227; w[35] := 15589;
    w[06] := 7349; w[16] := 8941; w[26] := 12910; w[36] := 15932;
    w[07] := 7213; w[17] := 9064; w[27] := 13049; w[37] := 16631;
    w[08] := 7061; w[18] := 9380; w[28] := 13384; w[38] := Double.Nan;
    w[09] := 7180; w[19] := 9746; w[29] := 14036; w[39] := 17758;
    // sample period
    lr.ModelPeriod.FirstPoint := 1;
    lr.ModelPeriod.LastPoint := 30;
    lr.Forecast.LastPoint := 38;
    lr.MissingData.Method := MissingDataMethod.Casewise;
    lr.Explained.Value := w;
    ModelCoefficients := lr.ModelCoefficients;
    // constant will be used in the model
    ModelCoefficients.Intercept.Mode := InterceptMode.AutoEstimate;
    ARMA := lr.ARMA;
    // non-seasonal autoregression order
    AR[0] := 1;
    ARMA.OrderAR := AR;
    // non-seasonal moving average order
    MA[0] := 1;
    ARMA.OrderMA := MA;
    // seasonal autoregression initial approximations
    Inits[0] := 0.0025;
    ARMA.InitARSeas := Inits;
    // seasonal moving average initial approximations
    Inits[0] := 0.0035;
    ARMA.InitMASeas := Inits;
    // seasonal difference
    ARMA.DiffSeas := 1;
    // seasonal period
    ARMA.PeriodSeas := 3;
    // difference
    ARMA.Diff := 3;
    // coefficient estimation method
    ARMA.EstimationApproach := ARMAEstimationApproach.MaximumLikelihood;
    // calculate model
    res := lr.Execute;
    Debug.WriteLine(lr.Errors);
    If (res = 0Then
        // constant
        Debug.Write("Value of constant: ");
        d := lr.ModelCoefficients.Intercept.Estimate;
        Debug.WriteLine(d);
        // non-seasonal autoregression coefficients
        Debug.WriteLine("Non-seasonal autoregression coefficient estimations");
        CoefficientsAR := ARMA.CoefficientsAR;
        d := CoefficientsAR.Estimate[0];
        Debug.WriteLine(" Value: " + d.ToString);
        // non-seasonal moving average coefficients
        Debug.WriteLine("Non-seasonal moving average coefficient estimations");
        CoefficientsMA := ARMA.CoefficientsMA;
        d := CoefficientsMA.Estimate[0];
        Debug.WriteLine(" Value: " + d.ToString);
    End If;
End Sub UserProc;

After executing the example a linear regression model with the following parameters is created:

The console window displays estimations of model coefficients.

No errors
Value of constant: -4,72264355524548
Non-seasonal autoregression coefficient estimations
 Value: -0.16279813506560903
Non-seasonal moving average coefficient estimations
 Value: -0.99999997820334707

See also:

ISlARMA