ARCHCoefficients: IMSGARCHCoefficients;
ARCHCoefficients: Prognoz.Platform.Interop.Stat.IMSGARCHCoefficients;
The ARCHCoefficients property returns estimates of coefficients of autoregression of conditional heteroscedasticity (ARCH) of the model and their characteristics.
The number of coefficients must correspond to the ARCHOrder parameter.
To execute the example, add a link to the Stat system assembly.
Sub UserProc;
Var
SMG: ISmMarkovSwitchingGARCH;
ARCHCoef, RCoef, GARCHCoef: ICoefficients;
y: Array[5] Of Double;
x: Array[10] Of Double;
res, i: Integer;
Begin
SMG := New SmMarkovSwitchingGARCH.Create;
// Set values for variables
y[0] := 5.207664; x[0] := 1.9061476;
y[1] := 5.264373; x[1] := -0.26003;
y[2] := Double.Nan; x[2] := 9.54554;
y[3] := 5.702848; x[3] := 7.9776938;
y[4] := 5.996597; x[4] := Double.Nan;
x[5] := 12.719879;
x[6] := 13.875518;
x[7] := 16.046427;
x[8] := 17.218547;
x[9] := 21.07471;
// select explained series
SMG.Explained.Value := y;
// select explanatory series
SMG.Explanatories.Clear;
SMG.Explanatories.Add.Value := x;
// determine sample period
SMG.ModelPeriod.FirstPoint := 1;
SMG.ModelPeriod.LastPoint := 5;
// determine forecast period
SMG.Forecast.LastPoint := 10;
// select ARCH and GARCH orders
SMG.ARCHOrder := 1;
SMG.GARCHOrder := 1;
// select missing data treatment method
SMG.MissingData.Method := MissingDataMethod.LinTrend;
// determine Markov chain Monte Carlo algorithm parameters
SMG.MCMCParameters.NumOfIterations := 200;
SMG.MCMCParameters.IterationsToDiscard := 100;
SMG.MCMCParameters.Period := 20;
// use default initial values
SMG.UseDefaultInitDistribution := True;
// calculate model and output results
res := SMG.Execute;
Debug.WriteLine(SMG.Errors);
Debug.WriteLine("MS-GARCH model");
RCoef := SMG.RegressionCoefficients.Coefficients;
Debug.WriteLine("Coefficients");
For i := 0 To RCoef.Estimate.Length - 1 Do
Debug.WriteLine("X: " + RCoef.Estimate[i].ToString + ", Variance: " + RCoef.StandardError[i].ToString);
End For;
ARCHCoef := SMG.ARCHCoefficients.Coefficients;
For i := 0 To ARCHCoef.Estimate.Length - 1 Do
Debug.WriteLine("ARCH: " + ARCHCoef.Estimate[i].ToString + ", Variance: " + ARCHCoef.StandardError[i].ToString);
End For;
GARCHCoef := SMG.GARCHCoefficients.Coefficients;
For i := 0 To GARCHCoef.Estimate.Length - 1 Do
Debug.WriteLine("GARCH: " + GARCHCoef.Estimate[i].ToString + ", Variance: " + GARCHCoef.StandardError[i].ToString);
End For;
Debug.WriteLine("GARCH Const0: " + SMG.GARCHConst.Estimation.ToString + ", Variance: " + SMG.GARCHConst.Dispersion.ToString);
Debug.WriteLine("GARCH Const1: " + SMG.GARCHConst1.Estimation.ToString + ", Variance: " + SMG.GARCHConst1.Dispersion.ToString);
Debug.WriteLine("");
Debug.WriteLine("Modeling series");
For i := 0 To SMG.Fitted.Length - 1 Do
Debug.WriteLine((i + 1).ToString + " " + SMG.Fitted[i].ToString);
End For;
Debug.WriteLine("");
Debug.WriteLine("Residual series");
For i := 0 To SMG.Residuals.Length - 1 Do
Debug.WriteLine((i + 1).ToString + " " + SMG.Residuals[i].ToString);
End For;
Debug.WriteLine("");
Debug.WriteLine("Residual variances series");
For i := 0 To SMG.ResidualsDispersion.Length - 1 Do
Debug.WriteLine((i + 1).ToString + " " + SMG.ResidualsDispersion[i].ToString);
End For;
Debug.WriteLine("");
Debug.WriteLine("Forecast series");
For i := SMG.Fitted.Length To SMG.Forecast.Value.Length - 1 Do
Debug.WriteLine((i + 1).ToString + " " + SMG.Forecast.Value[i].ToString);
End For;
Debug.WriteLine("");
Debug.WriteLine("Residual variances forecast");
For i := SMG.ResidualsDispersion.Length To SMG.Forecast.Value.Length - 1 Do
Debug.WriteLine((i + 1).ToString + " " + SMG.ResidualsDispersionForecast[i].ToString);
End For;
End Sub UserProc;
After executing the example the console window displays regression coefficients, ARCH and GARCH, modeling series, residual series, residual variances series, forecasting series and residual variances forecast.
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
SMG: ISmMarkovSwitchingGARCH;
ARCHCoef, RCoef, GARCHCoef: ICoefficients;
y: Array[5] Of Double;
x: Array[10] Of Double;
res, i: Integer;
Begin
SMG := New SmMarkovSwitchingGARCH.Create();
// Set values for variables
y[0] := 5.207664; x[0] := 1.9061476;
y[1] := 5.264373; x[1] := -0.26003;
y[2] := Double.Nan; x[2] := 9.54554;
y[3] := 5.702848; x[3] := 7.9776938;
y[4] := 5.996597; x[4] := Double.Nan;
x[5] := 12.719879;
x[6] := 13.875518;
x[7] := 16.046427;
x[8] := 17.218547;
x[9] := 21.07471;
// select explained series
SMG.Explained.Value := y;
// select explanatory series
SMG.Explanatories.Clear();
SMG.Explanatories.Add().Value := x;
// determine sample period
SMG.ModelPeriod.FirstPoint := 1;
SMG.ModelPeriod.LastPoint := 5;
// determine forecast period
SMG.Forecast.LastPoint := 10;
// select ARCH and GARCH orders
SMG.ARCHOrder := 1;
SMG.GARCHOrder := 1;
// select missing data treatment method
SMG.MissingData.Method := MissingDataMethod.mdmLinTrend;
// determine Markov chain Monte Carlo algorithm parameters
SMG.MCMCParameters.NumOfIterations := 200;
SMG.MCMCParameters.IterationsToDiscard := 100;
SMG.MCMCParameters.Period := 20;
// use default initial values
SMG.UseDefaultInitDistribution := True;
// calculate model and output results
res := SMG.Execute();
System.Diagnostics.Debug.WriteLine(SMG.Errors);
System.Diagnostics.Debug.WriteLine("MS-GARCH model");
RCoef := SMG.RegressionCoefficients.Coefficients;
System.Diagnostics.Debug.WriteLine("Coefficients");
For i := 0 To RCoef.Estimate.Length - 1 Do
System.Diagnostics.Debug.WriteLine("X: " + RCoef.Estimate.GetValue(i).ToString() + ", Variance: " + RCoef.StandardError.GetValue(i).ToString());
End For;
ARCHCoef := SMG.ARCHCoefficients.Coefficients;
For i := 0 To ARCHCoef.Estimate.Length - 1 Do
System.Diagnostics.Debug.WriteLine("ARCH: " + ARCHCoef.Estimate.GetValue(i).ToString() + ", Variance: " + ARCHCoef.StandardError.GetValue(i).ToString());
End For;
GARCHCoef := SMG.GARCHCoefficients.Coefficients;
For i := 0 To GARCHCoef.Estimate.Length - 1 Do
System.Diagnostics.Debug.WriteLine("GARCH: " + GARCHCoef.Estimate.GetValue(i).ToString() + ", Variance: " + GARCHCoef.StandardError.GetValue(i).ToString());
End For;
System.Diagnostics.Debug.WriteLine("GARCH Const0: " + SMG.GARCHConst.Estimation.ToString() + ", Variance: " + SMG.GARCHConst.Dispersion.ToString());
System.Diagnostics.Debug.WriteLine("GARCH Const1: " + SMG.GARCHConst1.Estimation.ToString() + ", Variance: " + SMG.GARCHConst1.Dispersion.ToString());
System.Diagnostics.Debug.WriteLine("");
System.Diagnostics.Debug.WriteLine("Modeling series");
For i := 0 To SMG.Fitted.Length - 1 Do
System.Diagnostics.Debug.WriteLine((i + 1).ToString() + " " + SMG.Fitted.GetValue(i).ToString());
End For;
System.Diagnostics.Debug.WriteLine("");
System.Diagnostics.Debug.WriteLine("Residual series");
For i := 0 To SMG.Residuals.Length - 1 Do
System.Diagnostics.Debug.WriteLine((i + 1).ToString() + " " + SMG.Residuals.GetValue(i).ToString());
End For;
System.Diagnostics.Debug.WriteLine("");
System.Diagnostics.Debug.WriteLine("Residual variances series");
For i := 0 To SMG.ResidualsDispersion.Length - 1 Do
System.Diagnostics.Debug.WriteLine((i + 1).ToString() + " " + SMG.ResidualsDispersion.GetValue(i).ToString());
End For;
System.Diagnostics.Debug.WriteLine("");
System.Diagnostics.Debug.WriteLine("Forecast series");
For i := SMG.Fitted.Length To SMG.Forecast.Value.Length - 1 Do
System.Diagnostics.Debug.WriteLine((i + 1).ToString() + " " + SMG.Forecast.Value.GetValue(i).ToString());
End For;
System.Diagnostics.Debug.WriteLine("");
System.Diagnostics.Debug.WriteLine("Residual variances forecast");
For i := SMG.ResidualsDispersion.Length To SMG.Forecast.Value.Length - 1 Do
System.Diagnostics.Debug.WriteLine((i + 1).ToString() + " " + SMG.ResidualsDispersionForecast.GetValue(i).ToString());
End For;
End Sub;
See also: