ADFStat:IUnitRootTestStatistic;
ADFStat:Prognoz.Platform.Interop.Stat.IUnitRootTestStatistic;
The ADFstat property returns value of the augmented Dickey-Fuller test.
To get summary statistics, use the ISmAugmentDickeyFullerTest.SummaryStatistics property.
To execute the example, add a link to the Stat system assembly.
Sub UserProc;
Var
ADF: SmAugmentDickeyFullerTest;
ADFASS: IAutomaticLagSelectionSettings;
SumStat: ISummaryStatistics;
i, res: Integer;
can: Array[43] Of Double;
Begin
ADF := New SmAugmentDickeyFullerTest.Create;
// Set values fornbsp;variables
can[0] := 6209; can[1] := 6385; can[2] := Double.Nan; can[3] := 6837; can[4] := 6495;
can[5] := 6907; 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;
// Tested data series
ADF.Serie.Value := can;
// Method of missing data treatment
ADF.MissingData.Method := MissingDataMethod.LinTrend;
// Sample period
ADF.ModelPeriod.FirstPoint := 1;
ADF.ModelPeriod.LastPoint := 43;
// Model specification
ADF.EquationType := ADFEquationType.ConstantTrend;
// Lag autoselection is applied
ADF.UseAutomaticAROrderSelection := True;
// Lag autoselection parameters
ADFASS := ADF.AutomaticAROrderSelectionSettings;
ADFASS.InformationCriterion := InformationCriterionType.Akaike;
ADFASS.MaxLagLength := 9;
// Type of tested series
ADF.TestedSeries := ADFTestedSeriesType.Level;
res := ADF.Execute;
If res = 0 Then
Debug.WriteLine("===Augmented Dickey-Fuller test statistic===");
Debug.WriteLine("Statistics value: " + ADF.ADFStat.Statistic.ToString);
Debug.WriteLine("Probability value: " + ADF.ADFStat.Probability.ToString);
Debug.WriteLine("Critical values");
Debug.Indent;
For i := 0 To ADF.ADFStat.CriticalValues.Length - 1 Do
Debug.Write(i.ToString + " ");
Debug.WriteLine(ADF.ADFStat.CriticalValues[i]);
End For;
Debug.Unindent;
Else
Debug.WriteLine(ADF.Errors);
End If;
End Sub UserProc;
After executing the example the console window shows calculation results for the augmented Dickey-Fuller 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
ADF: SmAugmentDickeyFullerTest;
ADFASS: IAutomaticLagSelectionSettings;
SumStat: ISummaryStatistics;
i, res: integer;
can: Array[43] Of double;
ADFStat: Array;
Begin
ADF := New SmAugmentDickeyFullerTestClass.Create();
// Set values fornbsp;variables
can[0] := 6209; can[1] := 6385; can[2] := 6752; can[3] := 6837; can[4] := 6495;
can[5] := 6907; 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;
// Tested data series
ADF.Serie.Value := can;
// Method of missing data treatment
ADF.MissingData.Method := MissingDataMethod.mdmLinTrend;
// Sample period
ADF.ModelPeriod.FirstPoint := 1;
ADF.ModelPeriod.LastPoint := 43;
// Model specification
ADF.EquationType := ADFEquationType.adfetConstantTrend;
// Lag autoselection is applied
ADF.UseAutomaticAROrderSelection := True;
// Lag autoselection parameters
ADFASS := ADF.AutomaticAROrderSelectionSettings;
ADFASS.InformationCriterion := InformationCriterionType.icAkaike;
ADFASS.MaxLagLength := 9;
// Type of tested series
ADF.TestedSeries := ADFTestedSeriesType.adftstLevel;
res := ADF.Execute();
If res = 0 Then
System.Diagnostics.Debug.WriteLine("===Augmented Dickey-Fuller test statistic===");
System.Diagnostics.Debug.WriteLine("Statistics value: " + ADF.ADFStat.Statistic.ToString());
System.Diagnostics.Debug.WriteLine("Probability value: " + ADF.ADFStat.Probability.ToString());
System.Diagnostics.Debug.WriteLine("Critical values");
ADFStat := ADF.ADFStat.CriticalValues;
System.Diagnostics.Debug.Indent();
For i := 0 To ADF.ADFStat.CriticalValues.Length - 1 Do
System.Diagnostics.Debug.Write(i.ToString() + " ");
System.Diagnostics.Debug.WriteLine(ADFStat[i]);
End For;
System.Diagnostics.Debug.Unindent();
Else
System.Diagnostics.Debug.WriteLine(ADF.Errors);
End If;
End Sub;
See also: