ParseAR(Value: String; [AssignOrder: Boolean = True]);
Value. String representation of autoregression order.
AssignOrder. Indicates whether the obtained value is set into the ISlARMAGARCH.OrderAR property.
The ParseAR method parses strings with parameters of non-seasonal autoregression.
The Value parameter should contain numbers or ranges of autoregression orders, separated with commas. For example:
ParseAR("1-3,5,7-9", True);
If AssignOrder = True, after executing the ParseAR the obtained value is set into the ISlARMAGARCH.OrderAR property. If AssignOrder = False, the order of parameters of non-seasonal autoregression is unchanged.
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;
// parsing strings with AR and MA
armagarch.ARMA.ParseAR("2", True);
armagarch.ARMA.ParseMA("1", True);
ARMA := armagarch.ARMA;
// 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);
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);
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 parameter equals to 2.
Moving average parameter 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: