AutoCorrelation(Calculation: IMsMethodCalculation;
Coord: IMsFormulaTransformCoord;
Var ACF: Array;
Var PACF: Array;
Var QStatistics: Array;
Var Probability: Array);
AutoCorrelation
(Calculation: Prognoz.Platform.Interop.Ms.IMsMethodCalculation;
Coord: Prognoz.Platform.Interop.Ms.IMsFormulaTransformCoord;
var ACF: System.Array;
var PACF: System.Array;
var QStatistics: System.Array;
var Probability: System.Array);
Calculation. Model calculation parameters.
Coord. Output variable slice for which calculation is performed.
ACF. Real-valued array with values of the autocorrelation function.
PACF. Real array with values of the private autocorrelation function.
QStatistics. Real array with values of the Ljung-Box Q-statistics.
Probability. Real array with probability values of the Ljung-Box Q-statistics.
The AutoCorrelation method executes autocorrelation analysis of a model.
After executing the method, the analysis results contain the ACF, PACF, QStatistics and Probablity parameters.
Executing the example requires that the repository contains a modeling container with the CONT_MODEL identifier. The container includes the ARIMA model with the MODEL identifier.
Add links to the Metabase, Ms system assemblies.
Sub UserProc;
Var
MB: IMetabase;
Model: IMsModel;
Transform: IMsFormulaTransform;
VarTrans: IMsFormulaTransformVariable;
Tree: IMsFormulaTransformSlicesTree;
Slice: IMsFormulaTransformSlice;
Selector: IMsFormulaTransformSelector;
Formula: IMsFormula;
Arima: IMsArimaTransform;
Coord: IMsFormulaTransformCoord;
Calc: IMsModelCalculation;
acf, pacf, qs, prob: Array Of Double;
Sub PrintArray(a: Array Of Double);
Var
i: Integer;
Begin
For i := 0 To a.Length - 1 Do
Debug.WriteLine(a[i]);
End For;
End Sub PrintArray;
Begin
MB := MetabaseClass.Active;
Model := MB.ItemByIdNamespace("MODEL", MB.ItemById("CONT_MODEL").Key).Bind As IMsModel;
Transform := Model.Transform;
VarTrans := Transform.Outputs.Item(0);
Tree := VarTrans.SlicesTree(VarTrans);
Slice := Tree.CreateSlice(1);
Selector := Transform.CreateSelector;
Selector.Slice := Slice;
Formula := Transform.Transform(Selector);
Arima := Formula.Method As IMsArimaTransform;
Coord := Transform.CreateCoord(VarTrans);
Calc := Model.CreateCalculation;
Calc.Period.IdentificationStartDate := DateTime.ComposeDay(2000, 01, 01);
Calc.Period.IdentificationEndDate := DateTime.ComposeDay(2005, 12, 31);
Calc.Period.ForecastStartDate := DateTime.ComposeDay(2006, 01, 01);
Calc.Period.ForecastEndDate := DateTime.ComposeDay(2010, 12, 31);
Arima.AutoCorrelation(Calc As IMsMethodCalculation, Coord, acf, pacf, qs, prob);
Debug.WriteLine(---- Autocorrelation function ----);
PrintArray(acf);
Debug.WriteLine(---- Private autocorrelation function ----);
PrintArray(pacf);
Debug.WriteLine(---- q-statistics of Lung-Box ----);
PrintArray(qs);
Debug.WriteLine(---- probability of q-statistics ----);
PrintArray(prob);
End Sub UserProc;
After executing the example the results of autocorrelation analysis of the model are displayed in the console window.
See also: