AutoRegressionOrder: Array;
The AutoRegressionOrder property determines a value array for autoregression orders.
This property is outdated, use ISmLinearRegress.ARMA.
The number of array elements equals to the number of regressors, each array element is the autoregression order for a certain regressor.
To execute the example, add a link to the Stat system assembly.
Sub UserARMA;
Var
Method: SmLinearRegress;
Factors: ISlSeries;
status: Integer;
Serie, Factor: Array Of Double;
AutoRegression: Array Of Integer;
MovingAverage: ISlMovingAverage;
// Data output procedure
Sub Print(Data: Array Of Double);
Var
i: Integer;
d: Double;
Begin
Debug.WriteLine("---Begin---");
For i := 0 To Data.Length - 1 Do
If Double.IsNan(Data[i]) Then
Debug.WriteLine(i.ToString + ", ---empty---");
Else
d := Data[i];
Debug.WriteLine(i.ToString + ", " + d.ToString);
End If;
End For;
Debug.WriteLine("---End---");
End Sub Print;
Begin
Method := New SmLinearRegress.Create;
// Set explained series
Serie := New Double[20];
Serie[00] := 6209; Serie[01] := 6385;
Serie[02] := 6752; Serie[03] := 6837;
Serie[04] := 6495; Serie[05] := 6907;
Serie[06] := 7349; Serie[07] := 7213;
Serie[08] := 7061; Serie[09] := 7180;
Serie[10] := 7132; Serie[11] := 7137;
Serie[12] := 7473; Serie[13] := 7722;
Serie[14] := 8088; Serie[15] := 8516;
Serie[16] := 8941; Serie[17] := 9064;
Serie[18] := 9380; Serie[19] := 9746;
Method.Explained.Value := Serie;
// Set explanatory series
Factor := New Double[30];
Factor[00] := 4110; Factor[01] := 4280; Factor[02] := 4459;
Factor[03] := 4545; Factor[04] := 4664; Factor[05] := 4861;
Factor[06] := 5195; Factor[07] := 5389; Factor[08] := 5463;
Factor[09] := 5610; Factor[10] := 5948; Factor[11] := 6218;
Factor[12] := 6521; Factor[13] := 6788; Factor[14] := 7222;
Factor[15] := 7486; Factor[16] := 7832; Factor[17] := 8153;
Factor[18] := 8468; Factor[19] := 9054; Factor[20] := 9907;
Factor[21] := 10333; Factor[22] := 10863; Factor[23] := 11693;
Factor[24] := 12242; Factor[25] := 12227; Factor[26] := 12910;
Factor[27] := 13049; Factor[28] := 13384; Factor[29] := 14036;
Factors := Method.Explanatories;
Factors.Add.Value := Factor;
// Set autoregression order
AutoRegression := New Integer[1];
AutoRegression[0] := 1;
Method.AutoRegressionOrder := AutoRegression;
// Set order of the moving average
MovingAverage := Method.MovingAverage;
MovingAverage.Order := 1;
// Set identification and forecasting parameters
Method.ModelPeriod.LastPoint := 20;
Method.Forecast.LastPoint := 30;
// Run calculation and show results
status := Method.Execute;
If status <> 0 Then
Debug.WriteLine(Method.Errors);
Else
Debug.WriteLine("=== Model series ===");
Print(Method.Fitted);
End If;
End Sub UserARMA;
After executing the example the console window displays the results of linear regression calculation (taking into account moving average and autoregression orders):
Module execution started
=== Model series ===
---Begin---
0, ---empty---
1, 6308.8871936080559
2, 6471.7885351477735
3, 6733.3512163842852
4, 6820.8779462457242
5, 6652.5058681077217
6, 7010.7198497886648
7, 7350.3278950893746
8, 7282.1928089833591
9, 7223.527613091579
10, 7392.6799238485391
11, 7434.9598356610159
12, 7520.610258716616
13, 7811.2804878565239
14, 8090.9081748603894
15, 8400.2317429192444
16, 8772.0929030022307
17, 9135.2080017110657
18, 9300.7010037270848
19, 9665.1487412507631
---End---
Module execution finished
See also: