LRCKernel: LRCKernelType;
LRCKernel: Prognoz.Platform.Interop.Stat.LRCKernelType;
The LRCKernel property determines a kernel type.
If LRCKernel = LRCKernelType.UserSpecified, kernel vector must be set by means of the ISmLongRunCovariance.KernelVector property.
To execute the example add a link to the Stat assembly.
Sub UserProc;
Var
lrc: SmLongRunCovariance;
can, fra, ger, ita: Array[15] Of Double;
res, i, j: Integer;
str: String;
kernel: Array Of Double;
d: Integer = 2;
Begin
lrc := New SmLongRunCovariance.Create;
// Set values for variables
can[0] := 6209; fra[0] := 4110; ger[0] := 3415; ita[0] := 2822;
can[1] := 6385; fra[1] := 4280; ger[1] := 3673; ita[1] := 3023;
can[2] := 6752; fra[2] := 4459; ger[2] := 4013; ita[2] := 3131;
can[3] := 6837; fra[3] := 4545; ger[3] := 4278; ita[3] := 3351;
can[4] := 6495; fra[4] := 4664; ger[4] := 4577; ita[4] := 3463;
can[5] := 6907; fra[5] := 4861; ger[5] := 5135; ita[5] := 3686;
can[6] := 7349; fra[6] := 5195; ger[6] := 5388; ita[6] := 3815;
can[7] := 7213; fra[7] := 5389; ger[7] := 5610; ita[7] := 3960;
can[8] := 7061; fra[8] := 5463; ger[8] := 5787; ita[8] := 4119;
can[9] := 7180; fra[9] := 5610; ger[9] := 6181; ita[9] := 4351;
can[10] := 7132; fra[10] := 5948; ger[10] := 6633; ita[10] := 4641;
can[11] := 7137; fra[11] := 6218; ger[11] := 6910; ita[11] := 5008;
can[12] := 7473; fra[12] := 6521; ger[12] := 7146; ita[12] := 5305;
can[13] := 7722; fra[13] := 6788; ger[13] := 7248; ita[13] := 5611;
can[14] := 8088; fra[14] := 7222; ger[14] := 7689; ita[14] := 5693;
// set input series
lrc.Regressors.Clear;
lrc.Regressors.Add.Value := can;
lrc.Regressors.Add.Value := fra;
lrc.Regressors.Add.Value := ger;
lrc.Regressors.Add.Value := ita;
// sample period
lrc.ModelPeriod.FirstPoint := 1;
lrc.ModelPeriod.LastPoint := 15;
// window type
lrc.LRCWindow := LRCWindowType.Symmetric;
// data standardization
lrc.RemoveMeans := True;
// take into account number of degrees of freedom
lrc.DFAdjustment := False;
// kernel parameters
lrc.LRCKernel := LRCKernelType.UserSpecified;
// lag specification
lrc.LRCLagSpecification := LRCLagSpecificationType.None;
// kernel vector
If lrc.LRCKernel = LRCKernelType.UserSpecified Then
kernel := New Double[d];
kernel[0] := 1; kernel[1] := 2;
lrc.KernelVector := kernel;
End If;
// calculate model
res := lrc.Execute;
Debug.WriteLine(lrc.Errors);
For i := 0 To lrc.WarningsCount - 1 Do
Debug.WriteLine(lrc.Warnings[i]);
End For;
Debug.WriteLine("Covariance matrix: ");
Debug.Indent;
For i := 0 To lrc.CovarianceMatrix.GetUpperBound(1) Do
str := "";
For j := 0 To lrc.CovarianceMatrix.GetUpperBound(2) Do
str := str + (lrc.CovarianceMatrix[i, j] As Double).ToString + " ";
End For;
Debug.WriteLine(str);
End For;
Debug.Unindent;
End Sub UserProc;
After executing the example the model of long-run covariance is built, and the settings are determined:
Sample period.
Window type.
Kernel bandwidth parameters and method.
Lag specification.
Kernel vector.
The console window displays the covariance matrix.
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
lrc: SmLongRunCovariance;
Regressors: ISlSerie;
can, fra, ger, ita: Array[15] Of Double;
res, i, j: Integer;
str: String;
kernel: Array Of Double;
d: Integer = 2;
Matrix, Warnings: Array;
Begin
lrc := New SmLongRunCovariance.Create();
// Set values for variables
can[0] := 6209; fra[0] := 4110; ger[0] := 3415; ita[0] := 2822;
can[1] := 6385; fra[1] := 4280; ger[1] := 3673; ita[1] := 3023;
can[2] := 6752; fra[2] := 4459; ger[2] := 4013; ita[2] := 3131;
can[3] := 6837; fra[3] := 4545; ger[3] := 4278; ita[3] := 3351;
can[4] := 6495; fra[4] := 4664; ger[4] := 4577; ita[4] := 3463;
can[5] := 6907; fra[5] := 4861; ger[5] := 5135; ita[5] := 3686;
can[6] := 7349; fra[6] := 5195; ger[6] := 5388; ita[6] := 3815;
can[7] := 7213; fra[7] := 5389; ger[7] := 5610; ita[7] := 3960;
can[8] := 7061; fra[8] := 5463; ger[8] := 5787; ita[8] := 4119;
can[9] := 7180; fra[9] := 5610; ger[9] := 6181; ita[9] := 4351;
can[10] := 7132; fra[10] := 5948; ger[10] := 6633; ita[10] := 4641;
can[11] := 7137; fra[11] := 6218; ger[11] := 6910; ita[11] := 5008;
can[12] := 7473; fra[12] := 6521; ger[12] := 7146; ita[12] := 5305;
can[13] := 7722; fra[13] := 6788; ger[13] := 7248; ita[13] := 5611;
can[14] := 8088; fra[14] := 7222; ger[14] := 7689; ita[14] := 5693;
// set input series
lrc.Regressors.Clear();
Regressors := lrc.Regressors.Add();
Regressors.Value := can;
Regressors.Value := fra;
Regressors.Value := ger;
Regressors.Value := ita;
// sample period
lrc.ModelPeriod.FirstPoint := 1;
lrc.ModelPeriod.LastPoint := 15;
// window type
lrc.LRCWindow := LRCWindowType.lrcwSymmetric;
// data standardization
lrc.RemoveMeans := True;
// take into account number of degrees of freedom
lrc.DFAdjustment := False;
// kernel parameters
lrc.LRCKernel := LRCKernelType.lrckUserSpecified;
// lag specification
lrc.LRCLagSpecification := LRCLagSpecificationType.lrclsNone;
// kernel vector
If lrc.LRCKernel = LRCKernelType.lrckUserSpecified Then
kernel := New Double[d];
kernel[0] := 1; kernel[1] := 2;
lrc.KernelVector := kernel;
End If;
// calculate model
res := lrc.Execute();
System.Diagnostics.Debug.WriteLine(lrc.Errors);
Warnings := lrc.Warnings;
For i := 0 To lrc.WarningsCount - 1 Do
System.Diagnostics.Debug.WriteLine(Warnings[i]);
End For;
System.Diagnostics.Debug.WriteLine("Covariance matrix: ");
Matrix := lrc.CovarianceMatrix;
System.Diagnostics.Debug.Indent();
Matrix := lrc.CovarianceMatrix;
For i := 0 To lrc.CovarianceMatrix.GetUpperBound(0) Do
str := "";
For j := 0 To lrc.CovarianceMatrix.GetUpperBound(1) Do
str := str + (Matrix[i, j] As Double).ToString() + " ";
End For;
System.Diagnostics.Debug.WriteLine(str);
End For;
System.Diagnostics.Debug.Unindent();
End Sub;
See also: