MonthOrQuarter: Integer;
The MonthOrQuarter property determines starting month or quarter, depending on value of the SmCensus2.SeasonalComponentCycleType property.
Sub Main;
Var
Census2: SmCensus2;
res: Integer;
s, Av: Array Of 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
// value s
s := New Double[36];
s[0] := 670.2000183;
s[1] := 576.0680563;
s[2] := 717.6484268;
s[3] := 856.9105808;
s[4] := 885.4609516;
s[5] := 1011.846431;
s[6] := 995.4496292;
s[7] := 1064.74221;
s[8] := 1033.324656;
s[9] := 780.8584552;
s[10] := 657.5033113;
s[11] := 654.5472579;
s[12] := Double.Nan;
s[13] := 642.4128544;
s[14] := Double.Nan;
s[15] := Double.Nan;
s[16] := 884.5042879;
s[17] := 1008.308908;
s[18] := 1108.363628;
s[19] := 1072.737175;
s[20] := 1019.183752;
s[21] := 895.5601672;
s[22] := 811.0306101;
s[23] := 756.601764;
s[24] := 826.6160466;
s[25] := 762.3903317;
s[26] := 931.5707266;
s[27] := 1026.666524;
s[28] := 1114.124119;
s[29] := 1099.626392;
s[30] := 1189.16892;
s[31] := 1092.343791;
s[32] := 1087.503861;
s[33] := 971.6522721;
s[34] := 826.2502823;
s[35] := 789.6322825;
Census2 := New SmCensus2.Create;
Census2.Serie.Value := s;
Census2.ModelPeriod.FirstPoint := 1;
Census2.ModelPeriod.LastPoint := 36;
Census2.MissingData.Method := MissingDataMethod.LinTrend;
Census2.SeasonalComponent.Mode := SeasonalityType.Multiplicative;
Census2.SeasonalComponentCycleType := SeasonalityCycleType.Quater;
Av := New Double[4];
Av[0] := 0.02;
Av[1] := 0.1;
Av[2] := 0.2;
Av[3] := 0.5;
Census2.MovingAverage := Av;
Census2.TraidingDaysAdjustment := TraidingDaysAdj.Auto;
Census2.StartPeriod.Year := 1;
Census2.StartPeriod.MonthOrQuarter := 1;
Census2.SigmaLevel.Lower := 0.9;
Census2.SigmaLevel.Upper := 2;
res := Census2.Execute;
If res<>0 Then
Debug.WriteLine(census2.Errors);
Else
Debug.WriteLine("=== Prior adjusted series ===");
Print(Census2.Results.B1);
Debug.WriteLine("=== Seasonal component ===");
Print(Census2.Results.D10);
End If;
End Sub Main;
After executing the example the console window displays results of calculations that used the following method:
Module execution started
=== Prior adjusted series ===
---Begin---
0, 670.2000
1, 576.0681
2, 717.6484
3, 856.9106
4, 885.4609
5, 1 011.8464
6, 995.4496
7, 1 064.7422
8, 1 033.3247
9, 780.8585
10, 657.5033
11, 654.5472
12, 867.2011
13, 642.4128
14, 879.6692
15, 885.9033
16, 884.5043
17, 1 008.3089
18, 1 108.3636
19, 1 072.7372
20, 1 019.1838
21, 895.5602
22, 811.0306
23, 756.6017
24, 826.6160
25, 762.3903
26, 931.5707
27, 1 026.6665
28, 1 114.1241
29, 1 099.6263
30, 1 189.1689
31, 1 092.3438
32, 1 087.5039
33, 971.6523
34, 826.2503
35, 789.6323
---End---
=== Seasonal component===
---Begin---
0, 107.4600
1, 94.3040
2, 96.9209
3, 101.4956
4, 107.0470
5, 94.4546
6, 97.3650
7, 101.3471
8, 106.1341
9, 95.1908
10, 97.9116
11, 100.8960
12, 105.3047
13, 95.7733
14, 98.6830
15, 100.4335
16, 104.4358
17, 96.1840
18, 99.6344
19, 99.8908
20, 103.9216
21, 96.1583
22, 100.5502
23, 99.5614
24, 103.4403
25, 96.2121
26, 101.1008
27, 99.2574
28, 103.4102
29, 96.1237
30, 101.2853
31, 99.1271
32, 103.5640
33, 95.9287
34, 101.4059
35, 99.0938
36, 103.6409
37, 95.8311
38, 101.4661
39, 99.0771
---End---
Module execution finished
See also: