MissingData: IMissingData;
MissingData: Prognoz.Platform.Interop.Stat.SlMissingData;
The MissingData property determines missing data treatment parameters.
Method of missing data treatment MissingDataMethod.Casewise cannot be used.
Add a link to the Stat system assembly.
Sub UserProc;
Var
bpf: SmBandpassFilter;
can: Array[22] Of Double;
res, i: Integer;
Begin
bpf := New SmBandpassFilter.Create;
// Set variable values
can[00] := 6209; can[01] := 6385;
can[02] := 6752; can[03] := 6837;
can[04] := 6495; can[05] := 6907;
can[06] := 7349; can[07] := Double.Nan;
can[08] := 7180; can[09] := Double.Nan;
can[10] := 7132; can[11] := 7137;
can[12] := 7473; can[13] := 7722;
can[14] := 8088; can[15] := 8516;
can[16] := 8941; can[17] := Double.Nan;
can[18] := 9380; can[19] := 9746;
can[20] := 9907; can[21] := 10333;
// Define parameters of sample period
bpf.ModelPeriod.FirstPoint := 0;
bpf.ModelPeriod.LastPoint := 21;
// Determine explained series
bpf.Serie.Value := can;
// Determine missing data treatment parameters
bpf.MissingData.Method := MissingDataMethod.LinInterpolation;
// Set weight
bpf.Width := 2;
// Determine upper and lower cutoff frequency
bpf.FrequencyHigh := 7;
bpf.FrequencyLow := 2;
// Execute method calculation and output results
res := bpf.Execute;
If res <> 0 Then
Debug.WriteLine(bpf.Errors);
Else
Debug.WriteLine("=== Model series ===");
Debug.Indent;
For i := 0 To bpf.Fitted.Length - 1 Do
Debug.WriteLine(bpf.Fitted[i]);
End For;
Debug.Unindent;
Debug.WriteLine("=== Residuals ===");
Debug.Indent;
For i := 0 To bpf.Residuals.Length - 1 Do
Debug.WriteLine(bpf.Residuals[i]);
End For;
Debug.Unindent;
Debug.WriteLine("=== Weights ===");
Debug.Indent;
For i := 0 To bpf.Weights.Length - 1 Do
Debug.WriteLine(bpf.Weights[i]);
End For;
Debug.Unindent;
Debug.WriteLine("=== Durbin-Watson statistic ===");
Debug.WriteLine(bpf.SummaryStatistics.DW);
Debug.WriteLine("=== Mean error ===");
Debug.WriteLine(bpf.SummaryStatistics.ME);
End If;
End Sub UserProc;
After executing the example the console window displays a modeling series, weights, residuals, and summary statistics.
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
bpf: SmBandpassFilter;
can: Array[22] Of Double;
res, i: Integer;
Fitted, Residuals, Weights: System.Array;
Begin
bpf := New SmBandpassFilter.Create();
// Set variable values
can[00] := 6209; can[01] := 6385;
can[02] := 6752; can[03] := 6837;
can[04] := 6495; can[05] := 6907;
can[06] := 7349; can[07] := Double.Nan;
can[08] := 7180; can[09] := Double.Nan;
can[10] := 7132; can[11] := 7137;
can[12] := 7473; can[13] := 7722;
can[14] := 8088; can[15] := 8516;
can[16] := 8941; can[17] := Double.Nan;
can[18] := 9380; can[19] := 9746;
can[20] := 9907; can[21] := 10333;
// Define parameters of sample period
bpf.ModelPeriod.FirstPoint := 0;
bpf.ModelPeriod.LastPoint := 21;
// Determine explained series
bpf.Serie.Value := can;
// Determine missing data treatment parameters
bpf.MissingData.Method := MissingDataMethod.mdmLinInterpolation;
// Set weight
bpf.Width := 2;
// Determine upper and lower cutoff frequency
bpf.FrequencyHigh := 7;
bpf.FrequencyLow := 2;
// Calculate the method and output the results
res := bpf.Execute();
If res <> 0 Then
System.Diagnostics.Debug.WriteLine(bpf.Errors);
Else
System.Diagnostics.Debug.WriteLine("=== Model series ===");
System.Diagnostics.Debug.Indent();
Fitted := bpf.Fitted;
For i := 0 To bpf.Fitted.Length - 1 Do
System.Diagnostics.Debug.WriteLine(Fitted[i]);
End For;
System.Diagnostics.Debug.Unindent();
System.Diagnostics.Debug.WriteLine("=== Residuals ===");
System.Diagnostics.Debug.Indent();
Residuals := bpf.Residuals;
For i := 0 To bpf.Residuals.Length - 1 Do
System.Diagnostics.Debug.WriteLine(Residuals[i]);
End For;
System.Diagnostics.Debug.Unindent();
System.Diagnostics.Debug.WriteLine("=== Weights ===");
System.Diagnostics.Debug.Indent();
Weights := bpf.Weights;
For i := 0 To bpf.Weights.Length - 1 Do
System.Diagnostics.Debug.WriteLine(Weights[i]);
End For;
System.Diagnostics.Debug.Unindent();
System.Diagnostics.Debug.WriteLine("=== Durbin-Watson statistic ===");
System.Diagnostics.Debug.WriteLine(bpf.SummaryStatistics.DW);
System.Diagnostics.Debug.WriteLine("=== Mean error ===");
System.Diagnostics.Debug.WriteLine(bpf.SummaryStatistics.ME);
End If;
End Sub;
See also: