AutoRegressionOrder: Array;
AutoRegressionOrder: Array;
The AutoRegressionOrder property determines whether coefficients of autoregression are used in the equation.
Autoregression coefficients are set as an array of integers. The number of array elements is determined by the order, and element values determine the lag for autoregression coefficients. To cancel the use of autoregression, set this property to Null.
Executing the example requires a modeling container with the MS identifier containing vector error correction model with the MODEL_ECM identifier.
Add links to the Metabase, Ms system assemblies.
Sub UserProc;
Var
MB: IMetabase;
MObj: IMetabaseObjectDescriptor;
Model: IMsModel;
ModelTrans: IMsFormulaTransform;
Formula: IMsFormula;
Eqution: IMsECMEquation;
Ar: Array[0..2] Of Integer;
Calc: IMsModelCalculation;
Arr: Array Of Double;
i: Integer;
Begin
// Get current repository
MB := MetabaseClass.Active;
// Get modeling container
MObj := MB.ItemById("MS");
// Get vector model of error correction
Model := MB.ItemByIdNamespace("MODEL_ECM", MObj.Key).Edit As IMsModel;
ModelTrans := Model.Transform;
Formula := ModelTrans.FormulaItem(0);
// Get model calculation parameters
Eqution := Formula.Method As IMsECMEquation;
// Determine autoregression order
Ar := New Integer[3];
Ar[0] := 1;
Ar[1] := 2;
Ar[2] := 3;
Eqution.AutoRegressionOrder := Ar;
// Determine settings to calculate a model
Calc := Model.CreateCalculation;
Calc.Period.IdentificationStartDate := DateTime.ComposeDay(1990, 01, 01);
Calc.Period.IdentificationEndDate := DateTime.ComposeDay(2016, 12, 31);
Calc.Period.ForecastStartDate := DateTime.ComposeDay(2017, 01, 01);
Calc.Period.ForecastEndDate := DateTime.ComposeDay(2025, 12, 31);
// Get output variable data and display it in the console window
Arr := Eqution.Result.Serie(Calc As IMsMethodCalculation);
For i := 0 To Arr.Length - 1 Do
Debug.WriteLine(Arr[i]);
End For;
// Save the model
(Model As IMetabaseObject).Save;
End Sub UserProc;
After executing the example the autoregression order is changed for the first equation, the console window displays output variable data.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Ms;
…
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
MObj: IMetabaseObjectDescriptor;
Model: IMsModel;
ModelTrans: IMsFormulaTransform;
Formula: IMsFormula;
Eqution: IMsECMEquation;
Ar: Array[0..2] Of Integer;
Calc: IMsModelCalculation;
Arr: System.Array;
i: Integer;
Begin
// Get current repository
MB := Params.Metabase;
// Get modeling container
MObj := MB.ItemById["MS"];
// Get vector model of error correction
Model := MB.ItemByIdNamespace["MODEL_ECM", MObj.Key].Edit() As IMsModel;
ModelTrans := Model.Transform;
Formula := ModelTrans.FormulaItem[0];
// Get model calculation parameters
Eqution := Formula.Method As IMsECMEquation;
// Determine autoregression order
Ar := New Integer[3];
Ar[0] := 1;
Ar[1] := 2;
Ar[2] := 3;
Eqution.AutoRegressionOrder := Ar;
// Determine settings to calculate a model
Calc := Model.CreateCalculation();
Calc.Period.IdentificationStartDate := DateTime.Parse("01.01.1990");
Calc.Period.IdentificationEndDate := DateTime.Parse("31.12.2016");
Calc.Period.ForecastStartDate := DateTime.Parse("01.01.2017");
Calc.Period.ForecastEndDate := DateTime.Parse("31.12.2025");
// Get output variable data and display it in the console window
Arr := Eqution.Result.Serie[Calc As IMsMethodCalculation];
For i := 0 To Arr.Length - 1 Do
System.Diagnostics.Debug.WriteLine(Arr[i]);
End For;
// Save the model
(Model As IMetabaseObject).Save();
End Sub;
See also: