ISmAutoRegress.ModelCoefficients

Синтаксис

ModelCoefficients: IModelCoefficients;

Описание

Свойство ModelCoefficients определяет параметры коэффициентов модели.

Пример

Sub Main;

Var

ar: SmAutoRegress;

res: Integer;

y1: Array Of Double;

AROrder: Array Of Integer;

d: Double;

Sub Print(Data: Array Of Double);

Var

i: Integer;

CI: ICultureInfo;

Begin

CI := CultureInfo.Current;

Debug.WriteLine("---Begin---");

For i := 0 To Data.Length - 1 Do

If Double.IsNan(Data[i]) Then

Debug.WriteLine("---empty---");

Else

Debug.WriteLine(i.ToString + ", " + CI.FormatDoublePrec(Data[i], 4));

End If;

End For;

Debug.WriteLine("---End---");

End Sub Print;

Begin

// значения y1

y1 := New Double[24];

y1[00] := 6209;

y1[01] := 6385;

y1[02] := 6752;

y1[03] := 6837;

y1[04] := 6495;

y1[05] := 6907;

y1[06] := 7349;

y1[07] := 7213;

y1[08] := 7061;

y1[09] := 7180;

y1[10] := Double.Nan;

y1[11] := Double.Nan;

y1[12] := Double.Nan;

y1[13] := 7722;

y1[14] := 8088;

y1[15] := 8516;

y1[16] := 8941;

y1[17] := 9064;

y1[18] := 9380;

y1[19] := 9746;

y1[20] := 9907;

y1[21] := 10333;

y1[22] := 10863;

y1[23] := 11693;

ar := New SmAutoRegress.Create;

ar.Serie.Value := y1;

ar.ModelPeriod.FirstPoint := 1;

ar.ModelPeriod.LastPoint := 24;

ar.Forecast.LastPoint := 35;

AROrder := New Integer[3];

AROrder[0] := 1;

AROrder[1] := 3;

AROrder[2] := 5;

ar.AutoRegressionOrder := AROrder;

ar.MissingData.Method := MissingDataMethod.SampleAverage;

ar.ModelCoefficients.Intercept.Mode := InterceptMode.AutoEstimate;

res := ar.Execute;

If res<>0 Then

Debug.WriteLine(ar.Errors);

Else

Debug.WriteLine("=== Сглаженный ряд ===");

Print(ar.Fitted);

Debug.WriteLine("=== Коэффициенты модели ===");

Print(ar.ModelCoefficients.Coefficients.Estimate);

Debug.WriteLine("=== Константа ===");

d := ar.ModelCoefficients.Intercept.Estimate;

Debug.WriteLine(d);

End If;

End Sub Main;

После выполнения примера в окно консоли будет выведен сглаженный ряд, коэффициенты модели и константа:

Module execution started

=== Сглаженный ряд ===

---Begin---

---empty---

---empty---

---empty---

---empty---

---empty---

5, 6 684.4144

6, 7 020.8026

7, 7 363.3255

8, 7 406.2895

9, 7 267.8518

10, 7 481.4586

11, 8 251.7346

12, 8 220.4236

13, 8 379.8892

14, 8 133.2347

15, 8 785.3425

16, 8 932.6602

17, 9 263.4476

18, 9 219.7650

19, 9 651.3033

20, 10 073.7514

21, 10 414.5325

22, 10 797.2812

23, 11 278.4919

---End---

=== Коэффициенты модели ===

---Begin---

0, 0.5939

1, 0.2142

2, 0.4176

---End---

=== Константа ===

-1211.94815984921

Module execution finished

См. также:

ISmAutoRegress