MCMCParameters: IMCMCParameters;
The MCMCParameters property returns parameters of the Markov chain Monte Carlo algorithm (Markov Chain Monte Carlo).
To determine ARCH and GARCH orders, use the ISmMarkovSwitchingGARCH.ARCHOrder and ISmMarkovSwitchingGARCH.GARCHOrder properties.
To execute the example, add a link to the Stat system assembly.
Sub UserProc;
Var
SMG: ISmMarkovSwitchingGARCH;
y: Array[5] Of Double;
x: Array[10] Of Double;
M: Array[1] Of Double;
CM: Array[1, 1] 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;
// sample period
SMG.ModelPeriod.FirstPoint := 1;
SMG.ModelPeriod.LastPoint := 5;
// forecast
SMG.Forecast.LastPoint := 10;
// ARCH and GARCH orders
SMG.ARCHOrder := 1;
SMG.GARCHOrder := 1;
// missing data treatment
SMG.MissingData.Method := MissingDataMethod.LinTrend;
// parameters of Markov chain Monte Carlo algorithm
SMG.MCMCParameters.NumOfIterations := 200;
SMG.MCMCParameters.IterationsToDiscard := 100;
SMG.MCMCParameters.Period := 20;
// Primary values are not used by default
SMG.UseDefaultInitDistribution := False;
M[0] := 0;
CM[0, 0] := 1;
// values of mean and covariance matrix for generation of regression coefficients
SMG.RegressionCoefficients.InitMeanValues := M;
SMG.RegressionCoefficients.InitCovarianceMatrix := CM;
// values of mean and covariance matrix for generation of ARCH coefficients
SMG.ARCHCoefficients.InitMeanValues := M;
SMG.ARCHCoefficients.InitCovarianceMatrix := CM;
// values of mean and covariance matrix for generation of GARCH coefficients
SMG.GARCHCoefficients.InitMeanValues := M;
SMG.GARCHCoefficients.InitCovarianceMatrix := CM;
SMG.GARCHConst.InitMeanValue := 0;
SMG.GARCHConst.InitDispersion := 1;
SMG.GARCHConst1.InitMeanValue := 0;
SMG.GARCHConst1.InitDispersion := 1;
// distribution parameters for transition probability
SMG.P00Distribution.A := 9;
SMG.P00Distribution.B := 1;
SMG.P11Distribution.A := 9;
SMG.P11Distribution.B := 1;
// calculate model
res := SMG.Execute;
Debug.WriteLine(SMG.Errors);
Debug.WriteLine("------------------------------Model MS-GARCH------------------------------------------");
Debug.WriteLine("***Coefficients***");
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("***Estimates of parameters of switching from 0 to 0 state***");
Debug.WriteLine("Estimated values of model coefficients: " + SMG.P00.Estimation.ToString);
Debug.WriteLine("Variance: " + SMG.P00.Dispersion.ToString);
Debug.WriteLine("");
Debug.WriteLine("***Estimates of parameters of switching from 1 to 1 state***");
Debug.WriteLine("Estimated values of model coefficients: " + SMG.P11.Estimation.ToString);
Debug.WriteLine("Variance: " + SMG.P11.Dispersion.ToString);
Debug.WriteLine("");
Debug.WriteLine("***Descriptive characteristics of the model***");
Debug.WriteLine("Number of iterations: " + SMG.SummaryStatistics.NumOfIter.ToString);
Debug.WriteLine("");
Debug.WriteLine("***Estimates of conditional probabilities***");
For i := 0 To SMG.ConditionalStateProbabilities.Length - 1 Do
Debug.WriteLine((i + 1).ToString + ": " + SMG.ConditionalStateProbabilities[i].ToString);
End For;
Debug.WriteLine("");
End Sub UserProc;
As a result of the example execution, the following settings are defined:
Sample period and forecast parameters are set manually.
Orders of autoregression of conditional heteroscedasticity and generalized autoregression of conditional heteroscedasticity are set manually.
Method of missing data treatment is set.
Parameters of the Markov chain Monte Carlo algorithm are set.
The console window displays estimates of GARCH coefficients μ0 and estimates of transition parameters μ1, descriptive characteristics of model and estimates of conditional probabilities.
See also: