ConfidenceLevel: Double;
The ConfidenceLevel property determines the confidence limits significance.
The property is set to 0.95 by default.
Executing the example requires that the repository contains a modeling container with the MODEL_SPACE identifier. The container contains the VAR_1 variable that will be used as an output variable, and the INS_VAR and VAR_FACTOR variables used as an instrumental variable and a factor variable, respectively.
Add links to the Dimension, Cubes, Metabase, Ms and Stat system assemblies.
Sub UserProc;
Var
MB: IMetabase;
KM: IMetabaseObjectDescriptor;
CrInf: IMetabaseObjectCreateInfo;
MObj: IMetabaseObject;
Model: IMsModel;
Trans: IMsFormulaTransform;
VarTrans: IMsFormulaTransformVariable;
Tree: IMsFormulaTransformSlicesTree;
Slice: IMsFormulaTransformSlice;
Selector: IMsFormulaTransformSelector;
Formula: IMsFormula;
SLS2: IMs2SLSTransform;
Varr: IVariableStub;
TransVar: IMsFormulaTransformVariable;
TermInfo: IMsFormulaTermInfo;
Begin
MB := MetabaseClass.Active;
KM := Mb.ItemById("MODEL_SPACE");
CrInf := Mb.CreateCreateInfo;
CrInf.ClassId := MetabaseObjectClass.KE_CLASS_MSMODEL;
CrInf.Id := "New_2SLS";
CrInf.Name := "New_2SLS";
CrInf.Parent := KM;
MObj := Mb.CreateObject(CrInf).Edit;
Model := MObj As IMsModel;
Trans := Model.Transform;
Varr := MB.ItemByIdNamespace("Var_1", KM.Key).Bind As IVariableStub;
VarTrans := Trans.Outputs.Add(Varr);
Tree := VarTrans.SlicesTree(VarTrans);
Slice := Tree.CreateSlice(1);
Selector := Model.Transform.CreateSelector;
Selector.Slice := Slice;
Formula := Model.Transform.Transform(Selector);
Formula.Kind := MsFormulaKind.SLS2;
Formula.Level := DimCalendarLevel.Year;
SLS2 := Formula.Method As IMs2SLSTransform;
SLS2.ConstantMode := InterceptMode.AutoEstimate;
//Instrumental variable
Varr := MB.ItemByIdNamespace("Ins_Var", KM.Key).Bind As IVariableStub;
TransVar := Trans.Inputs.Add(Varr);
TermInfo := Trans.CreateTermInfo;
TermInfo.Slice := TransVar.SlicesTree(VarTrans).CreateSlice(1);
SLS2.Instrumental.Add.Expression.AsString := TermInfo.TermInnerText;
//Factor
Varr := MB.ItemByIdNamespace("Var_Factor", KM.Key).Bind As IVariableStub;
TransVar := Trans.Inputs.Add(Varr);
TermInfo := Trans.CreateTermInfo;
TermInfo.Slice := TransVar.SlicesTree(VarTrans).CreateSlice(1);
SLS2.Explanatories.Add.Expression.AsString := TermInfo.TermInnerText;
SLS2.ConfidenceLevel := 0.99;
MObj.Save;
End Sub UserProc;
After executing the example a model is created in the modeling container. For model calculation use the linear regression method (instrumental variables estimation). The output variable is set for the model, as well as, the factor and instrumental variable. The constant is present in model equation. The value 0.99 is set for a significance value of confidential limits.
See also: