AdvancedOptions: MsStringGeneratorOptions;
AdvancedOptions: Prognoz.Platform.Interop.Ms.MsStringGeneratorOptions;
The AdvancedOptions property determines the advanced settings used to generate model names.
Set AdvancedOptions equal to MsStringGeneratorOptions.ExpandArimaName and set the IMsStringGenerator.Coord property to get identified equation for the ARIMA model.
Executing the example requires that the repository contains a modeling container with the CONT_MODEL identifier. The container includes the ARIMA model with the MODEL identifier.
It is also necessary to add links to the Metabase, Ms system assemblies.
Sub UserProc;
Var
MB: IMetabase;
Model: IMsModel;
Transform: IMsFormulaTransform;
VarTrans: IMsFormulaTransformVariable;
Tree: IMsFormulaTransformSlicesTree;
Slice: IMsFormulaTransformSlice;
Selector: IMsFormulaTransformSelector;
Formula: IMsFormula;
Arima: IMsArimaTransform;
Coord: IMsFormulaTransformCoord;
Calc: IMsModelCalculation;
StrGen: IMsModelStringGenerator;
Begin
MB := MetabaseClass.Active;
Model := MB.ItemByIdNamespace("MODEL", MB.ItemById("CONT_MODEL").Key).Bind As IMsModel;
Transform := Model.Transform;
VarTrans := Transform.Outputs.Item(0);
Tree := VarTrans.SlicesTree(VarTrans);
Slice := Tree.CreateSlice(1);
Selector := Transform.CreateSelector;
Selector.Slice := Slice;
Formula := Transform.Transform(Selector);
Arima := Formula.Method As IMsArimaTransform;
Coord := Transform.CreateCoord(VarTrans);
Calc := Model.CreateCalculation;
Calc.Period.IdentificationStartDate := DateTime.ComposeDay(2000, 01, 01);
Calc.Period.IdentificationEndDate := DateTime.ComposeDay(2005, 12, 31);
Calc.Period.ForecastStartDate := DateTime.ComposeDay(2006, 01, 01);
Calc.Period.ForecastEndDate := DateTime.ComposeDay(2010, 12, 31);
Arima.Execute(Calc As IMsMethodCalculation, Coord);
StrGen := Model.CreateStringGenerator;
StrGen.AdvancedOptions := MsStringGeneratorOptions.ExpandArimaName;
StrGen.Coord := Coord;
StrGen.ShowEstimatedCoeffs := True;
Debug.WriteLine("Identified equation:" + StrGen.Execute);
End Sub UserProc;
After executing the example the identified equation of the ARIMA model is displayed in the console window.
Executing the example requires that the repository contains a modeling container with the CONT_MODEL identifier. The container includes the ARIMA model with the MODEL identifier.
Imports Prognoz.Platform.Interop.Ms;
…
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
Model: IMsModel;
Transform: IMsFormulaTransform;
VarTrans: IMsFormulaTransformVariable;
Tree: IMsFormulaTransformSlicesTree;
Slice: IMsFormulaTransformSlice;
Selector: IMsFormulaTransformSelector;
Formula: IMsFormula;
Arima: IMsArimaTransform;
Coord: IMsFormulaTransformCoord;
Calc: IMsModelCalculation;
StrGen: IMsModelStringGenerator;
Begin
MB := Params.Metabase;
Model := MB.ItemByIdNamespace["MODEL", MB.ItemById["CONT_MODEL"].Key].Bind() As IMsModel;
Transform := Model.Transform;
VarTrans := Transform.Outputs.Item[0];
Tree := VarTrans.SlicesTree[VarTrans];
Slice := Tree.CreateSlice(1);
Selector := Transform.CreateSelector();
Selector.Slice := Slice;
Formula := Transform.Transform[Selector];
Arima := Formula.Method As IMsArimaTransform;
Coord := Transform.CreateCoord(VarTrans);
Calc := Model.CreateCalculation();
Calc.Period.IdentificationStartDate := DateTime.Parse("2000.01.01");
Calc.Period.IdentificationEndDate := DateTime.Parse("2005.12.31");
Calc.Period.ForecastStartDate := DateTime.Parse("2006.01.01");
Calc.Period.ForecastEndDate := DateTime.Parse("2010.12.31");
Arima.Execute(Calc As IMsMethodCalculation, Coord);
StrGen := Model.CreateStringGenerator();
StrGen.AdvancedOptions := MsStringGeneratorOptions.msgoExpandArimaName;
StrGen.Coord := Coord;
StrGen.ShowEstimatedCoeffs := True;
System.Diagnostics.Debug.WriteLine("Identified equation:" + StrGen.Execute());
End Sub;
After executing the example the identified equation of the ARIMA model is displayed in the console window.
See also: