RedundantExplanatories: Array;
RedundantExplanatories: System.Array;
The RedundantExplanatories property determines indexes of redundant series.
Indexes should be shown as an array of integers based on the IMsLinearRegressionTransform.Explanatories property.
Executing the example requires that the repository contains a modeling container with the CONT_MODEL identifier that contains a linear regression model (OLS estimation) with the MODEL identifier. The model contains more than one factor included to calculation.
Add links to the Metabase, Ms, Stat system assemblies.
Sub UserProc;
Var
mb: IMetabase;
ContModelDescr: IMetabaseObjectDescriptor;
ModelObj: IMetabaseObject;
pModel: IMsModel;
pTransform: IMsFormulaTransform;
pFormula: IMsFormula;
pRegress: IMsLinearRegressionTransform;
pTestList: IMsDiagnosticTestList;
Test: IMsDiagnosticTest;
TestSettings: IMsRedundantVariablesTestSettings;
VarTrans: IMsFormulaTransformVariable;
Calc: IMsMethodCalculation;
Coord: IMsFormulaTransformCoord;
Res: IMsDiagnosticTestResults;
Stat: ISpecificationTestStatistic;
ar: Array[1] Of Integer;
Begin
mb := MetabaseClass.Active;
ContModelDescr := mb.ItemById("CONT_MODEL");
ModelObj := mb.ItemByIdNamespace("MODEL", ContModelDescr.Key).Edit;
pModel := ModelObj As IMsModel;
pTransform := pModel.Transform;
pFormula := pTransform.FormulaItem(0);
pRegress := pFormula.Method As IMsLinearRegressionTransform;
// get diagnostic tests set
pTestList := pRegress.DiagnosticTests;
// find redundant variables criterion
Test := pTestList.FindByType(MsDiagnosticTestType.RedundantVariables);
TestSettings := Test.Settings As IMsRedundantVariablesTestSettings;
// set redundant series
ar[0] := 0;
TestSettings.RedundantExplanatories := ar;
// set testing parameters
VarTrans := pTransform.Outputs.Item(0);
Coord := pTransform.CreateCoord(VarTrans);
Calc := pModel.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
Res := Test.Execute(Calc As IMsMethodCalculation, Coord);
// display results
Stat := Res.ChiTest;
Debug.WriteLine("-- Chi-square statistics --");
Debug.Write(" Value: ");
Debug.WriteLine(Stat.Statistic);
Debug.Write(" Probability: ");
Debug.WriteLine(Stat.Probability);
Stat := Res.FTest;
Debug.WriteLine("-- Fisher statistics --");
Debug.Write(" Value: ");
Debug.WriteLine(Stat.Statistic);
Debug.Write(" Probability: ");
Debug.WriteLine(Stat.Probability);
End Sub UserProc;
The example describes setting up of diagnostic test parameters (redundant variables criterion). The model without first regressor is tested. After the testing the results are displayed in the console window.
See also: