Result: IMsFormulaTerm;
The Result property returns the term corresponding to output variable.
To get exogenous variables, use the IMsCointegrationEquationTransform.Operands property.
Executing the example requires that the repository contains a modeling container with the MS identifier containing an error correction model with the MODEL_COINTEGRATIONEQ identifier.
Add links to the Metabase, Ms, Stat system assemblies.
End Sub UserProc;
Var
mb: IMetabase;
ModelCont: IMetabaseObjectDescriptor;
Model: IMsModel;
Transform: IMsFormulaTransform;
Formula: IMsFormula;
Eq: IMsCointegrationEquationTransform;
i: integer;
Calc: IMsMethodCalculation;
arr: Array Of Double;
Period: IMsModelPeriod;
Begin
// Get current repository
mb := MetabaseClass.Active;
// Get modeling container
ModelCont := mb.ItemById("MS");
// Get error correction model
Model := mb.ItemByIdNamespace("MODEL_COINTEGRATIONEQ", ModelCont.Key).Edit As IMsModel;
// Get model parameters
Transform := Model.Transform;
Formula := Transform.FormulaItem(0);
Eq := Formula.Method As IMsCointegrationEquationTransform;
// Set type of error correction model
Eq.ModelType := ECMType.NoTrendIntercept;
// Set autoregression order of endogenous and exogenous variables
Eq.EndogenousAutoRegressionOrder[0] := 1;
Eq.ExogenousAutoRegressionOrder[0] := 0;
// Set missing data treatment method
Eq.MissingData.Method := MissingDataMethod.Geometric;
// Set significance of confidence limits
Eq.ConfidenceLevel := 0.2;
// Include all variables to the group describing short-term cointegration relations
For i := 0 To Eq.Operands.Count - 1 Do
Eq.OperandType(i) := MsCointegrationEquationOperandType.Common;
End For;
// Create an object with model calculation parameters
Calc := Transform.CreateCalculation;
// Set calculation periods
Period := Model.Transform.Period;
Calc.Period.IdentificationStartDate := Period.IdentificationStartDate;
Calc.Period.IdentificationEndDate := Period.IdentificationEndDate;
Calc.Period.ForecastStartDate := Period.ForecastStartDate;
Calc.Period.ForecastEndDate := Period.ForecastEndDate;
Calc.CurrentPoint := Period.IdentificationStartDate;
// Get output variable data and display it in the console window
arr := Eq.Result.Serie(Calc);
For i := 0 To arr.Length - 1 Do
Debug.WriteLine(arr[i]);
End For;
(Model As IMetabaseObject).Save;
End Sub UserProc;
After executing the example the model parameters are changed, all exogenous variables are included into the group describing short-term cointegration relations, output variable data is displayed in the console window.
See also: