Method: MissingDataMethod;
Method: Prognoz.Platform.Interop.Stat.MissingDataMethod;
The Method property determines the method of missing data treatment.
Missing data is an empty value in the data array.
By default most methods use MissingDataMethod.Casewise. For the methods, where MissingDataMethod.Casewise cannot be applied, use MissingDataMethod.None.
To execute the example, add a link to the Stat system assembly.
Sub UserProc;
Var
LR: ISmLinearRegress;
serie: Array[10] Of Double;
status, i: Integer;
Intercept: IIntercept;
Begin
LR := New SmLinearRegress.Create;
serie[0] := 0;
serie[1] := 0;
serie[2] := 0.878471616;
serie[3] := 0.85401205;
serie[4] := Double.Nan;
serie[5] := 1.28083579;
serie[6] := Double.Nan;
serie[7] := 4.237308214;
serie[8] := 4.864879297;
serie[9] := 7.765499027;
LR.Explained.Value := serie;
LR.Forecast.LastPoint := 40;
// Method of missing data treatment
LR.MissingData.Method := MissingDataMethod.NPointsAverage;
// Additional parameter for the method of missing data treatment
LR.MissingData.MethodParameter := 2;
Intercept := LR.ModelCoefficients.Intercept;
Intercept.Mode := InterceptMode.ManualEstimate;
Intercept.Estimate := 10;
status := LR.Execute;
Debug.WriteLine("Output series");
Debug.Indent;
For i := 0 To LR.Explained.Value.Length - 1 Do
Debug.WriteLine(LR.Explained.Value[i]);
End For;
Debug.Unindent;
Debug.WriteLine("Source series");
Debug.Indent;
For i := 0 To LR.Explained.OriginalValue.Length - 1 do
Debug.WriteLine(LR.Explained.OriginalValue[i]);
End For;
Debug.Unindent;
End Sub UserProc;
After executing the example, the following settings are defined:
Method of missing data treatment.
Additional parameter for the method of missing data treatment.
The console window displays the source and output series.
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
LR: ISmLinearRegress;
serie: Array[10] Of double;
Value, OriginalValue: System.Array;
status, i: integer;
Intercept: IIntercept;
Begin
LR := New SmLinearRegress.Create();
serie[0] := 0;
serie[1] := 0;
serie[2] := 0.878471616;
serie[3] := 0.85401205;
serie[4] := Double.Nan;
serie[5] := 1.28083579;
serie[6] := Double.Nan;
serie[7] := 4.237308214;
serie[8] := 4.864879297;
serie[9] := 7.765499027;
LR.Explained.Value := serie;
LR.Forecast.LastPoint := 40;
// Method of missing data treatment
LR.MissingData.Method := MissingDataMethod.mdmNPointsAverage;
// Additional parameter for the method of missing data treatment
LR.MissingData.MethodParameter := 2;
Intercept := LR.ModelCoefficients.Intercept;
Intercept.Mode := InterceptMode.imManualEstimate;
Intercept.Estimate := 10;
status := LR.Execute();
Value := LR.Explained.Value;
OriginalValue := LR.Explained.OriginalValue;
System.Diagnostics.Debug.WriteLine("Output series");
System.Diagnostics.Debug.Indent();
For i := 0 To Value.Length - 1 do
System.Diagnostics.Debug.WriteLine(Value[i]);
End For;
System.Diagnostics.Debug.Unindent();
System.Diagnostics.Debug.WriteLine("Source series");
System.Diagnostics.Debug.Indent();
For i := 0 To OriginalValue.Length - 1 Do
System.Diagnostics.Debug.WriteLine(OriginalValue[i]);
End For;
System.Diagnostics.Debug.Unindent();
End Sub;
See also: