GroupSeparator: Array;
GroupSeparator: System.Array;
The GroupSeparator property divides observations of explained series into groups.
GroupSeparator is the array that contains only zeros and ones. Each array element has the observation contained in the sample period of explained series. If the value of array element is zero, the observation is included into the first group; if the element value is one, the observation is included into the second group.
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.
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: IMsChowTestSettings;
VarTrans: IMsFormulaTransformVariable;
Calc: IMsMethodCalculation;
Coord: IMsFormulaTransformCoord;
Res: IMsDiagnosticTestResults;
Stat: IChowTestLinRegress;
Coef: ICoefficients;
i: Integer;
arr: Array 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 Chow tests
Test := pTestList.FindByType(MsDiagnosticTestType.Chow);
TestSettings := Test.Settings As IMsChowTestSettings;
// set test type
TestSettings.TestType := ChowTestType.Forecast;
// set division into groups
Arr := New Integer[19];
Arr[0] := 1; Arr[1] := 1; Arr[2] := 1; Arr[3] := 1; Arr[4] := 0;
Arr[5] := 0; Arr[6] := 0; Arr[7] := 0; Arr[8] := 0; Arr[9] := 0;
Arr[10] := 0; Arr[11] := 0; Arr[12] := 0; Arr[13] := 0; Arr[14] := 0;
Arr[15] := 0; Arr[16] := 0; Arr[17] := 0; Arr[18] := 0;
TestSettings.GroupSeparator := Arr;
// 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
If Res.FTestResult Then
Debug.WriteLine("selections are uniform, hypothesis from absence of structure changes accepted");
Else
Debug.WriteLine("Selections are not uniform, hypothesis from absence of structure changes is not accepted");
End If;
Stat := Res.LR0;
Coef := Stat.ModelCoefficients.Coefficients;
Debug.WriteLine("-- Coefficients of first group --");
For i := 0 To Coef.Estimate.Length - 1 Do
Debug.WriteLine(" Coefficient " + i.ToString);
Debug.Write(" Value: ");
Debug.WriteLine(Coef.Estimate[i]);
Debug.Write(" Probability: ");
Debug.WriteLine(Coef.Probability[i]);
End For;
Stat := Res.LR1;
Coef := Stat.ModelCoefficients.Coefficients;
Debug.WriteLine("-- Coefficients of second group --");
For i := 0 To Coef.Estimate.Length - 1 Do
Debug.WriteLine(" Coefficient " + i.ToString);
Debug.Write(" Value: ");
Debug.WriteLine(Coef.Estimate[i]);
Debug.Write(" Probability: ");
Debug.WriteLine(Coef.Probability[i]);
End For;
End Sub UserProc;
The example displays setup of Chow diagnostic test parameters:
The significance level and test type are determined.
The groups of observations are determined.
After the testing the results are displayed in the console window.
See also: