ParseAR(Value: String; [AssignOrder: Boolean = True]);
Value. String representation of autoregression order
AssignOrder. Indicates whether the obtained value is set to the ISlEquation.AutoRegressionOrder 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 ParseAR the obtained value is set to the ISlEquation.AutoRegressionOrder 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
x1, x2: Array[16] Of Double;
i, j, status: Integer;
VarModel: ISmVectorAutoRegress;
Eqs: ISlEquations;
Eq, Equations: ISlEquation;
Intercept: IIntercept;
EndogenousCoeff: ICoefficients;
Begin
VarModel := New SmVectorAutoRegress.Create;
// Endogenous variable 1
x1[0] := 3; x1[1] := 8; x1[2] := 12; x1[3] := 10;
x1[4] := 26; x1[5] := 21; x1[6] := 35; x1[7] := 29;
x1[8] := 40; x1[9] := 39; x1[10] := 51; x1[11] := 50;
x1[12] := 59; x1[13] := 58; x1[14] := 65; x1[15] := 72;
// Endogenous variable 2
x2[0] := 5; x2[1] := 3; x2[2] := 9; x2[3] := 13;
x2[4] := 25; x2[5] := 21; x2[6] := 30; x2[7] := 33;
x2[8] := 43; x2[9] := 37; x2[10] := 49; x2[11] := 47;
x2[12] := 60; x2[13] := 59; x2[14] := 69; x2[15] := 68;
// Sample period:
VarModel.ModelPeriod.FirstPoint := 1;
VarModel.ModelPeriod.LastPoint := 10;
// Parameters of equation collection:
Eqs := VarModel.Equations;
// ===Explained series 1===
Eq := Eqs.Add;
Eq.Serie.Value := x1;
Eq.Serie.Name := "x1";
// Autoregression order:
Eq.ParseAR("1",True);
// Last forecast point:
Eq.Forecast.LastPoint := 16;
// Parameters of equation constant:
Eq.Intercept.Mode := InterceptMode.AutoEstimate;
// ===Explained series 2===
Eq := Eqs.Add;
Eq.Serie.Value := x2;
Eq.Serie.Name := "x2";
// Autoregression order:
Eq.ParseAR("1",True);
// Last forecast point:
Eq.Forecast.LastPoint := 16;
// Parameters of equation constant:
Eq.Intercept.Mode := InterceptMode.AutoEstimate;
// ===Model calculation===
status := VarModel.Execute;
If status <> 0 Then
Debug.Writeline(VarModel.Errors);
Else
For i := 0 To Eqs.Count-1 Do
Debug.WriteLine("=== Equation coefficients " + (i+1).ToString + " ===");
Intercept := VarModel.Equations.Item(i).Intercept;
Debug.WriteLine("Constant "+Intercept.Estimate.ToString);
EndogenousCoeff := VarModel.Equations.Item(i).EndogenousCoefficients;
For j:=0 To EndogenousCoeff.Estimate.Length-1 Do
Equations := VarModel.Equations.Item(j);
Debug.WriteLine(Equations.Serie.Name+"[t-1]: " + Equations.EndogenousCoefficients.Estimate[j].ToString);
End For;
End For;
End If;
End Sub UserProc;
After executing the example the console window displays coefficients of vector autoregression equations:
See also: