Method: 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.
See also: