DiagnosticTests(
[Calculation: IMsMethodCalculation = Null;]
[Coord: IMsFormulaTransformCoord = Null]): IMsDiagnosticTestList;
DiagnosticTests[
Calculation: Prognoz.Platform.Interop.Ms.IMsMethodCalculation;
Coord: Prognoz.Platform.Interop.Ms.IMsFormulaTransformCoord]: Prognoz.Platform.Interop.Ms.IMsDiagnosticTestList;
Calculation. Settings that are necessary for calculation.
Coord. The slice, by which calculation is executed.
The DiagnosticTests property returns a set of diagnostic tests of the model.
The test set cannot be changed, that is, it is not possible to remove the existing one or add a new custom test.
Executing the example requires that the repository contains a modeling container with the MS identifier containing an ARIMA model with the MODEL identifier.
Add links to the Metabase, Ms, Stat system assemblies.
Sub UserProc;
Var
mb: IMetabase;
MsKey: Integer;
Model: IMsModel;
Transform: IMsFormulaTransform;
Formula: IMsFormula;
Arima: IMsArimaTransform;
TestList: IMsDiagnosticTestList;
Test: IMsDiagnosticTest;
DSettings: IMsRamseyRessetTestSettings;
VarTrans: IMsFormulaTransformVariable;
Coord: IMsFormulaTransformCoord;
Calc: IMsMethodCalculation;
DResults: IMsDiagnosticTestResults;
Stat: ISpecificationTestStatistic;
Begin
MB := MetabaseClass.Active;
// Get modelling container key
MsKey := MB.GetObjectKeyById("MS");
// Get model
Model := MB.ItemByIdNamespace("MODEL", MsKey).Bind As IMsModel;
// Get model calculation parameters
Transform := Model.Transform;
Formula := Transform.FormulaItem(0);
Arima := Formula.Method As IMsArimaTransform;
// Get set of model diagnostic tests
TestList := Arima.DiagnosticTests;
// Find the Functional Form Criterion test
Test := TestList.FindByType(MsDiagnosticTestType.RamseyResset);
// Get test parameters
DSettings := Test.Settings As IMsRamseyRessetTestSettings;
// Set the number of additional regressors included into test regression.
DSettings.Power := 3;
// Set testing periods
VarTrans := Transform.Outputs.Item(0);
Coord := Transform.CreateCoord(VarTrans);
Calc := Model.CreateCalculation As IMsMethodCalculation;
Calc.Period.IdentificationStartDate := DateTime.ComposeDay(1990, 01, 01);
Calc.Period.IdentificationEndDate := DateTime.ComposeDay(2007, 12, 31);
Calc.Period.ForecastStartDate := DateTime.ComposeDay(2008, 01, 01);
Calc.Period.ForecastEndDate := DateTime.ComposeDay(2010, 12, 31);
// Execute testing
DResults := Test.Execute(Calc As IMsMethodCalculation, Coord);
// Output test results
Stat := DResults.ChiTest;
Debug.WriteLine("-- Chi-square statistic --");
Debug.Write(" Value: ");
Debug.WriteLine(Stat.Statistic);
Debug.Write(" Probability: ");
Debug.WriteLine(Stat.Probability);
Stat := DResults.FTest;
Debug.WriteLine("-- Fisher statistic --");
Debug.Write(" Value: ");
Debug.WriteLine(Stat.Statistic);
Debug.Write(" Probability: ");
Debug.WriteLine(Stat.Probability);
End Sub UserProc;
After executing the example the Functional Form Criterion test is executed for the MODEL model, testing results are displayed in the console window.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Ms;
Imports Prognoz.Platform.Interop.Stat;
…
Public Shared Sub Main(Params: StartParams);
Var
mb: IMetabase;
MsKey: uinteger;
Model: IMsModel;
Transform: IMsFormulaTransform;
Formula: IMsFormula;
Arima: IMsArimaTransform;
TestList: IMsDiagnosticTestList;
Test: IMsDiagnosticTest;
DSettings: IMsRamseyRessetTestSettings;
VarTrans: IMsFormulaTransformVariable;
Coord: IMsFormulaTransformCoord;
Calc: IMsMethodCalculation;
DResults: IMsDiagnosticTestResults;
Stat: ISpecificationTestStatistic;
Begin
MB := Params.Metabase;
// Get modelling container key
MsKey := MB.GetObjectKeyById("MS");
// Get the model
Model := MB.ItemByIdNamespace["MODEL", MsKey].Bind() As IMsModel;
// Get model calculation parameters
Transform := Model.Transform;
Formula := Transform.FormulaItem[0];
Arima := Formula.Method As IMsArimaTransform;
// Get set of model diagnostic tests
TestList := Arima.DiagnosticTests[Null, Null];
// Find the Functional Form Criterion test
Test := TestList.FindByType[MsDiagnosticTestType.mdttRamseyResset];
// Get test parameters
DSettings := Test.Settings As IMsRamseyRessetTestSettings;
// Set the number of additional regressors included into test regression.
DSettings.Power := 3;
// Set testing periods
VarTrans := Transform.Outputs.Item[0];
Coord := Transform.CreateCoord(VarTrans);
Calc := Model.CreateCalculation() As IMsMethodCalculation;
Calc.Period.IdentificationStartDate := DateTime.Parse("1990.01.01");
Calc.Period.IdentificationEndDate := DateTime.Parse("2007.12.31");
Calc.Period.ForecastStartDate := DateTime.Parse("2008.01.01");
Calc.Period.ForecastEndDate := DateTime.Parse("2010.12.31");
// Test
DResults := Test.Execute(Calc As IMsMethodCalculation, Coord);
// Output test results
Stat := DResults.ChiTest;
System.Diagnostics.Debug.WriteLine("-- Chi-square statistic --quot;);
System.Diagnostics.Debug.Write(" Value: ");
System.Diagnostics.Debug.WriteLine(Stat.Statistic);
System.Diagnostics.Debug.Write(" Probability: ");
System.Diagnostics.Debug.WriteLine(Stat.Probability);
Stat := DResults.FTest;
System.Diagnostics.Debug.WriteLine("-- Fisher statistic --");
System.Diagnostics.Debug.Write(" Value: ");
System.Diagnostics.Debug.WriteLine(Stat.Statistic);
System.Diagnostics.Debug.Write(" Probability: ");
System.Diagnostics.Debug.WriteLine(Stat.Probability);
End Sub;
See also: