ConstantMode: InterceptMode;
The ConstantMode property determines the mode of setting model constant.
If ConstantMode has the InterceptMode.ManualEstimate value, the constant is set by the IMsLinearRegressionTransform.ConstantValue property.
Executing the example requires that the repository contains a modeling container with the OBJ_MS identifier containing a model with the MODEL identifier. The model is calculated by the linear regression (OLS estimation) method. It is also necessary to add links to the Ms, Metabase and Stat system assemblies.
Sub UserProc;
Var
Mb: IMetabase;
MsDescrKey: Integer;
Model: IMsModel;
ModelTrans: IMsFormulaTransform;
Formula: IMsFormula;
LinearRegr: IMsLinearRegressionTransform;
Begin
Mb := MetabaseClass.Active;
MsDescrKey := Mb.ItemById("OBJ_MS").Key;
// Get model
Model := MB.ItemByIdNamespace("MODEL", MsDescrKey).Edit As IMsModel;
ModelTrans := Model.Transform;
// Set up model calculation parameters
Formula := ModelTrans.FormulaItem(0);
LinearRegr := Formula.Method As IMsLinearRegressionTransform;
LinearRegr.ConstantMode := InterceptMode.ManualEstimate;
LinearRegr.ConstantValue := 2.9;
// Save model calculation parameters
(Model As IMetabaseObject).Save;
End Sub UserProc;
After executing the example constant value for the model is set.
See also: