Show contents 

Ms > Ms Assembly Interfaces > IMsLinearRegressionTransform > IMsLinearRegressionTransform.AutoSelection

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 the model that uses the method of linear regression for calculation.

Sub UserProc;
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(19900101);
    Period.IdentificationEndDate := DateTime.ComposeDay(20001231);
    Period.ForecastStartDate := DateTime.ComposeDay(20010101);
    Period.ForecastEndDate := DateTime.ComposeDay(20101231);
    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 UserProc;

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