Holday: Census2HolidayAdjType;
Holday: Prognoz.Platform.Interop.Stat.Census2HolidayAdjType;
The Holiday property determines whether holiday adjustment should be made during calculation.
By default, the holiday adjustment is not applied, that is, Holday = Census2HolidayAdjType.C2hatNone.
Add a link to the Stat system assembly.
Sub UserProc;
Var
Census2: SmCensus2;
res, i: Integer;
s: Array[108] Of Double;
w: Array[7] Of Double;
Begin
Census2 := New SmCensus2.Create;
// Set explained series values
s[0] := 670.2000183; s[27] := Double.Nan; s[54] := 826.6160466; s[81] := 826.6160466;
s[1] := 576.0680563; s[28] := 642.418544; s[55] := Double.Nan; s[82] := 1011.846431;
s[2] := 1008.30908; s[29] := 1099.626392; s[56] := 995.4496292; s[83] := 1108.36628;
s[3] := 1189.16892; s[30] := 1064.742231; s[57] := 1072.77175; s[84] := 1092.343791;
s[4] := 1033.324656; s[31] := 1019.18752; s[58] := 1087.503861; s[85] := 780.8584552;
s[5] := 895.560672; s[32] := 971.6522721; s[59] := 717.6484268; s[86] := Double.Nan;
s[6] := 931.5707266; s[33] := 856.9105808; s[60] := Double.Nan; s[87] := 1026.666524;
s[7] := 885.4609516; s[34] := 884.504279; s[61] := Double.Nan; s[88] := 1011.846431;
s[8] := 1008.30908; s[35] := 1099.626392; s[62] := 955.4496292; s[89] := 1108.36628;
s[9] := 1189.16892; s[36] := 1064.742231; s[63] := 1072.77175; s[90] := 1092.34791;
s[10] := 1063.324656; s[37] := 1019.18752; s[64] := 1087.503861; s[91] := 780.8584552;
s[11] := 835.560672; s[38] := 971.6522721; s[65] := 657.503313; s[92] := 811.036101;
s[12] := 886.2502823; s[39] := 654.547579; s[66] := 756.617764; s[93] := 789.632225;
s[13] := 857.9145808; s[40] := Double.Nan; s[67] := 1026.666524; s[94] := 885.4609516;
s[14] := 884.504279; s[41] := Double.Nan; s[68] := 1011.846431; s[95] := 1008.30908;
s[15] := 1299.628392; s[42] := 995.4496292; s[69] := 1108.36628; s[96] := 1189.166892;
s[16] := 1034.742231; s[43] := 1072.77175; s[70] := 1092.343791; s[97] := 1033.324656;
s[17] := 1019.18342; s[44] := 1087.503861; s[71] := 1043.324656; s[98] := 1019.18752;
s[18] := 1087.503861; s[45] := 780.8584552; s[72] := 895.560672; s[99] := 971.652721;
s[19] := 719.6483268; s[46] := Double.Nan; s[73] := 931.5707266; s[100] := 856.915808;
s[20] := 885.4609516; s[47] := 884.504279; s[74] := Double.Nan; s[101] := 1011.846431;
s[21] := 1108.30908; s[48] := 1099.626392; s[75] := 995.4496292; s[102] := 1108.3628;
s[22] := 1149.16892; s[49] := 1064.742231; s[76] := 1072.77175; s[103] := 1092.343791;
s[23] := 1183.324656; s[50] := 1019.18752; s[77] := 1087.503861; s[104] := 781.858552;
s[24] := 835.560692; s[51] := 971.6522721; s[78] := 657.503313; s[105] := 811.036101;
s[25] := 816.2504823; s[52] := 654.547579; s[79] := 756.617764; s[106] := 811.036101;
s[26] := 859.9135808; s[53] := Double.Nan; s[80] := 1026.666524; s[107] := 781.858552;
Census2.Serie.Value := s;
// Determine sample period parameters
Census2.ModelPeriod.FirstPoint := 1;
Census2.ModelPeriod.LastPoint := 108;
// Set missing data treatment method
Census2.MissingData.Method := MissingDataMethod.LinTrend;
// Define parameters of seasonal component and seasonality type
Census2.SeasonalComponent.Mode := SeasonalityType.Multiplicative;
Census2.SeasonalComponentCycleType := SeasonalityCycleType.Month;
// Set moving average values
W[0] := 1.00; W[4] := 0.90;
W[1] := 1.00; W[5] := 0.98;
W[2] := 1.02; W[6] := 1.00;
W[3] := 1.10;
Census2.DailyWeights := W;
// Define working days adjustments
Census2.TraidingDaysAdjustment := TraidingDaysAdj.Auto;
// Define parameters for period start
Census2.StartPeriod.Year := 1;
Census2.StartPeriod.MonthOrQuarter := 1;
// Define holiday adjustments
Census2.Holday := Census2HolidayAdjType.C2hatEaster;
Census2.SSAnalysis := True;
res := Census2.Execute;
// Calculate method
res := Census2.Execute;
If res <> 0 Then
Debug.WriteLine(census2.Errors);
Else
Debug.WriteLine("=== Prior adjusted series ===");
Debug.Indent;
For i := 0 To Census2.Results.B1.Length - 1 Do
Debug.WriteLine(Census2.Results.B1[i]);
End For;
Debug.Unindent;
Debug.WriteLine("=== Seasonal component ===");
Debug.Indent;
For i := 0 To Census2.Results.D10.Length - 1 Do
Debug.WriteLine(Census2.Results.D10[i]);
End For;
Debug.Unindent;
End If;
End Sub UserProc;
After executing the example the console window displays calculation results for the X11 method. Moving intervals and holiday adjustment (Easter) are applied during the calculation.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Stat;
…
Public Shared Sub Main(Params: StartParams);
Var
Census2: SmCensus2;
s: Array[108] Of Double;
w: Array[7] Of Double;
res, i: Integer;
B1, D10: System.Array;
Begin
Census2 := New SmCensus2.Create();
// Set explained series values
s[0] := 670.2000183; s[27] := Double.Nan; s[54] := 826.6160466; s[81] := 826.6160466;
s[1] := 576.0680563; s[28] := 642.418544; s[55] := Double.Nan; s[82] := 1011.846431;
s[2] := 1008.30908; s[29] := 1099.626392; s[56] := 995.4496292; s[83] := 1108.36628;
s[3] := 1189.16892; s[30] := 1064.742231; s[57] := 1072.77175; s[84] := 1092.343791;
s[4] := 1033.324656; s[31] := 1019.18752; s[58] := 1087.503861; s[85] := 780.8584552;
s[5] := 895.560672; s[32] := 971.6522721; s[59] := 717.6484268; s[86] := Double.Nan;
s[6] := 931.5707266; s[33] := 856.9105808; s[60] := Double.Nan; s[87] := 1026.666524;
s[7] := 885.4609516; s[34] := 884.504279; s[61] := Double.Nan; s[88] := 1011.846431;
s[8] := 1008.30908; s[35] := 1099.626392; s[62] := 955.4496292; s[89] := 1108.36628;
s[9] := 1189.16892; s[36] := 1064.742231; s[63] := 1072.77175; s[90] := 1092.34791;
s[10] := 1063.324656; s[37] := 1019.18752; s[64] := 1087.503861; s[91] := 780.8584552;
s[11] := 835.560672; s[38] := 971.6522721; s[65] := 657.503313; s[92] := 811.036101;
s[12] := 886.2502823; s[39] := 654.547579; s[66] := 756.617764; s[93] := 789.632225;
s[13] := 857.9145808; s[40] := Double.Nan; s[67] := 1026.666524; s[94] := 885.4609516;
s[14] := 884.504279; s[41] := Double.Nan; s[68] := 1011.846431; s[95] := 1008.30908;
s[15] := 1299.628392; s[42] := 995.4496292; s[69] := 1108.36628; s[96] := 1189.166892;
s[16] := 1034.742231; s[43] := 1072.77175; s[70] := 1092.343791; s[97] := 1033.324656;
s[17] := 1019.18342; s[44] := 1087.503861; s[71] := 1043.324656; s[98] := 1019.18752;
s[18] := 1087.503861; s[45] := 780.8584552; s[72] := 895.560672; s[99] := 971.652721;
s[19] := 719.6483268; s[46] := Double.Nan; s[73] := 931.5707266; s[100] := 856.915808;
s[20] := 885.4609516; s[47] := 884.504279; s[74] := Double.Nan; s[101] := 1011.846431;
s[21] := 1108.30908; s[48] := 1099.626392; s[75] := 995.4496292; s[102] := 1108.3628;
s[22] := 1149.16892; s[49] := 1064.742231; s[76] := 1072.77175; s[103] := 1092.343791;
s[23] := 1183.324656; s[50] := 1019.18752; s[77] := 1087.503861; s[104] := 781.858552;
s[24] := 835.560692; s[51] := 971.6522721; s[78] := 657.503313; s[105] := 811.036101;
s[25] := 816.2504823; s[52] := 654.547579; s[79] := 756.617764; s[106] := 811.036101;
s[26] := 859.9135808; s[53] := Double.Nan; s[80] := 1026.666524; s[107] := 781.858552;
Census2.Serie.Value := s;
// Determine sample period parameters
Census2.ModelPeriod.FirstPoint := 1;
Census2.ModelPeriod.LastPoint := 108;
// Set missing data treatment method
Census2.MissingData.Method := MissingDataMethod.mdmLinTrend;
// Define parameters of seasonal component and seasonality type
Census2.SeasonalComponent.Mode := SeasonalityType.sstMultiplicative;
Census2.SeasonalComponentCycleType := SeasonalityCycleType.sctMonth;
// Set moving average values
W[0] := 1.00; W[4] := 0.90;
W[1] := 1.00; W[5] := 0.98;
W[2] := 1.02; W[6] := 1.00;
W[3] := 1.10;
Census2.DailyWeights := W;
// Define working days adjustments
Census2.TraidingDaysAdjustment := TraidingDaysAdj.tdaAuto;
// Define parameters for period start
Census2.StartPeriod.Year := 1;
Census2.StartPeriod.MonthOrQuarter := 1;
//Set holiday adjustment
Census2.Holday := Census2HolidayAdjType.C2hatEaster;
Census2.SSAnalysis := True;
// Calculate method
res := Census2.Execute();
If res <> 0 Then
System.Diagnostics.Debug.WriteLine(census2.Errors);
Else
System.Diagnostics.Debug.WriteLine("=== Prior adjusted series ===");
System.Diagnostics.Debug.Indent();
B1 := Census2.Results.B1;
For i := 0 To Census2.Results.B1.Length - 1 Do
System.Diagnostics.Debug.WriteLine(B1[i]);
End For;
System.Diagnostics.Debug.Unindent();
System.Diagnostics.Debug.WriteLine("=== Seasonal component ===");
System.Diagnostics.Debug.Indent();
D10 := Census2.Results.D10;
For i := 0 To Census2.Results.D10.Length - 1 Do
System.Diagnostics.Debug.WriteLine(D10[i]);
End For;
System.Diagnostics.Debug.Unindent();
End If;
End Sub;
See also: