IMsBinaryRegressionTransform.Coefficients

Syntax

Coefficients(Coord: IMsFormulaTransformCoord): Array;

Parameters

Coord. Output variable slice for which calculation is performed.

Description

The Coefficients property determines an array of values of model equation coefficients. If a constant is present in the equation, its value is specified in the last element of the array. To save the coefficients, an array of values must be assigned for this property, to flush the coefficients, the Null value must be assigned.

Example

Executing the example requires that modeling container with the CONT_MODEL identifier includes a model with the BinReg identifier using binary regression method for calculation.

Sub Main;

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(2000, 01, 01);

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

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

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

Coord := Trans.CreateCoord(VarTrans);

//identification of new equation

Binary.Identify(Calc As IMsMethodCalculation, Coord);

//receive the calculated coefficients

Coef := Binary.Coefficients(Coord);

//save if it is not saved

If Not Binary.IsCoefficientsSaved(Coord) Then

Binary.Coefficients(Coord) := Coef;

End If;

//display into the console

For i := 0 To Coef.Length - 1 Do

Debug.WriteLine(Coef[i]);

End For;

MObj.Save;

End Sub Main;

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

See also:

IMsBinaryRegressionTransform