CointegralCoefficients: ICoefficients;
The CointegralCoefficients property returns coefficients of cointegration equations.
These coefficients are calculated if the cointegration relationships are specified.
Sub Main;
Var
y1, y2: Array[23] Of Double;
CI: Array Of Double;
Per: IStatPeriod;
i, j, res: Integer;
d: Double;
ECM: ISmErrorCorrectionModel;
Eqs: ISlEquations;
Eq: ISlEquation;
ARO: Array[1] Of Integer;
Begin
// array values y1, y2
y1[00] := 6209; y2[00] := 4110;
y1[01] := 6385; y2[01] := 4280;
y1[02] := 6752; y2[02] := 4459;
y1[03] := 6837; y2[03] := 4545;
y1[04] := 6495; y2[04] := 4664;
y1[05] := 6907; y2[05] := 4861;
y1[06] := 7349; y2[06] := Double.Nan;
y1[07] := 7213; y2[07] := Double.Nan;
y1[08] := 7061; y2[08] := Double.Nan;
y1[09] := 7180; y2[09] := 5610;
y1[10] := 7132; y2[10] := 5948;
y1[11] := 7137; y2[11] := 6218;
y1[12] := 7473; y2[12] := 6521;
y1[13] := 7722; y2[13] := 6788;
y1[14] := 8088; y2[14] := 7222;
y1[15] := 8516; y2[15] := 7486;
y1[16] := 8941; y2[16] := 7832;
y1[17] := 9064; y2[17] := 8153;
y1[18] := 9380; y2[18] := 8468;
y1[19] := 9746; y2[19] := 9054;
y1[20] := 9907; y2[20] := 9499;
y1[21] := 10333; y2[21] := 9866;
y1[22] := 10863; y2[22] := 10217;
ARO[0] := 1;
ECM := New SmErrorCorrectionModel.Create;
Eqs := ECM.Equations;
Eq := Eqs.Add;
Eq.Serie.Value := y1;
Eq.AutoRegressionOrder := ARO;
Eq.Forecast.LastPoint := 30;
Eq := Eqs.Add;
Eq.Serie.Value := y2;
Eq.AutoRegressionOrder := ARO;
Eq.Forecast.LastPoint := 30;
ECM.CointegralCount := 1;
ECM.ModelType := ECMType.NoTrendNoIntercept;
Ecm.ModelPeriod.FirstPoint := 1;
Ecm.ModelPeriod.LastPoint := 23;
Ecm.MissingData.Method := MissingDataMethod.Casewise;
res := Ecm.Execute;
Debug.WriteLine(" == Execution status: " + res.ToString);
Debug.WriteLine(" == Message: " + Ecm.Errors);
//Cointegration equation
CI := New Double[3];
Debug.WriteLine(" == Cointegration equations == ");
For i := 0 To Ecm.CointegralCount-1 Do //by equations
CI := Ecm.CointegralEquations.Item(i).Value;
For j := 0 To CI.Length-1 Do
d := CI[j];
If (ECM.ModelType = ECMType.NoTrendIntercept)And(j = CI.Length-1) Then
Debug.WriteLine(i.ToString + ", const " + d.ToString);
Else
Debug.WriteLine('(' +i.ToString + ", " + j.ToString + "): " + d.ToString);
End If;
End For;
Debug.WriteLine("======");
End For;
//Cointegration link coefficients
Debug.WriteLine(" == Cointegration links coefficients == ");
For i := 0 To Ecm.Equations.Count-1 Do //by equations
d := Ecm.Equations.Item(i).CointegralCoefficients.Estimate[0];
Debug.WriteLine(i.ToString+ ": " +d.ToString);
End For;
Debug.WriteLine("======");
End Sub Main;
After executing the example the console window displays the following data:
Module execution started
== Execution status: 0
== Message: No errors
== Cointegration equations ==
(0, 0): 1
(0, 1): -4.7243415441901586
======
== Cointegration links coefficients ==
0: -0.017269498732288502
1: -0.010511690310018435
======
Module execution finished
See also: