FittedTermSet: IMsFormulaTermSet;
The FittedTermSet property returns parameters of the variable, to which output series data should be loaded after model calculation.
By default, the variable is not set. The dimensions of this and explained variables must match. Parameters of the explained variable are returned by the IMsPooledModelTransform.Explained property.
Parameters returned by FittedTermSet are given as a set of terms.
Executing the example requires that the repository contains a modeling container with the OBJ_MS identifier. This container must include a model with the MODEL identifier that uses panel data regression method for calculation. The modeling container must include the variables, the dimension and dimensions of which match the output variable. Data variables identifiers: VAR_FITTED_POOLED, VAR_FORECAST_POOLED, VAR_RESIDUALS_POOLED, VAR_LO_LEVEL_POOLED, VAR_UP_LEVEL_POOLED.
It is also necessary to add links to the Metabase, Ms system assemblies.
Sub UsepProc;
Var
Mb: IMetabase;
MsDescr: IMetabaseObjectDescriptor;
Model: IMsModel;
ModelTransform: IMsFormulaTransform;
Variable: IVariableStub;
ModelFormula: IMsFormula;
PooledModel: IMsPooledModelTransform;
TermSet: IMsFormulaTermSet;
Begin
Mb := MetabaseClass.Active;
MsDescr := Mb.ItemById("OBJ_MS");
Model := MB.ItemByIdNamespace("MODEL", MsDescr.Key).Edit As IMsModel;
ModelTransform := Model.Transform;
ModelFormula := ModelTransform.FormulaItem(0);
PooledModel := ModelFormula.Method As IMsPooledModelTransform;
Variable := MB.ItemByIdNamespace("VAR_FITTED_POOLED", MsDescr.Key).Bind As IVariableStub;
TermSet := PooledModel.FittedTermSet;
FillOutputSeries(Variable, TermSet, ModelTransform);
Variable := MB.ItemByIdNamespace("VAR_FORECAST_POOLED", MsDescr.Key).Bind As IVariableStub;
TermSet := PooledModel.ForecastTermSet;
FillOutputSeries(Variable, TermSet, ModelTransform);
Variable := MB.ItemByIdNamespace("VAR_RESIDUALS_POOLED", MsDescr.Key).Bind As IVariableStub;
TermSet := PooledModel.ResidualsTermSet;
FillOutputSeries(Variable, TermSet, ModelTransform);
Variable := MB.ItemByIdNamespace("VAR_LO_LEVEL_POOLED", MsDescr.Key).Bind As IVariableStub;
TermSet := PooledModel.LowerConfidenceLevelTermSet;
FillOutputSeries(Variable, TermSet, ModelTransform);
Variable := MB.ItemByIdNamespace("VAR_UP_LEVEL_POOLED", MsDescr.Key).Bind As IVariableStub;
TermSet := PooledModel.UpperConfidenceLevelTermSet;
FillOutputSeries(Variable, TermSet, ModelTransform);
(Model As IMetabaseObject).Save;
End Sub UsepProc;
Sub FillOutputSeries(Stub: IVariableStub; Var TermSet: IMsFormulaTermSet; ModelTransform: IMsFormulaTransform);
Var
ModelligVar: IMsFormulaTransformVariable;
Tree: IMsFormulaTransformSlicesTree;
i: Integer;
Slice: IMsFormulaTransformSlice;
Begin
ModelligVar := ModelTransform.Outputs.Add(Stub);
TermSet.Clear;
Tree := ModelligVar.SlicesTree(Null);
For i := 1 To Tree.Count Do
Slice := Tree.CreateSlice(i);
TermSet.Add(Slice);
End For;
End Sub FillOutputSeries;
After executing the example, on calculating the model, the results are unloaded to the following variables:
Data of output series - VAR_FITTED_POOLED
Forecast series data - VAR_FORECAST_POOLED.
Residual series data - VAR_RESIDUALS_POOLED.
lower confidence limit data - VAR_LO_LEVEL_POOLE.
Upper confidence limit data - VAR_UP_LEVEL_POOLED.
See also: