OptimizationMethod: GARCHOptimizationMethod;
OptimizationMethod: Prognoz.Platform.Interop.Stat.GARCHOptimizationMethod;
The OptimizationMethod property determines the optimization method in use.
By default the Berndt-Hall-Hall-Hausman algorithm is used, that is, OptimizationMethod = GARCHOptimizationMethod.BHHH.
To execute the example, add a link to the Stat system assembly.
Sub UserProc;
Var
GARCH: ISmGARCH;
x: Array[10] Of Double;
y1, y2: Array[15] Of Double;
Res: Integer;
Begin
GARCH := New SmGARCH.Create;
// Set values fornbsp;variables
x[0] := 100; y1[0] := 120; y2[0] := 122;
x[1] := 111; y1[1] := 125; y2[1] := 127;
x[2] := 123; y1[2] := 124; y2[2] := 130;
x[3] := 113; y1[3] := 130; y2[3] := 135;
x[4] := 119; y1[4] := 133; y2[4] := 140;
x[5] := 121; y1[5] := 130; y2[5] := 149;
x[6] := 125; y1[6] := 139; y2[6] := 150;
x[7] := 131; y1[7] := 140; y2[7] := 155;
x[8] := 131; y1[8] := 140; y2[8] := 155;
x[9] := 131; y1[9] := 140; y2[9] := 150;
y1[10] := 129; y2[10] := 149;
y1[11] := 139; y2[11] := 150;
y1[12] := 140; y2[12] := 155;
y1[13] := 134; y2[13] := 145;
y1[14] := 140; y2[14] := 165;
// Set explained variable
GARCH.Explained.Value := x;
// Set explanatory variables
GARCH.Explanatories.Clear;
GARCH.Explanatories.Add.Value := y1;
GARCH.Explanatories.Add.Value := y2;
// Set parameters of the sample and forecast periods
GARCH.ModelPeriod.FirstPoint := 1;
GARCH.ModelPeriod.LastPoint := 10;
// Set forecasting series parameters
GARCH.Forecast.LastPoint := 15;
// Set constant determination mode
GARCH.Intercept.Mode := InterceptMode.AutoEstimate;
// Set optimization method
GARCH.OptimizationMethod := GARCHOptimizationMethod.BFGS;
// Calculate the method and output the results
res := GARCH.Execute;
Debug.WriteLine("Summary statistics:");
Debug.Indent;
Debug.WriteLine("Determination coefficient: " + GARCH.SummaryStatistics.R2.ToString);
Debug.WriteLine("Adjusted determination coefficient: " + GARCH.SummaryStatistics.AdjR2.ToString);
Debug.WriteLine("Standard regression error: " + GARCH.SummaryStatistics.SE.ToString);
Debug.WriteLine("Sum of residual squares: " + GARCH.SummaryStatistics.SSR.ToString);
Debug.WriteLine("Durbin-Watsonstatistic:"+GARCH.SummaryStatistics.DW.ToString); Debug.Unindent;
End Sub UserProc;
After executing the example the console window displays summary 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
GARCH: ISmGARCH;
x: Array[10] Of double;
y1, y2: Array[15] Of double;
Res: integer;
Begin
GARCH := New SmGARCH.Create();
// Set values fornbsp;variables
x[0] := 100; y1[0] := 120; y2[0] := 122;
x[1] := 111; y1[1] := 125; y2[1] := 127;
x[2] := 123; y1[2] := 124; y2[2] := 130;
x[3] := 113; y1[3] := 130; y2[3] := 135;
x[4] := 119; y1[4] := 133; y2[4] := 140;
x[5] := 121; y1[5] := 130; y2[5] := 149;
x[6] := 125; y1[6] := 139; y2[6] := 150;
x[7] := 131; y1[7] := 140; y2[7] := 155;
x[8] := 131; y1[8] := 140; y2[8] := 155;
x[9] := 131; y1[9] := 140; y2[9] := 150;
y1[10] := 129; y2[10] := 149;
y1[11] := 139; y2[11] := 150;
y1[12] := 140; y2[12] := 155;
y1[13] := 134; y2[13] := 145;
y1[14] := 140; y2[14] := 165;
// Set explained variable
GARCH.Explained.Value := x;
// Set explanatory variables
GARCH.Explanatories.Clear();
GARCH.Explanatories.Add().Value := y1;
GARCH.Explanatories.Add().Value := y2;
// Set parameters of the sample and forecast periods
GARCH.ModelPeriod.FirstPoint := 1;
GARCH.ModelPeriod.LastPoint := 10;
// Set forecasting series parameters
GARCH.Forecast.LastPoint := 15;
// Set constant determination mode
GARCH.Intercept.Mode := InterceptMode.imAutoEstimate;
// Set optimization method
GARCH.OptimizationMethod := GARCHOptimizationMethod.garchomBFGS;
// Calculate the method and output the results
res := GARCH.Execute();
System.Diagnostics.Debug.WriteLine("Summary statistics");
System.Diagnostics.Debug.Indent();
System.Diagnostics.Debug.WriteLine("Determination coefficient: " + GARCH.SummaryStatistics.R2.ToString());
System.Diagnostics.Debug.WriteLine("Adjusted determination coefficient: " + GARCH.SummaryStatistics.AdjR2.ToString());
System.Diagnostics.Debug.WriteLine("Standard error of regression: " + GARCH.SummaryStatistics.SE.ToString());
System.Diagnostics.Debug.WriteLine("Sum of residual squares: " + GARCH.SummaryStatistics.SSR.ToString());
System.Diagnostics.Debug.WriteLine("Durbin-Watsonstatistic:"+GARCH.SummaryStatistics.DW.ToString()); System.Diagnostics.Debug.Unindent();
End Sub;
See also: