Explained: IEmSerie;
Explained: Prognoz.Platform.Interop.Modeller.IEmSerie;
The Explained property determines explained series.
If an explanatory series is not specified, correct calculation of the Curve Estimation method is impossible.
Executing the example requires a form that contains the CheckBox component with the CheckBox1 identifier. Add links to the Modeller, Stat system assemblies.
Sub CurveEstimation;
Var
ExprMod: IExpressModeller;
Ar: Array[14] Of Double;
Serie: IEmSerie;
Sett: IEmCurveEstimationSettings;
Begin
ExprMod := New ExpressModeller.Create;
Sett := ExprMod.CreateCurveEstimationSettings;
// Setting explained series
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.Explained := Serie;
If CheckBox1.Checked Then
// Setting explanatory series
Ar[0] := 58; Ar[1] := 50; Ar[2] := 26; Ar[4] := 72;
Ar[5] := 28; Ar[6] := 62; Ar[7] := 95; Ar[8] := 74;
Ar[10] := 94; Ar[11] := 100; Ar[12] := 54; Ar[13] := 81;
Ar[3] := Double.Nan; Ar[9] := Double.Nan;
Serie := ExprMod.Series.Add(Ar, "X2", "Data series 2");
Sett.ExplanatoryIsTrend := False;
Sett.Explanatory := Serie;
Else
Sett.ExplanatoryIsTrend := True;
// Set the first point of explanatory time series
Sett.ReferencePoint := 2;
End If;
// Setting estimated dependencies forms
Sett.DependenceForm(DependenceType.Linear) := False;
Sett.DependenceForm(DependenceType.Logistic) := False;
// Setting best model selection criterion
Sett.Criterion := DependenceCriterion.R2Adj;
// Setting polynomial degree
Sett.PolynomOrder := 4;
// Setting seasonality type
Sett.Seasonality := SeasonalityType.Additive;
// Setting seasonality period
Sett.SeasonalityCycle := 4;
//Setting calculation periods
Sett.Period.BeginPeriod := 0;
Sett.Period.EndPeriod := 13;
// Performing calculation
ExprMod.EvaluateMethod("C:\CurveEstimation.html", Sett, True);
End Sub CurveEstimation;
Example execution result: the Curve Estimation method is calculated with set parameters. If the CheckBox1 checkbox is not selected, trend is used as an explanatory series; if it is selected, specified explanatory series values are used. Calculation report is saved to the file C:\CurveEstimation.html.
Executing the example requires a form that contains the CheckBox component with the checkBox1 identifier.
Imports Prognoz.Platform.Interop.Modeller;
Imports Prognoz.Platform.Interop.Stat;
…
Public Sub CurveEstimation();
Var
ExprMod: IExpressModeller;
Ar: Array[14] Of Double;
Serie: IEmSerie;
Sett: IEmCurveEstimationSettings;
Begin
ExprMod := New ExpressModeller.Create();
Sett := ExprMod.CreateCurveEstimationSettings();
// Setting explained series
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.Explained := Serie;
If checkBox1.Checked Then
// Setting explanatory series
Ar[0] := 58; Ar[1] := 50; Ar[2] := 26; Ar[4] := 72;
Ar[5] := 28; Ar[6] := 62; Ar[7] := 95; Ar[8] := 74;
Ar[10] := 94; Ar[11] := 100; Ar[12] := 54; Ar[13] := 81;
Ar[3] := Double.Nan; Ar[9] := Double.Nan;
Serie := ExprMod.Series.Add(Ar, "X2", "Data series 2");
Sett.ExplanatoryIsTrend := False;
Sett.Explanatory := Serie;
Else
Sett.ExplanatoryIsTrend := True;
// Set the first point of explanatory time series
Sett.ReferencePoint := 2;
End If;
// Setting estimated dependencies forms
Sett.DependenceForm[DependenceType.dtLinear] := False;
Sett.DependenceForm[DependenceType.dtLogistic] := False;
// Setting best model selection criterion
Sett.Criterion := DependenceCriterion.dctR2Adj;
// Setting polynomial degree
Sett.PolynomOrder := 4;
// Setting seasonality type
Sett.Seasonality := SeasonalityType.sstAdditive;
// Setting seasonality period
Sett.SeasonalityCycle := 4;
//Setting calculation periods
Sett.Period.BeginPeriod := 0;
Sett.Period.EndPeriod := 13;
// Performing calculation
ExprMod.EvaluateMethod("C:\CurveEstimation.html", Sett, True);
End Sub CurveEstimation;
Example execution result: the Curve Estimation method is calculated with set parameters. If the checkBox1 checkbox is not selected, trend is used as an explanatory series; if it is selected, specified explanatory series values are used. Calculation report is saved to the file C:\CurveEstimation.html.
See also: