OrderARSeas: Array;
The OrderARSeas property determines seasonal autoregression order.
OrderARSeas is an integer array.It is used when calculating autoregression and moving average in the ARIMA model.
If the order of seasonal autoregression is defined, corresponding coefficients will be estimated: ISlARMA.CoefficientsARSeas.
Add a link to the Stat system assembly.
Sub UserProc;
Var
lr: ISmLinearRegress;
W: Array[40] Of Double;
ARMA: ISlARMA;
AR, MA: Array[1] Of Integer;
Inits: Array[2] Of Double;
res: Integer;
d: Double;
CoefficientsAR, CoefficientsMA: ICoefficients;
ModelCoefficients: IModelCoefficients;
Begin
lr := New SmLinearRegress.Create;
// explained 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 := 23;
lr.Forecast.LastPoint := 35;
lr.MissingData.Method := MissingDataMethod.Casewise;
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
AR[0] := 1;
ARMA.OrderARSeas := AR;
// seasonal moving average order
MA[0] := 1;
ARMA.OrderMASeas := MA;
// 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.GaussNewton;
// model calculation
res := lr.Execute;
Debug.WriteLine(lr.Errors);
If (res = 0) Then
// 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, its parameters are determined, and the orders of seasonal autoregression and seasonal moving average are defined. The console window displays estimations of model coefficients.
See also: