MissingData: IMissingData;
MissingData: Prognoz.Platform.Interop.Stat.IMissingData;
The MissingData property determines missing data treatment method and parameters.
By default missing data is not treated.
Add a link to the Stat system assembly.
Sub UserProc;
Var
VarModel: ISmVectorAutoRegress;
y1, y2: Array[15] Of Double;
i, j, res: Integer;
Eqs: ISlEquations;
Eq: ISlEquation;
ARO: Array[2] Of Integer;
Begin
VarModel := New SmVectorAutoRegress.Create;
// Set values for variables
y1[00] := 6209; y1[01] := 6385; y1[02] := 6752;
y1[03] := 6837; y1[04] := 6495; y1[05] := Double.Nan;
y1[06] := 7349; y1[07] := 7213; y1[08] := 7061;
y1[09] := 7180; y1[10] := 7132; y1[11] := Double.Nan;
y1[12] := 7473; y1[13] := 7722; y1[14] := 8088;
y2[00] := 4110; y2[01] := 4280; y2[02] := 4459;
y2[03] := 4545; y2[04] := 4664; y2[05] := 4861;
y2[06] := 5195; y2[07] := 5389; y2[08] := 5463;
y2[09] := 5610; y2[10] := 5948; y2[11] := 6218;
y2[12] := 6521; y2[13] := 6788; y2[14] := 7222;
ARO[0] := 1;
ARO[1] := 2;
Eqs := VarModel.Equations;
// Add 1 equation
Eq := Eqs.Add;
// Determine source series parameters
Eq.Serie.Value := y1;
// Determine autoregression orders
Eq.AutoRegressionOrder := ARO;
// Determine forecasting parameters
Eq.Forecast.LastPoint := 43;
// Determine parameters of equation constant
Eq.Intercept.Mode := InterceptMode.AutoEstimate;
// Add 2 equation
Eq := Eqs.Add;
// Determine source series parameters
Eq.Serie.Value := y2;
// Determine autoregression orders
Eq.AutoRegressionOrder := ARO;
// Determine parameters of equation constant
Eq.Intercept.Mode := InterceptMode.AutoEstimate;
// Determine sample period
VarModel.ModelPeriod.FirstPoint := 1;
VarModel.ModelPeriod.LastPoint := 10;
// Determine forecasting parameters
Eq.Forecast.LastPoint := 15;
// Determine missing data treatment method
VarModel.MissingData.Method := MissingDataMethod.SampleAverage;
// Execute calculation and display results
res := VarModel.Execute;
If res <> 0 Then
Debug.WriteLine(VarModel.Errors);
Else
For j := 0 To VarModel.Equations.Count - 1 Do
Debug.Indent;
Debug.WriteLine("Modeling series for equation " + j.ToString + " ");
Debug.Unindent;
For i := 0 To VarModel.Equations.Item(j).Fitted.Length - 1 Do
Debug.WriteLine(VarModel.Equations.Item(j).Fitted[i]);
End For;
End For;
Debug.Indent;
Debug.WriteLine("VAR - statistics");
Debug.Unindent;
Debug.WriteLine("AIC = " + VarModel.VARStatistics.AIC.ToString);
Debug.WriteLine("LLV = " + VarModel.VARStatistics.LLV.ToString);
Debug.WriteLine("RC = " + VarModel.VARStatistics.RC.ToString);
Debug.WriteLine("SC = " + VarModel.VARStatistics.SC.ToString);
End If;
End Sub UserProc;
After executing the example the console window displays modeling series for equations and VAR-statistics values.
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
VarModel: ISmVectorAutoRegress;
y1, y2: Array[15] Of Double;
i, j, res: Integer;
Eqs: ISlEquations;
Eq: ISlEquation;
ARO: Array[2] Of Integer;
Begin
VarModel := New SmVectorAutoRegress.Create();
// Set values for variables
y1[00] := 6209; y1[01] := 6385; y1[02] := 6752;
y1[03] := 6837; y1[04] := 6495; y1[05] := Double.Nan;
y1[06] := 7349; y1[07] := 7213; y1[08] := 7061;
y1[09] := 7180; y1[10] := 7132; y1[11] := Double.Nan;
y1[12] := 7473; y1[13] := 7722; y1[14] := 8088;
y2[00] := 4110; y2[01] := 4280; y2[02] := 4459;
y2[03] := 4545; y2[04] := 4664; y2[05] := 4861;
y2[06] := 5195; y2[07] := 5389; y2[08] := 5463;
y2[09] := 5610; y2[10] := 5948; y2[11] := 6218;
y2[12] := 6521; y2[13] := 6788; y2[14] := 7222;
ARO[0] := 1;
ARO[1] := 2;
Eqs := VarModel.Equations;
// Add 1 equation
Eq := Eqs.Add();
// Determine source series parameters
Eq.Serie.Value := y1;
// Determine autoregression orders
Eq.AutoRegressionOrder := ARO;
// Determine forecasting parameters
Eq.Forecast.LastPoint := 43;
// Determine parameters of equation constant
Eq.Intercept.Mode := InterceptMode.imAutoEstimate;
// Add 2 equation
Eq := Eqs.Add();
// Determine source series parameters
Eq.Serie.Value := y2;
// Determine autoregression orders
Eq.AutoRegressionOrder := ARO;
// Determine parameters of equation constant
Eq.Intercept.Mode := InterceptMode.imAutoEstimate;
// Determine sample period
VarModel.ModelPeriod.FirstPoint := 1;
VarModel.ModelPeriod.LastPoint := 10;
// Determine forecasting parameters
Eq.Forecast.LastPoint := 15;
// Determine missing data treatment method
VarModel.MissingData.Method := MissingDataMethod.mdmSampleAverage;
// Execute calculation and display results
res := VarModel.Execute();
If res <> 0 Then
System.Diagnostics.Debug.WriteLine(VarModel.Errors);
Else
For j := 0 To VarModel.Equations.Count - 1 Do
System.Diagnostics.Debug.Indent();
System.Diagnostics.Debug.WriteLine("Modeling series for equation " + j.ToString() + " ");
System.Diagnostics.Debug.Unindent();
For i := 0 To VarModel.Equations.Item[j].Fitted.Length - 1 Do
System.Diagnostics.Debug.WriteLine(VarModel.Equations.Item[j].Fitted.GetValue(i));
End For;
End For;
System.Diagnostics.Debug.Indent();
System.Diagnostics.Debug.WriteLine("VAR - statistics");
System.Diagnostics.Debug.Unindent();
System.Diagnostics.Debug.WriteLine("AIC = " + VarModel.VARStatistics.AIC.ToString());
System.Diagnostics.Debug.WriteLine("LLV = " + VarModel.VARStatistics.LLV.ToString());
System.Diagnostics.Debug.WriteLine("RC = " + VarModel.VARStatistics.RC.ToString());
System.Diagnostics.Debug.WriteLine("SC = " + VarModel.VARStatistics.SC.ToString());
End If;
End Sub;
See also: