ResidualsSeason: Array;
The ResidualsSeason property returns a dependency form residual series with seasonality.
Sub Main;
Var
trend: SmCurveEstimation;
d0: Double;
status, i: Integer;
ar: Array Of Double;
Forms: IDependenceForms;
Dep: IDependenceForm;
Begin
trend := New SmCurveEstimation.Create;
ar := New Double[25];
ar[00] := 4110;
ar[01] := 4280;
ar[02] := 4459;
ar[03] := 4545;
ar[04] := 4664;
ar[05] := 4861;
ar[06] := 5195;
ar[07] := 5389;
ar[08] := 5463;
ar[09] := 5610;
ar[10] := 5948;
ar[11] := 6218;
ar[12] := 6521;
ar[13] := 6788;
ar[14] := 7222;
ar[15] := 7486;
ar[16] := 7832;
ar[17] := 8153;
ar[18] := 8468;
ar[19] := 9054;
ar[20] := 9499;
ar[21] := 9866;
ar[22] := 10217;
ar[23] := 10763;
ar[24] := 10683;
trend.Explained.Value := ar;
trend.Explanatory.IsTrend := True;
trend.ModelPeriod.LastPoint := 20;
trend.ForecastLastPoint := 30;
trend.SeasonalComponent.Mode := SeasonalityType.additive;
trend.SeasonalComponent.Cycle := 4;
status := trend.Execute;
If status <> 0 Then
Debug.WriteLine(trend.Errors);
Else
Forms := trend.DependenceForms;
Dep := Forms.Item(1);
Debug.WriteLine("Dependence form " + Dep.DisplayName);
Debug.WriteLine("=== Residual series with seasonality ===");
For i := 0 To Dep.ResidualsSeason.Length -1 Do
d0 := Dep.ResidualsSeason[i];
Debug.WriteLine(i.ToString + ": " + d0.ToString);
End For;
End If;
End Sub Main;
After executing the example the console window displays the following results:
Module execution started
Dependence form: Quadratic
=== Residual series with seasonality ===
0: -66.660795454543774
1: -5.7038149350641163
2: 48.450875768969297
3: -6.196723342446063
4: -43.646612269309486
5: -18.898791011619693
6: 127.04674043062386
7: 117.18998205741681
8: -28.469066131236474
9: -116.93040413533745
10: -30.194031954886498
11: -27.259949589883405
12: -7.1281570403283752
13: -38.79865430621922
14: 80.728558612441873
15: 14.453481715653282
16: 14.376115003418448
17: -26.503541524264079
18: -89.18548786739558
19: 103.33027597402688
Module execution finished
See also: