IMsBinaryRegressionTransform.Coefficients

Syntax

Coefficients(Coord: IMsFormulaTransformCoord): Array;

Parameters

Coord. Output variable slice, for which calculation is executed.

Description

The Coefficients property determines an array of values of model equation coefficients.

Comments

If a constant is present in the equation, its value is specified in the last element of the array. To save the coefficients, assign an array of values for this property, to flush the coefficients, assign the Null value.

Example

Executing the example requires that the repository contains a modeling container with the CONT_MODEL identifier. The container contains a model with the BINREG identifier that uses the binary regression method for calculation.

Add links to the Metabase, Ms, Stat system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    MObj: IMetabaseObject;
    Model: IMsModel;
    Trans: IMsFormulaTransform;
    VarTrans: IMsFormulaTransformVariable;
    Tree: IMsFormulaTransformSlicesTree;
    Slice: IMsFormulaTransformSlice;
    Selector: IMsFormulaTransformSelector;
    Formula: IMsFormula;
    Binary: IMsBinaryRegressionTransform;
    Calc: IMsModelCalculation;
    Coord: IMsFormulaTransformCoord;
    Coef: Array Of Double;
    i: Integer;
Begin
    MB := MetabaseClass.Active;
    MObj := MB.ItemByIdNamespace("BinReg", MB.ItemById("CONT_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);
    Binary := Formula.Method As IMsBinaryRegressionTransform;
    Binary.HasConstant := True;
    Calc := Model.CreateCalculation;
    Calc.Period.IdentificationStartDate := DateTime.ComposeDay(20000101);
    Calc.Period.IdentificationEndDate := DateTime.ComposeDay(20061231);
    Calc.Period.ForecastStartDate := DateTime.ComposeDay(20070101);
    Calc.Period.ForecastEndDate := DateTime.ComposeDay(20101231);
    Coord := Trans.CreateCoord(VarTrans);
    //identification of new equation
    Binary.Identify(Calc As IMsMethodCalculation, Coord);
    //get calculated coefficients
    Coef := Binary.Coefficients(Coord);
    //if not saved, then save
    If Not Binary.IsCoefficientsSaved(Coord) Then
        Binary.Coefficients(Coord) := Coef;
    End If;
    //display in the console
    For i := 0 To Coef.Length - 1 Do
        Debug.WriteLine(Coef[i]);
    End For;
    MObj.Save;
End Sub;

After executing the example the model parameters are changed, and new equation coefficients are calculated. Unsaved coefficient values are saved and displayed in the console window.

See also:

IMsBinaryRegressionTransform