Serie: IEmSerie;
Serie: Prognoz.Platform.Interop.Modeller.IEmSerie;
The Serie property determines a smoothable series.
If the smoothable series is not specified, correct calculation of the Census 2 method is not possible.
To execute the example, add links to the Modeller, Stat system assemblies.
Sub Census2;
Var
ExprMod: IExpressModeller;
Serie: IEmSerie;
Ar: Array[14] Of Double;
Sett: IEmCensus2Settings;
Period: IEmPeriodSettings;
MovAvg: Array[4] Of Double;
DWeights: Array[7] Of Double;
Begin
ExprMod := New ExpressModeller.Create;
Ar[0] := 56; Ar[1] := 45; Ar[2] := 23; Ar[3] := 45;
Ar[4] := 65; Ar[5] := 23; Ar[6] := 54; Ar[7] := 87;
Ar[8] := 67; Ar[9] := 98; Ar[10] := 89; Ar[13] := 79;
Ar[11] := Double.Nan; Ar[12] := Double.Nan;
Serie := ExprMod.Series.Add(Ar, "X1", "Data series 1");
Sett := ExprMod.CreateCensus2Settings;
// Setting smoothable series
Sett.Serie := Serie;
// Setting seasonality type
Sett.Seasonality := SeasonalityType.Multiplicative;
// Setting seasonality period
Sett.SeasonalComponentCycleType := SeasonalityCycleType.Quater;
// Define moving average
MovAvg[0] := 0; MovAvg[1] := 0.185;
MovAvg[2] := 0.407; MovAvg[3] := 0.407;
Sett.MovingAverage := MovAvg;
// Setting weight coefficients
DWeights[0] := 1.25; DWeights[1] := 1.25; DWeights[2] := 1.25;
DWeights[3] := 1.25; DWeights[4] := 1.25;
DWeights[5] := 0.50; DWeights[6] := 0.25;
Sett.DailyWeights := DWeights;
// Setting sigma borders value
Sett.SigmaLower := 1.5;
Sett.SigmaUpper := 2.5;
// Setting initial quarter and year
Sett.StartMonthOrQuarter := 2;
Sett.StartYear := 2010;
//Specifying,thatworkingdaysadjustmentisnotused Sett.TraidingDaysAdjustment := TraidingDaysAdj.No;
//Setting calculated series
Sett.A1 := True; Sett.A2 := True; Sett.A3 := True; Sett.A4 := True;
Sett.B1 := True; Sett.B10 := True; Sett.B11 := True; Sett.B13 := True;
Sett.B14 := True; Sett.B15 := True; Sett.B16 := True; Sett.B17 := True;
Sett.B18 := True; Sett.B19 := True; Sett.B2 := True; Sett.B3 := True;
Sett.B4 := True; Sett.B5 := True; Sett.B6 := True; Sett.B7 := True;
Sett.B8 := True; Sett.B9 := True; Sett.C1 := True; Sett.C11 := True;
Sett.C13 := True; Sett.C14 := True; Sett.C15 := True; Sett.C16 := True;
Sett.C17 := True; Sett.C18 := True; Sett.C19 := True; Sett.C2 := True;
Sett.C4 := True; Sett.C5 := True; Sett.C6 := True; Sett.C7 := True;
Sett.C9 := True; Sett.D1 := True; Sett.D10 := True; Sett.D11 := True;
Sett.D12 := True; Sett.D13 := True; Sett.D2 := True; Sett.D20 := True;
Sett.D4 := False; Sett.D5 := True; Sett.D6 := True; Sett.D7 := True;
Sett.D8 := True; Sett.D9 := True; Sett.E1 := True; Sett.E2 := True;
Sett.E3 := True; Sett.E4 := True; Sett.E5 := True; Sett.E6 := True;
Sett.F1 := True; Sett.F2 := True; Sett.F3 := True;
// Setting calculation periods
Period := Sett.Period;
Period.BeginPeriod := 1;
Period.EndPeriod := 14;
Period.EndFore := 4;
// Performing calculation
ExprMod.EvaluateMethod("C:\Census2.html", Sett, True);
End Sub Census2;
Example execution result: the Census 2 method is calculated with set parameters, calculation report is saved to the file C:\Census2.html.
Imports Prognoz.Platform.Interop.Modeller;
Imports Prognoz.Platform.Interop.Stat;
…
Public Shared Sub Main(Params: StartParams);
Var
ExprMod: IExpressModeller;
Serie: IEmSerie;
Ar: Array[14] Of Double;
Sett: IEmCensus2Settings;
Period: IEmPeriodSettings;
MovAvg: Array[4] Of Double;
DWeights: Array[7] Of Double;
Begin
ExprMod := New ExpressModeller.Create();
Ar[0] := 56; Ar[1] := 45; Ar[2] := 23; Ar[3] := 45;
Ar[4] := 65; Ar[5] := 23; Ar[6] := 54; Ar[7] := 87;
Ar[8] := 67; Ar[9] := 98; Ar[10] := 89; Ar[13] := 79;
Ar[11] := Double.Nan; Ar[12] := Double.Nan;
Serie := ExprMod.Series.Add(Ar, "X1", "Data series 1");
Sett := ExprMod.CreateCensus2Settings();
// Setting smoothable series
Sett.Serie := Serie;
// Setting seasonality type
Sett.Seasonality := SeasonalityType.sstMultiplicative;
// Setting seasonality period
Sett.SeasonalComponentCycleType := SeasonalityCycleType.sctQuater;
// Define moving average
MovAvg[0] := 0; MovAvg[1] := 0.185;
MovAvg[2] := 0.407; MovAvg[3] := 0.407;
Sett.MovingAverage := MovAvg;
// Setting weight coefficients
DWeights[0] := 1.25; DWeights[1] := 1.25; DWeights[2] := 1.25;
DWeights[3] := 1.25; DWeights[4] := 1.25;
DWeights[5] := 0.50; DWeights[6] := 0.25;
Sett.DailyWeights := DWeights;
// Setting sigma borders value
Sett.SigmaLower := 1.5;
Sett.SigmaUpper := 2.5;
// Setting initial quarter and year
Sett.StartMonthOrQuarter := 2;
Sett.StartYear := 2010;
//Specifying,thatworkingdaysadjustmentisnotused Sett.TraidingDaysAdjustment := TraidingDaysAdj.tdaNo;
//Setting calculated series
Sett.A1 := True; Sett.A2 := True; Sett.A3 := True; Sett.A4 := True;
Sett.B1 := True; Sett.B10 := True; Sett.B11 := True; Sett.B13 := True;
Sett.B14 := True; Sett.B15 := True; Sett.B16 := True; Sett.B17 := True;
Sett.B18 := True; Sett.B19 := True; Sett.B2 := True; Sett.B3 := True;
Sett.B4 := True; Sett.B5 := True; Sett.B6 := True; Sett.B7 := True;
Sett.B8 := True; Sett.B9 := True; Sett.C1 := True; Sett.C11 := True;
Sett.C13 := True; Sett.C14 := True; Sett.C15 := True; Sett.C16 := True;
Sett.C17 := True; Sett.C18 := True; Sett.C19 := True; Sett.C2 := True;
Sett.C4 := True; Sett.C5 := True; Sett.C6 := True; Sett.C7 := True;
Sett.C9 := True; Sett.D1 := True; Sett.D10 := True; Sett.D11 := True;
Sett.D12 := True; Sett.D13 := True; Sett.D2 := True; Sett.D20 := True;
Sett.D4 := False; Sett.D5 := True; Sett.D6 := True; Sett.D7 := True;
Sett.D8 := True; Sett.D9 := True; Sett.E1 := True; Sett.E2 := True;
Sett.E3 := True; Sett.E4 := True; Sett.E5 := True; Sett.E6 := True;
Sett.F1 := True; Sett.F2 := True; Sett.F3 := True;
// Setting calculation periods
Period := Sett.Period;
Period.BeginPeriod := 1;
Period.EndPeriod := 14;
Period.EndFore := 4;
// Performing calculation
ExprMod.EvaluateMethod("C:\Census2.html", Sett, True);
End Sub;
Example execution result: the Census 2 method is calculated with set parameters, calculation report is saved to the file C:\Census2.html.
See also: