CommonExogenious: Array;
CommonExogenious: System.Array;
The CommonExogenious property determines an array of indexes of exogenous variables included into a group of variables with short-term cointegration links.
If the exogenous variable is not included into the group of long-term (ISmCointegrationEq.LongTermExogenious) or short-term (ISmCointegrationEq.CommonExogenious) cointegration links, it is excluded from model calculation.
To execute the example, add a link to the Stat system assembly.
Sub UserProc;
Var
y: Array[11] Of Double;
x1, x2: Array[21] Of Double;
AR_X: Array[1] Of Integer;
CommonEx, LongTerm: Array[1] Of Integer;
i, Res: Integer;
ArrRes, f: Array Of Double;
d: Double;
CointegrEq: ISmCointegrationEq;
Eq: ISlEquation;
Begin
// Set source values for endogenous variable
y[00] := 95;
y[01] := 45;
y[02] := 22;
y[03] := -36;
y[04] := 10;
y[05] := -15;
y[06] := 36;
y[07] := -10;
y[08] := -36;
y[09] := -44;
y[10] := -7;
// Set source values for 1 and 2 exogenous variables
x1[00] := 6; x2[00] := 7.6;
x1[01] := 8; x2[01] := 7.8;
x1[02] := 10; x2[02] := 8.1;
x1[03] := 5; x2[03] := 6.5;
x1[04] := 3; x2[04] := 5.3;
x1[05] := 6; x2[05] := 4.6;
x1[06] := 3; x2[06] := 6.3;
x1[07] := 7; x2[07] := 7.7;
x1[08] := 8; x2[08] := 9.8;
x1[09] := 10; x2[09] := 1.0;
x1[10] := 5; x2[10] := 7.5;
x1[11] := 2; x2[11] := 8.2;
x1[12] := 1; x2[12] := 4.1;
x1[13] := 1; x2[13] := 6.1;
x1[14] := 3; x2[14] := 7.3;
x1[15] := 4; x2[15] := 3.4;
x1[16] := 7; x2[16] := 2.7;
x1[17] := 4; x2[17] := 8.4;
x1[18] := 7; x2[18] := 6.7;
x1[19] := 4; x2[19] := 7.4;
x1[20] := 3; x2[20] := 6.3;
CointegrEq := New SmCointegrationEq.Create;
Eq := CointegrEq.Equation;
// Set endogenous variable
Eq.Serie.Value := y;
// Set exogenous variables
Eq.ExogenousVariables.Add.Value := x1;
Eq.ExogenousVariables.Add.Value := x2;
// Set autoregression order of exogenous variables
AR_X[0] := 0;
Eq.AutoRegressionOrder := AR_X;
// Include the first exogenous variable to short-term links group
CommonEx[0] := 0;
CointegrEq.CommonExogenious := CommonEx;
// Include the second exogenous variable to the long-term links group
LongTerm[0] := 1;
CointegrEq.LongTermExogenious := LongTerm;
// Set identification period
CointegrEq.Period.FirstPoint := 1;
CointegrEq.Period.LastPoint := 11;
// Set forecasting parameters
Eq.Forecast.LastPoint := 21;
// Determine type of error correction model
CointegrEq.ModelType := ECMType.NoTrendIntercept;
// Set autoregression order of endogenous variables
CointegrEq.ParseSerieAROrder("1", True);
// Calculate method and display results
Res := CointegrEq.Execute;
If Res = 0 Then
Debug.WriteLine("Forecast:");
ArrRes := Eq.Forecast.Value;
For i := CointegrEq.Period.LastPoint To ArrRes.Length - 1 Do
d := ArrRes[i] As double;
Debug.WriteLine(i.ToString + ": " + d.ToString);
End For;
f := CointegrEq.CointegralEquation.Estimate;
Debug.WriteLine("Model coefficients;");
For i := 0 To f.Length - 1 Do
Debug.WriteLine(f[i]);
End For;
f := CointegrEq.CointegralEquation.Probability;
Debug.WriteLine("Coefficient probabilities:");
For i := 0 To f.Length - 1 Do
Debug.WriteLine(f[i]);
End For;
f := CointegrEq.CointegralEquation.StandardError;
Debug.WriteLine("Standard errors of coefficients");
For i := 0 To f.Length - 1 Do
Debug.WriteLine(f[i]);
End For;
f := CointegrEq.CointegralEquation.TStatistic;
Debug.WriteLine("t-statistics of coefficients");
For i := 0 To f.Length - 1 Do
Debug.WriteLine(f[i]);
End For;
Else
Debug.WriteLine("Execution status: " + Res.ToString);
Debug.WriteLine("Error: " + CointegrEq.Errors);
End If;
End Sub UserProc;
After executing the example parameters of error correction method are adjusted. Endogenous and exogenous variables are added, cointegration link groups are specified for the variables. Autoregression orders are adjusted and identification and forecasting period is set. After the calculation the console displays calculation results.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Stat;
…
Public Shared Sub Main(Params: StartParams);
Var
y: Array[11] Of Double;
x1, x2: Array[21] Of Double;
AR_X: Array[1] Of Integer;
CommonEx, LongTerm: Array[1] Of Integer;
i, Res: Integer;
ArrRes, f: Array;
d: Double;
CointegrEq: ISmCointegrationEq;
Eq: ISlEquation;
Begin
// Set source values for endogenous variable
y[00] := 95;
y[01] := 45;
y[02] := 22;
y[03] := -36;
y[04] := 10;
y[05] := -15;
y[06] := 36;
y[07] := -10;
y[08] := -36;
y[09] := -44;
y[10] := -7;
// Set source values for 1 and 2 exogenous variables
x1[00] := 6; x2[00] := 7.6;
x1[01] := 8; x2[01] := 7.8;
x1[02] := 10; x2[02] := 8.1;
x1[03] := 5; x2[03] := 6.5;
x1[04] := 3; x2[04] := 5.3;
x1[05] := 6; x2[05] := 4.6;
x1[06] := 3; x2[06] := 6.3;
x1[07] := 7; x2[07] := 7.7;
x1[08] := 8; x2[08] := 9.8;
x1[09] := 10; x2[09] := 1.0;
x1[10] := 5; x2[10] := 7.5;
x1[11] := 2; x2[11] := 8.2;
x1[12] := 1; x2[12] := 4.1;
x1[13] := 1; x2[13] := 6.1;
x1[14] := 3; x2[14] := 7.3;
x1[15] := 4; x2[15] := 3.4;
x1[16] := 7; x2[16] := 2.7;
x1[17] := 4; x2[17] := 8.4;
x1[18] := 7; x2[18] := 6.7;
x1[19] := 4; x2[19] := 7.4;
x1[20] := 3; x2[20] := 6.3;
CointegrEq := New SmCointegrationEq.Create();
Eq := CointegrEq.Equation;
// Define endogenous variable
Eq.Serie.Value := y;
// Define exogenous variables
Eq.ExogenousVariables.Add().Value := x1;
Eq.ExogenousVariables.Add().Value := x2;
// Set autoregression order for exogenous variables
AR_X[0] := 0;
Eq.AutoRegressionOrder := AR_X;
// Include the 1st exogenous variable to the group of short-term relationships
CommonEx[0] := 0;
CointegrEq.CommonExogenious := CommonEx;
// Include the 2nd exogenous variable to the group of long-term relationships
LongTerm[0] := 1;
CointegrEq.LongTermExogenious := LongTerm;
// Set sample period
CointegrEq.Period.FirstPoint := 1;
CointegrEq.Period.LastPoint := 11;
// Set forecast parameters
Eq.Forecast.LastPoint := 21;
// Determine error correction model type
CointegrEq.ModelType := ECMType.ecmtNoTrendIntercept;
// Set autoregression order for endogenous variables
CointegrEq.ParseSerieAROrder("1", True);
// Calculate method and output results
Res := CointegrEq.Execute();
If Res = 0 Then
System.Diagnostics.Debug.WriteLine("Forecast:");
ArrRes := Eq.Forecast.Value;
For i := CointegrEq.Period.LastPoint To ArrRes.Length - 1 Do
d := ArrRes[i] As double;
System.Diagnostics.Debug.WriteLine(i.ToString() + ": " + d.ToString());
End For;
f := CointegrEq.CointegralEquation.Estimate;
System.Diagnostics.Debug.WriteLine("Model coefficients;");
For i := 0 To f.Length - 1 Do
System.Diagnostics.Debug.WriteLine(f[i]);
End For;
f := CointegrEq.CointegralEquation.Probability;
System.Diagnostics.Debug.WriteLine("Coefficient probabilities:");
For i := 0 To f.Length - 1 Do
System.Diagnostics.Debug.WriteLine(f[i]);
End For;
f := CointegrEq.CointegralEquation.StandardError;
System.Diagnostics.Debug.WriteLine("Standard errors of coefficients");
For i := 0 To f.Length - 1 Do
System.Diagnostics.Debug.WriteLine(f[i]);
End For;
f := CointegrEq.CointegralEquation.TStatistic;
System.Diagnostics.Debug.WriteLine("t-statistics of coefficients");
For i := 0 To f.Length - 1 Do
System.Diagnostics.Debug.WriteLine(f[i]);
End For;
Else
System.Diagnostics.Debug.WriteLine("Execution status: " + Res.ToString());
System.Diagnostics.Debug.WriteLine("Error: " + CointegrEq.Errors);
End If;
End Sub;
See also: