AutomaticAROrderSelectionSettings: IAutomaticLagSelectionSettings;
AutomaticAROrderSelectionSettings: Prognoz.Platform.Interop.Stat.IAutomaticLagSelectionSettings;
The AutomaticAROrderSelectionSettings property returns parameters of lag autoselection.
To determine whether the lag autoselection is applied, use the ISmEngleGrangerTest.UseAutomaticAROrderSelection property.
To execute the example, add a link to the Stat system assembly.
Sub UserProc;
Var
eg: SmEngleGrangerTest;
can, fra, ger: Array[36] Of Double;
res, i: Integer;
Begin
eg := New SmEngleGrangerTest.Create;
// Values of variables:
can[00] := 6209; can[01] := 6385; can[02] := 6752; can[03] := 6837;
can[04] := 6495; can[05] := 6907; can[06] := 7349; can[07] := 7213;
can[08] := 7061; can[09] := 7180; can[10] := 7132; can[11] := Double.Nan;
can[12] := 7473; can[13] := 7722; can[14] := 8088; can[15] := Double.Nan;
can[16] := 8941; can[17] := 9064; can[18] := 9380; can[19] := 9746;
can[20] := 9907; can[21] := 10333; can[22] := 10863; can[23] := Double.Nan;
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;
fra[00] := 4110; fra[01] := 4280; fra[02] := 4459; fra[03] := 4545;
fra[04] := 4664; fra[05] := 4861; fra[06] := 5195; fra[07] := 5389;
fra[08] := 5463; fra[09] := 5610; fra[10] := 5948; fra[11] := 6218;
fra[12] := 6521; fra[13] := 6788; fra[14] := 7222; fra[15] := 7486;
fra[16] := 7832; fra[17] := 8153; fra[18] := 8468; fra[19] := 9054;
fra[20] := 9499; fra[21] := 9866; fra[22] := 10217; fra[23] := 10763;
fra[24] := 10683; fra[25] := 10494; fra[26] := 10938; fra[27] := 11198;
fra[28] := 11546; fra[29] := 11865; fra[30] := 11781; fra[31] := 11681;
fra[32] := 11903; fra[33] := 11900; fra[34] := 11986; fra[35] := 12206;
ger[00] := 3415; ger[01] := 3673; ger[02] := 4013; ger[03] := 4278;
ger[04] := 4577; ger[05] := 5135; ger[06] := 5388; ger[07] := 5610;
ger[08] := 5787; ger[09] := 6181; ger[10] := 6633; ger[11] := 6910;
ger[12] := 7146; ger[13] := 7248; ger[14] := 7689; ger[15] := 8046;
ger[16] := 8143; ger[17] := 8064; ger[18] := 8556; ger[19] := 9177;
ger[20] := 9705; ger[21] := 9923; ger[22] := 10268; ger[23] := 10681;
ger[24] := 10448; ger[25] := 10366; ger[26] := 10958; ger[27] := 11292;
ger[28] := 11726; ger[29] := 12172; ger[30] := 12058; ger[31] := 11804;
ger[32] := 11682; ger[33] := 12001; ger[34] := 12300; ger[35] := 12535;
// Sample period:
eg.ModelPeriod.FirstPoint := 1;
eg.ModelPeriod.LastPoint := 35;
// Explained series:
eg.Explained.Value := can;
// Cointegration regressors:
eg.CointegratingRegressors.Clear;
eg.CointegratingRegressors.Add.Value := ger;
// Determinate regressors:
eg.DeterministicRegressors.Clear;
eg.DeterministicRegressors.Add.Value := fra;
// Missing data treatment:
eg.MissingData.Method := MissingDataMethod.Casewise;
// Trend specification:
eg.TrendSpecification := TrendSpecificationType.LinearNone;
// Lag autoselection:
eg.UseAutomaticAROrderSelection := True;
eg.AutomaticAROrderSelectionSettings.InformationCriterion := InformationCriterionType.Akaike;
eg.AutomaticAROrderSelectionSettings.MaxLagLength := 1;
// Read number of freedom degrees:
eg.DFAdjustment := True;
// Model calculation:
res := eg.Execute;
Debug.WriteLine(eg.Errors);
For i := 0 To eg.WarningsCount-1 Do
Debug.WriteLine(eg.Warnings[i]);
End For;
Debug.WriteLine("=== Test statistics ===");
Debug.Indent;
Debug.WriteLine("Tau " + eg.TauStat.Statistic.ToString + " " + eg.TauStat.Probability.ToString);
Debug.WriteLine("Z " + eg.ZStat.Statistic.ToString + " " + eg.ZStat.Probability.ToString);
Debug.Unindent;
Debug.WriteLine("=== Model coefficient estimates ===");
Debug.Indent;
For i := 0 To eg.ModelCoefficients.Estimate.Length-1 Do
Debug.WriteLine(eg.ModelCoefficients.Estimate[i].ToString + " "
+ eg.ModelCoefficients.StandardError[i].ToString + " "
+ eg.ModelCoefficients.TStatistic[i].ToString + " "
+ eg.ModelCoefficients.Probability[i].ToString);
End For;
Debug.Unindent;
Debug.WriteLine("=== Auxiliary regression characteristics ===");
Debug.Indent;
Debug.WriteLine("Determination coefficient: " + eg.SummaryStatistics.R2.ToString);
Debug.WriteLine("Adjusted determination coefficient: " + eg.SummaryStatistics.AdjR2.ToString);
Debug.WriteLine("Standard regression error: " + eg.SummaryStatistics.SE.ToString);
Debug.WriteLine("Durbin-Watson statistic: " + eg.SummaryStatistics.DW.ToString);
Debug.Unindent;
End Sub UserProc;
After executing the example the console window displays the following:
Test statistics values.
Estimations of model coefficients.
Auxiliary regression characteristics.
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
eg: SmEngleGrangerTest;
can, fra, ger: array[36] Of double;
res, i: integer;
Warnings, Est, StError, TStat, Prob: System.Array;
Begin
eg := New SmEngleGrangerTest.Create();
// Values of variables:
can[00] := 6209; can[01] := 6385; can[02] := 6752; can[03] := 6837;
can[04] := 6495; can[05] := 6907; can[06] := 7349; can[07] := 7213;
can[08] := 7061; can[09] := 7180; can[10] := 7132; can[11] := Double.Nan;
can[12] := 7473; can[13] := 7722; can[14] := 8088; can[15] := Double.Nan;
can[16] := 8941; can[17] := 9064; can[18] := 9380; can[19] := 9746;
can[20] := 9907; can[21] := 10333; can[22] := 10863; can[23] := Double.Nan;
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;
fra[00] := 4110; fra[01] := 4280; fra[02] := 4459; fra[03] := 4545;
fra[04] := 4664; fra[05] := 4861; fra[06] := 5195; fra[07] := 5389;
fra[08] := 5463; fra[09] := 5610; fra[10] := 5948; fra[11] := 6218;
fra[12] := 6521; fra[13] := 6788; fra[14] := 7222; fra[15] := 7486;
fra[16] := 7832; fra[17] := 8153; fra[18] := 8468; fra[19] := 9054;
fra[20] := 9499; fra[21] := 9866; fra[22] := 10217; fra[23] := 10763;
fra[24] := 10683; fra[25] := 10494; fra[26] := 10938; fra[27] := 11198;
fra[28] := 11546; fra[29] := 11865; fra[30] := 11781; fra[31] := 11681;
fra[32] := 11903; fra[33] := 11900; fra[34] := 11986; fra[35] := 12206;
ger[00] := 3415; ger[01] := 3673; ger[02] := 4013; ger[03] := 4278;
ger[04] := 4577; ger[05] := 5135; ger[06] := 5388; ger[07] := 5610;
ger[08] := 5787; ger[09] := 6181; ger[10] := 6633; ger[11] := 6910;
ger[12] := 7146; ger[13] := 7248; ger[14] := 7689; ger[15] := 8046;
ger[16] := 8143; ger[17] := 8064; ger[18] := 8556; ger[19] := 9177;
ger[20] := 9705; ger[21] := 9923; ger[22] := 10268; ger[23] := 10681;
ger[24] := 10448; ger[25] := 10366; ger[26] := 10958; ger[27] := 11292;
ger[28] := 11726; ger[29] := 12172; ger[30] := 12058; ger[31] := 11804;
ger[32] := 11682; ger[33] := 12001; ger[34] := 12300; ger[35] := 12535;
// Sample period:
eg.ModelPeriod.FirstPoint := 1;
eg.ModelPeriod.LastPoint := 35;
// Explained series:
eg.Explained.Value := can;
// Cointegration regressors:
eg.CointegratingRegressors.Clear();
eg.CointegratingRegressors.Add().Value := ger;
// Determinate regressors:
eg.DeterministicRegressors.Clear();
eg.DeterministicRegressors.Add().Value := fra;
// Missing data treatment:
eg.MissingData.Method := MissingDataMethod.mdmCasewise;
// Trend specification:
eg.TrendSpecification := TrendSpecificationType.tstLinearNone;
// Lag autoselection:
eg.UseAutomaticAROrderSelection := True;
eg.AutomaticAROrderSelectionSettings.InformationCriterion := InformationCriterionType.icAkaike;
eg.AutomaticAROrderSelectionSettings.MaxLagLength := 1;
// Read number of freedom degrees:
eg.DFAdjustment := True;
// Model calculation:
res := eg.Execute();
System.Diagnostics.Debug.WriteLine(eg.Errors);
Warnings := eg.Warnings;
For i := 0 To eg.WarningsCount-1 Do
System.Diagnostics.Debug.WriteLine(Warnings[i]);
End For;
System.Diagnostics.Debug.WriteLine("=== Test statistics ===");
System.Diagnostics.Debug.Indent();
System.Diagnostics.Debug.WriteLine("Tau " + eg.TauStat.Statistic.ToString() + " " + eg.TauStat.Probability.ToString());
System.Diagnostics.Debug.WriteLine("Z " + eg.ZStat.Statistic.ToString() + " " + eg.ZStat.Probability.ToString());
System.Diagnostics.Debug.Unindent();
System.Diagnostics.Debug.WriteLine("=== Model coefficient estimates
System.Diagnostics.Debug.Indent();
Est := eg.ModelCoefficients.Estimate;
StError := eg.ModelCoefficients.StandardError;
TStat := eg.ModelCoefficients.TStatistic;
Prob := eg.ModelCoefficients.Probability;
For i := 0 To eg.ModelCoefficients.Estimate.Length-1 Do
System.Diagnostics.Debug.WriteLine(Est[i].ToString() + " " + StError[i].ToString() + " "
+ TStat[i].ToString() + " " + Prob[i].ToString());
End For;
System.Diagnostics.Debug.Unindent();
System.Diagnostics.Debug.WriteLine("=== Auxiliary regression characteristics ===");
System.Diagnostics.Debug.Indent();
System.Diagnostics.Debug.WriteLine("Determination coefficient: " + eg.SummaryStatistics.R2.ToString());
System.Diagnostics.Debug.WriteLine("Adjusted determination coefficient: " + eg.SummaryStatistics.AdjR2.ToString());
System.Diagnostics.Debug.WriteLine("Standard regression error: " + eg.SummaryStatistics.SE.ToString());
System.Diagnostics.Debug.WriteLine("Durbin-Watson statistic:"+eg.SummaryStatistics.DW.ToString()); System.Diagnostics.Debug.Unindent();
End Sub;
See also: