CoefficientsAR: ICoefficients;
The CoefficientsAR property returns coefficients of non-seasonal autoregression.
To get moving average coefficients, use the ISlARMAGARCH.CoefficientsMA property.
To execute the example, add a link to the Stat system assembly.
Sub UserProc;
Var
armagarch: ISmGARCH;
W: Array[12] Of Double;
X: Array[20] Of Double;
ARMA: ISlARMAGARCH;
AR, MA: Array[1] Of Integer;
Inits: Array[1] Of Double;
res: Integer;
d: Double;
CoefficientsAR, CoefficientsMA: ICoefficients;
GARCHCoefficients: IGARCHCoefficients;
Begin
armagarch := New SmGARCH.Create;
// explanatory series values
w[0] := 2; w[4] := -1.9; w[8] := -0.7;
w[1] := 0.8; w[5] := Double.Nan; w[9] := Double.Nan;
w[2] := -0.3; w[6] := 3.2; w[10] := 4.3;
w[3] := -0.3; w[7] := 1.6; w[11] := 1.1;
armagarch.Explained.Value := w;
// explanatory series values
x[0] := Double.Nan; x[10] := 11;
x[1] := 2; x[11] := 12;
x[2] := 3; x[12] := 13;
x[3] := 4; x[13] := Double.Nan;
x[4] := 5; x[14] := 15;
x[5] := 6; x[15] := 16;
x[6] := Double.Nan; x[16] := 17;
x[7] := 8; x[17] := Double.Nan;
x[8] := 9; x[18] := 19;
x[9] := 10; x[19] := 20;
// sample period
armagarch.ModelPeriod.FirstPoint := 1;
armagarch.ModelPeriod.LastPoint := 12;
armagarch.Forecast.LastPoint := 19;
// Method of missing data treatment
armagarch.MissingData.Method := MissingDataMethod.AnyValue;
// exogenous variable is used in the model
armagarch.Explanatories.Clear;
armagarch.Explanatories.Add.Value := X;
// initial approximations of exogenous variable
armagarch.Explanatories.Item(0).InitValue := 0.7;
GARCHCoefficients := armagarch.GARCHCoefficients;
ARMA := armagarch.ARMA;
// autoregression order
AR[0] := 2;
ARMA.OrderAR := AR;
// moving average order
MA[0] := 1;
ARMA.OrderMA := MA;
// initial approximations of autoregression
Inits[0] := 0.2;
ARMA.InitAR := Inits;
// initial approximations of moving average
Inits[0] := 0.3;
ARMA.InitMA := Inits;
// calculate model
res := armagarch.Execute;
Debug.WriteLine(armagarch.Errors);
If (res = 0) Then
// autoregression coefficients
Debug.WriteLine("Autoregression coefficients estimates");
CoefficientsAR := ARMA.CoefficientsAR;
Debug.Indent;
d := CoefficientsAR.Estimate[0];
Debug.WriteLine("Value: " + d.ToString);
d := CoefficientsAR.StandardError[0];
Debug.WriteLine("Standard error: " + d.ToString);
d := CoefficientsAR.TStatistic[0];
Debug.WriteLine("t-statistic: " + d.ToString);
d := CoefficientsAR.Probability[0];
Debug.WriteLine("Probability: " + d.ToString);
Debug.Unindent;
// moving average coefficients
Debug.WriteLine("Estimates of moving average coefficients");
CoefficientsMA := ARMA.CoefficientsMA;
Debug.Indent;
d := CoefficientsMA.Estimate[0];
Debug.WriteLine("Value: " + d.ToString);
d := CoefficientsMA.StandardError[0];
Debug.WriteLine("Standard error: " + d.ToString);
d := CoefficientsMA.TStatistic[0];
Debug.WriteLine("t-statistic: " + d.ToString);
d := CoefficientsMA.Probability[0];
Debug.WriteLine("Probability: " + d.ToString);
Debug.Unindent;
End If;
End Sub UserProc;
As a result of the example execution, the following settings are defined:
Sample period and calculation period start date are set manually.
Autoregression order equals to 2.
Moving average order equals to 1.
Initial approximations of autoregression and moving average are set.
The console window displays estimates of autoregression coefficients and moving average coefficients.
See also: