MissingData: IMissingData;
The MissingData property determines missing data treatment parameters.
By default missing data is not treated.
Add a link to the Stat system assembly.
Sub Print(Data: Array Of Double);
Var
i: Integer;
Begin
For i := 0 To Data.Length - 1 Do
If Double.IsNan(Data[i]) Then
Debug.WriteLine("---empty---");
Else
Debug.WriteLine(i.ToString + ", " + Data[i].ToString);
End If;
End For;
End Sub Print;
Sub UserProc;
Var
ar: SmAutoRegress;
res: Integer;
y: Array[24] Of Double;
AROrder: Array[3] Of Integer;
d: Double;
Begin
// Set variable values
ar := New SmAutoRegress.Create;
y[00] := 6209; y[12] := Double.Nan;
y[01] := 6385; y[13] := 7722;
y[02] := 6752; y[14] := 8088;
y[03] := 6837; y[15] := 8516;
y[04] := 6495; y[16] := 8941;
y[05] := 6907; y[17] := 9064;
y[06] := 7349; y[18] := 9380;
y[07] := 7213; y[19] := 9746;
y[08] := 7061; y[20] := 9907;
y[09] := 7180; y[21] := 10333;
y[10] := Double.Nan; y[22] := 10863;
y[11] := Double.Nan; y[23] := 11693;
// Determine explained series
ar.Serie.Value := y;
// Define parameters of sample period
ar.ModelPeriod.FirstPoint := 1;
ar.ModelPeriod.LastPoint := 24;
// Determine forecasting series parameters
ar.Forecast.LastPoint := 35;
// Determine autoregression orders
AROrder[0] := 1;
AROrder[1] := 3;
AROrder[2] := 5;
ar.AutoRegressionOrder := AROrder;
// Determine missing data treatment parameters
ar.MissingData.Method := MissingDataMethod.SampleAverage;
// Determine model coefficient parameters
ar.ModelCoefficients.Intercept.Mode := InterceptMode.AutoEstimate;
// Calculate the method and output the results
res := ar.Execute;
If res <> 0 Then
Debug.WriteLine(ar.Errors);
Else
Debug.WriteLine("=== Model series ===");
Print(ar.Fitted);
Debug.WriteLine("=== Forecast series ===");
Print(ar.Forecast.Value);
Debug.WriteLine("=== Residuals ===");
Print(ar.Residuals);
Debug.WriteLine("=== Summary statistics ===");
Debug.WriteLine("=== Determination coefficient ===");
d := ar.SummaryStatistics.AdjR2;
Debug.WriteLine(d);
Debug.WriteLine("=== Mean error ===");
d := ar.SummaryStatistics.ME;
Debug.WriteLine(d);
End If;
End Sub UserProc;
After executing the example the console window displays the modeling and forecasting series, residuals, and summary statistics.
See also: