IMsLinearRegressionTransform.AutoSelection

Syntax

AutoSelection: ILinearRegressionAutoSelection;

Description

The AutoSelection property returns the settings used to autofit time series combination, for which the values of identified equation coefficients will be optimal.

Example

Executing the example requires that the modeling container includes a model that uses the linear regression (OLS estimation) method for calculation.

Sub Main;

Var

MB: IMetabase;

MObj: IMetabaseObject;

Model: IMsModel;

Trans: IMsFormulaTransform;

VarTrans: IMsFormulaTransformVariable;

Tree: IMsFormulaTransformSlicesTree;

Slice: IMsFormulaTransformSlice;

Selector: IMsFormulaTransformSelector;

Formula: IMsFormula;

Linear: IMsLinearRegressionTransform;

Calc: IMsModelCalculation;

Period: IMsModelPeriod;

AutoSel: ILinearRegressionAutoSelection;

Coord: IMsFormulaTransformCoord;

Begin

MB := MetabaseClass.Active;

MObj := MB.ItemByIdNamespace("New_LinReg", MB.ItemById("KONT_MODEL").Key).Edit;

Model := MObj As IMsModel;

Trans := Model.Transform;

VarTrans := Trans.Outputs.Item(0);

Tree := VarTrans.SlicesTree(VarTrans);

Slice := Tree.CreateSlice(1);

Selector := Model.Transform.CreateSelector;

Selector.Slice := Slice;

Formula := Model.Transform.Transform(Selector);

Linear := Formula.Method As IMsLinearRegressionTransform;

Calc := Model.CreateCalculation;

Period := Calc.Period;

Period.IdentificationStartDate := DateTime.ComposeDay(1990, 01, 01);

Period.IdentificationEndDate := DateTime.ComposeDay(2000, 12, 31);

Period.ForecastStartDate := DateTime.ComposeDay(2001, 01, 01);

Period.ForecastEndDate := DateTime.ComposeDay(2010, 12, 31);

AutoSel := Linear.AutoSelection;

AutoSel.Criterion := CriterionType.SumOfSquareError;

AutoSel.Min := 1;

AutoSel.Max := 3;

AutoSel.IsActive := True;

Coord := Trans.CreateCoord(VarTrans);

Linear.Identify(Calc As IMsMethodCalculation, Coord);

MObj.Save;

End Sub Main;

After executing the example the model equation coefficients are identified. A combination of factors, that makes coefficients values optimal, is selected during identification.

See also:

IMsLinearRegressionTransform