MPTStat: IUnitRootTestStatistic;
MPTStat: Prognoz.Platform.Interop.Stat.IUnitRootTestStatistic;
The MPTStat property returns value of the Elliot-Rothenberg-Stock modified statisticsMPdt.
To get the value of the modified Phillips-Perron statistics, use the ISmNgPerronTest.MZaStat and ISmNgPerronTest.MZtStat properties.
To execute the example, add a link to the Stat system assembly.
Sub UserProc;
Var
NP: SmNgPerronTest;
MZaStat, MZtStat, MSBStat, MPTStat: IUnitRootTestStatistic;
can: Array[43] Of Double;
i, res: Integer;
Begin
NP := New SmNgPerronTest.Create;
// Set values for variables
can[0] := 6209; can[1] := 6385; can[2] := 6752; can[3] := Double.Nan; can[4] := 6495;
can[5] := Double.Nan; can[6] := 7349; can[7] := 7213; can[8] := 7061; can[9] := 7180;
can[10] := 7132; can[11] := 7137; can[12] := 7473; can[13] := 7722; can[14] := 8088;
can[15] := 8516; can[16] := 8941; can[17] := 9064; can[18] := 9380; can[19] := 9746;
can[20] := 9907; can[21] := 10333; can[22] := 10863; can[23] := 11693; can[24] := 12242;
can[25] := 12227; can[26] := 12910; can[27] := 13049; can[28] := 13384; can[29] := 14036;
can[30] := 14242; can[31] := 14704; can[32] := 13802; can[33] := 14197; can[34] := 15010;
can[35] := 15589; can[36] := 15932; can[37] := 16631; can[38] := 17394; can[39] := 17758;
can[40] := 17308; can[41] := 16444; can[42] := 16413;
//Select tested series
NP.Serie.Value := can;
// Type of tested series
NP.TestedSeries := ADFTestedSeriesType.Level;
// Method of missing data treatment
NP.MissingData.Method := MissingDataMethod.LinTrend;
// Model type
NP.Equation := EquationType.Constant;
// Method of calculation of adjusted residuals variance
NP.F0SpectrumEstimation := F0SpectrumEstimationType.BartlettKernel;
// Autoregression order
NP.AutoRegressionOrder := 9;
// Sample period
NP.ModelPeriod.FirstPoint := 1;
NP.ModelPeriod.LastPoint := 43;
res := NP.Execute;
For i := 0 To NP.WarningsCount - 1 Do
Debug.WriteLine(NP.Warnings[i]);
End For;
MZaStat := NP.MZaStat;
MZtStat := NP.MZtStat;
MSBStat := NP.MSBStat;
MPTStat := NP.MPTStat;
If res = 0 Then
Debug.WriteLine("===Display statistical values===");
Debug.WriteLine("MZaStat: ");
Debug.WriteLine("Statistics value: " + MZaStat.Statistics.ToString);
Debug.WriteLine("Probability value: " + MZaStat.Probability.ToString);
Debug.WriteLine("Critical values: ");
Debug.Indent;
For i := 0 To MZaStat.CriticalValues.Length - 1 Do
Debug.Write(i.ToString + " ");
Debug.WriteLine(MZaStat.CriticalValues[i]);
End For;
Debug.Unindent;
Debug.WriteLine("MZtStat: ");
Debug.WriteLine("Statistics value: " + MZtStat.Statistics.ToString);
Debug.WriteLine("Probability value: " + MZtStat.Probability.ToString);
Debug.WriteLine("Critical values: ");
Debug.Indent;
For i := 0 To MZtStat.CriticalValues.Length - 1 Do
Debug.Write(i.ToString + " ");
Debug.WriteLine(MZtStat.CriticalValues[i]);
End For;
Debug.Unindent;
Debug.WriteLine("MSBStat: ");
Debug.WriteLine("Statistics value: " + MSBStat.Statistics.ToString);
Debug.WriteLine("Probability value: " + MSBStat.Statistics.ToString);
Debug.WriteLine("Critical values: ");
Debug.Indent;
For i := 0 To MSBStat.CriticalValues.Length - 1 Do
Debug.Write(i.ToString + " ");
Debug.WriteLine(MSBStat.CriticalValues[i]);
End For;
Debug.Unindent;
Debug.WriteLine("MPTStat: ");
Debug.WriteLine("Statistics value: " + MPTStat.Statistics.ToString);
Debug.WriteLine("Probability value: " + MPTStat.Statistics.ToString);
Debug.WriteLine("Critical values: ");
Debug.Indent;
For i := 0 To MPTStat.CriticalValues.Length - 1 Do
Debug.Write(i.ToString + " ");
Debug.WriteLine(MPTStat.CriticalValues[i]);
End For;
Debug.Unindent;
Debug.WriteLine("===Descriptive characteristics of auxiliary regression===");
Debug.WriteLine("Adjusted residuals variance: " + NP.F0.ToString);
Else
Debug.WriteLine(NP.Errors);
End If;
End Sub UserProc;
After executing the example the console window displays calculation results for the Ng-Perron test.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Stat;
…
Public Shared Sub Main(Params: StartParams);
Var
NP: SmNgPerronTest;
can: Array[43] Of double;
i, res: integer;
Warnings, CriticalValues: Array;
Begin
NP := New SmNgPerronTestClass.Create();
// Set values for variables
can[0] := 6209; can[1] := 6385; can[2] := 6752; can[3] := Double.Nan; can[4] := 6495;
can[5] := Double.Nan; can[6] := 7349; can[7] := 7213; can[8] := 7061; can[9] := 7180;
can[10] := 7132; can[11] := 7137; can[12] := 7473; can[13] := 7722; can[14] := 8088;
can[15] := 8516; can[16] := 8941; can[17] := 9064; can[18] := 9380; can[19] := 9746;
can[20] := 9907; can[21] := 10333; can[22] := 10863; can[23] := 11693; can[24] := 12242;
can[25] := 12227; can[26] := 12910; can[27] := 13049; can[28] := 13384; can[29] := 14036;
can[30] := 14242; can[31] := 14704; can[32] := 13802; can[33] := 14197; can[34] := 15010;
can[35] := 15589; can[36] := 15932; can[37] := 16631; can[38] := 17394; can[39] := 17758;
can[40] := 17308; can[41] := 16444; can[42] := 16413;
//Select tested series
NP.Serie.Value := can;
// Type of tested series
NP.TestedSeries := ADFTestedSeriesType.adftstLevel;
// Method of missing data treatment
NP.MissingData.Method := MissingDataMethod.mdmLinTrend;
// Model type
NP.Equation := EquationType.etConstant;
// Method of calculation of adjusted residuals variance
NP.F0SpectrumEstimation := F0SpectrumEstimationType.f0setBartlettKernel;
// Autoregression order
NP.AutoRegressionOrder := 9;
// Sample period
NP.ModelPeriod.FirstPoint := 1;
NP.ModelPeriod.LastPoint := 43;
res := NP.Execute();
Warnings := NP.Warnings;
For i := 0 To NP.WarningsCount - 1 Do
System.Diagnostics.Debug.WriteLine(Warnings[i]);
End For;
If res = 0 Then
System.Diagnostics.Debug.WriteLine("===Display statistical values===");
System.Diagnostics.Debug.WriteLine("MZaStat: ");
System.Diagnostics.Debug.WriteLine("Statistics value: " + NP.MZaStat.Statistics.ToString());
System.Diagnostics.Debug.WriteLine("Probability value: " + NP.MZaStat.Probability.ToString());
System.Diagnostics.Debug.WriteLine("Critical values: ");
CriticalValues := NP.MZaStat.CriticalValues;
System.Diagnostics.Debug.Indent();
For i := 0 To NP.MZaStat.CriticalValues.Length - 1 Do
System.Diagnostics.Debug.Write(i.ToString() + " ");
System.Diagnostics.Debug.WriteLine(CriticalValues[i]);
End For;
System.Diagnostics.Debug.Unindent();
System.Diagnostics.Debug.WriteLine("MZtStat: ");
System.Diagnostics.Debug.WriteLine("Statistics value: " + NP.MZtStat.Statistics.ToString());
System.Diagnostics.Debug.WriteLine("Probability value: " + NP.MZtStat.Probability.ToString());
System.Diagnostics.Debug.WriteLine("Critical values: ");
CriticalValues := NP.MZtStat.CriticalValues;
System.Diagnostics.Debug.Indent();
For i := 0 To NP.MZtStat.CriticalValues.Length - 1 Do
System.Diagnostics.Debug.Write(i.ToString() + " ");
System.Diagnostics.Debug.WriteLine(CriticalValues[i]);
End For;
System.Diagnostics.Debug.Unindent();
System.Diagnostics.Debug.WriteLine("MSBStat: ");
System.Diagnostics.Debug.WriteLine("Statistics value: " + NP.MSBStat.Statistics.ToString());
System.Diagnostics.Debug.WriteLine("Probability value: " + NP.MSBStat.Probability.ToString());
System.Diagnostics.Debug.WriteLine("Critical values: ");
CriticalValues := NP.MSBStat.CriticalValues;
System.Diagnostics.Debug.Indent();
For i := 0 To NP.MSBStat.CriticalValues.Length - 1 Do
System.Diagnostics.Debug.Write(i.ToString() + " ");
System.Diagnostics.Debug.WriteLine(CriticalValues[i]);
End For;
System.Diagnostics.Debug.Unindent();
System.Diagnostics.Debug.WriteLine("MPTStat: ");
System.Diagnostics.Debug.WriteLine("Statistics value: " + NP.MPTStat.Statistics.ToString());
System.Diagnostics.Debug.WriteLine("Probability value: " + NP.MPTStat.Probability.ToString());
System.Diagnostics.Debug.WriteLine("Critical values: ");
CriticalValues := NP.MPTStat.CriticalValues;
System.Diagnostics.Debug.Indent();
For i := 0 To NP.MPTStat.CriticalValues.Length - 1 Do
System.Diagnostics.Debug.Write(i.ToString() + " ");
System.Diagnostics.Debug.WriteLine(CriticalValues[i]);
End For;
System.Diagnostics.Debug.Unindent();
System.Diagnostics.Debug.WriteLine("===Descriptive characteristics of auxiliary regression===");
System.Diagnostics.Debug.WriteLine("Adjusted residuals variance: " + NP.F0.ToString());
Else
System.Diagnostics.Debug.WriteLine(NP.Errors);
End If;
End Sub;
See also: