ISmExponentialSmoothing.Residuals

Syntax

Residuals: Array;

Description

The Residuals property returns a residual series.

Example

Sub Main;

Var

Method: SmExponentialSmoothing;

serie: Array Of Double;

status: Integer;

Seasonal: ISeasonal;

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

Method := New SmExponentialSmoothing.Create;

serie := New Double[15];

serie[0] := 670.2000183;

serie[1] := 576.0680563;

serie[2] := 717.6484268;

serie[3] := 856.9105808;

serie[4] := 885.4609516;

serie[5] := 1011.846431;

serie[6] := 995.4496292;

serie[7] := 1064.74221;

serie[8] := 1033.324656;

serie[9] := 780.8584552;

serie[10] := 657.5033113;

serie[11] := 654.5472579;

serie[12] := 678.2380139;

serie[13] := 642.4128544;

serie[14] := 751.9611194;

Method.Serie.Value := serie;

Method.Forecast.LastPoint := 40;

Seasonal := Method.SeasonalComponent;

Seasonal.Mode := SeasonalityType.Additive;

Seasonal.Cycle := 4;

status := Method.Execute;

If status <> 0 Then

Debug.WriteLine(Method.Errors);

Else

Debug.WriteLine("=== Modeling series ===");

Print(Method.Fitted);

Debug.WriteLine("=== Residual series ===");

Print(Method.Residuals);

End If;

End Sub Main;

After executing the example the console window displays the following result:

Module execution started

=== Modeling series ===

---Begin---

0, 857,2590

1, 781,7251

2, 748,7119

3, 813,4686

4, 802,3899

5, 752,1952

6, 781,4262

7, 877,3971

8, 884,2754

9, 856,5707

10, 848,1589

11, 901,2608

12, 861,2866

13, 780,1436

14, 755,1850

---End---

=== Residual series ===

---Begin---

0, -187,0590

1, -205,6570

2, -31,0635

3, 43,4420

4, 83,0710

5, 259,6512

6, 214,0234

7, 187,3451

8, 149,0493

9, -75,7123

10, -190,6556

11, -246,7136

12, -183,0486

13, -137,7307

14, -3,2239

---End---

Module execution finished

See also:

ISmExponentialSmoothing