ISmGreyForecast.MissingData

Fore Syntax

MissingData: IMissingData;

Fore.NET Syntax

MissingData: Prognoz.Platform.Interop.Stat.SIMissingData;

Description

The MissingData property determines missing data treatment method.

Comments

By default missing data is not treated.

Fore Example

Add a link to the Stat system assembly.

Sub UserProc;
Var
    Grey: ISmGreyForecast;
    y: Array[43Of Double;
    d0, d1: Double;
    res, i: Integer;
Begin
    Grey := New SmGreyForecast.Create;
    // Set variable values
    y[00] := 6209; y[01] := 6385; y[02] := 6752; y[03] := 6837; y[04] := 6495;
    y[05] := 6907;  y[06] := 7349;  y[07] := 7213;  y[08] := 7061;  y[09] := Double.Nan;
    y[10] := 7132;  y[11] := 7137;  y[12] := 7473;  y[13] := 7722;  y[14] := 8088;
    y[15] := 8516; y[16] := 8941; y[17] := 14036; y[18] := 15010; y[19] := 9746;
    y[20] := 9907;  y[21] := 10333; y[22] := 10863; y[23] := 11693; y[24] := 12242;
    y[25] := 12227; y[26] := 12910; y[27] := 13049; y[28] := 13384; y[29] := Double.Nan;
    y[30] := 14242; y[31] := 14704; y[32] := 13802; y[33] := 14197; y[34] := Double.Nan;
    y[35] := 15589; y[36] := 15932; y[37] := 16631; y[38] := 17394; y[39] := 17758;
    y[40] := 17308; y[41] := 16444; y[42] := 16413;
    // Determine explained series
    Grey.Serie.Value := y;
    // Define parameters of sample period
    Grey.ModelPeriod.FirstPoint := 1;
    Grey.ModelPeriod.LastPoint := 40;
    // Determine forecasting series parameters
    Grey.Forecast.LastPoint := 45;
    Grey.Forecast.ConfidenceLevel := 0.8;
    // Determine missing data treatment method
    Grey.MissingData.Method := MissingDataMethod.SampleAverage;
    // Execute method calculation and output results
    res := Grey.Execute;
    If res <> 0 Then
    Debug.WriteLine(Grey.Errors);
    Else
        Debug.WriteLine("Source series / Model series");
        Debug.Indent;
        For i := 0 To Grey.ModelPeriod.LastPoint - 1 Do
            d0 := Y[i];
            d1 := Grey.Fitted[i];
            Debug.WriteLine((i+1).ToString + ". " + d0.ToString + " / "+d1.ToString);
        End For;
        Debug.Unindent;
        Debug.WriteLine("Residuals");
        Debug.Indent;
        For i := 0 To Grey.Residuals.Length - 1 Do
            Debug.WriteLine(Grey.Residuals[i]);
        End For;
        Debug.Unindent;
        Debug.WriteLine(" Constant: ");
        d0 := Grey.ModelCoefficients.Intercept.Estimate;
        Debug.WriteLine("Value: " + d0.ToString);
        d0 := Grey.ModelCoefficients.Intercept.StandardError;
        Debug.WriteLine("Standard error: " + d0.ToString);
        d0 := Grey.ModelCoefficients.Intercept.TStatistic;
        Debug.WriteLine("t-statistic: " + d0.ToString);
        d0 := Grey.ModelCoefficients.Intercept.Probability;
        Debug.WriteLine("Probability: " + d0.ToString);
        Debug.WriteLine("Summary statistics");
Debug.WriteLine("Durbin-Watsonstatistic");         Debug.WriteLine(Grey.SummaryStatistics.DW);
        Debug.WriteLine("Mean error");
        Debug.WriteLine(Grey.SummaryStatistics.ME);
    End If;
End Sub UserProc;

After executing the example the console window displays values of source and modeling series, residuals, model coefficients, and summary statistics.

Fore.NET Example

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
    Grey: ISmGreyForecast;
    y: Array[43Of Double;
    d0, d1: System.Array;
    res, i: Integer;
    Residuals: System.Array;
Begin
    Grey := New SmGreyForecast.Create();
    // Set variable values
    y[00] := 6209; y[01] := 6385; y[02] := 6752; y[03] := 6837; y[04] := 6495;
    y[05] := 6907; y[06] := 7349; y[07] := 7213; y[08] := 7061; y[09] := Double.Nan;
    y[10] := 7132; y[11] := 7137; y[12] := 7473; y[13] := 7722; y[14] := 8088;
    y[15] := 8516; y[16] := 8941; y[17] := 14036; y[18] := 15010; y[19] := 9746;
    y[20] := 9907; y[21] := 10333; y[22] := 10863; y[23] := 11693; y[24] := 12242;
    y[25] := 12227; y[26] := 12910; y[27] := 13049; y[28] := 13384; y[29] := Double.Nan;
    y[30] := 14242; y[31] := 14704; y[32] := 13802; y[33] := 14197; y[34] := Double.Nan;
    y[35] := 15589; y[36] := 15932; y[37] := 16631; y[38] := 17394; y[39] := 17758;
    y[40] := 17308; y[41] := 16444; y[42] := 16413;
    // Determine explained series
    Grey.Serie.Value := y;
    // Define parameters of sample period
    Grey.ModelPeriod.FirstPoint := 1;
    Grey.ModelPeriod.LastPoint := 40;
    // Determine forecasting series parameters
    Grey.Forecast.LastPoint := 45;
    Grey.Forecast.ConfidenceLevel := 0.8;
    // Determine missing data treatment method
    Grey.MissingData.Method := MissingDataMethod.mdmSampleAverage;
    // Calculate the method  and output the results
    res := Grey.Execute();
    If res <> 0 Then
    System.Diagnostics.Debug.WriteLine(Grey.Errors);
    Else
        System.Diagnostics.Debug.WriteLine("Source series / Model series");
        System.Diagnostics.Debug.Indent();
        For i := 0 To Grey.ModelPeriod.LastPoint - 1 Do
            d0 := Y;
            d1 := Grey.Fitted;
            System.Diagnostics.Debug.WriteLine((i+1).ToString() + ". " + d0[i].ToString() + " / "+d1[i].ToString());
        End For;
        System.Diagnostics.Debug.Unindent();
        System.Diagnostics.Debug.WriteLine("Residuals");
        System.Diagnostics.Debug.Indent();
        Residuals := Grey.Residuals;
        For i := 0 To Grey.Residuals.Length - 1 Do
            System.Diagnostics.Debug.WriteLine(Residuals[i]);
        End For;
        System.Diagnostics.Debug.Unindent();
        System.Diagnostics.Debug.WriteLine(" Constant: ");
        System.Diagnostics.Debug.WriteLine("Value: " + Grey.ModelCoefficients.Intercept.Estimate.ToString());
        System.Diagnostics.Debug.WriteLine("Standard error: " + Grey.ModelCoefficients.Intercept.StandardError.ToString());
        System.Diagnostics.Debug.WriteLine("t-statistic: " + Grey.ModelCoefficients.Intercept.TStatistic.ToString());
        System.Diagnostics.Debug.WriteLine("Probability: " + Grey.ModelCoefficients.Intercept.Probability.ToString());
        System.Diagnostics.Debug.WriteLine("Summary statistics");
System.Diagnostics.Debug.WriteLine("Durbin-Watsonstatistic");         System.Diagnostics.Debug.WriteLine(Grey.SummaryStatistics.DW);
        System.Diagnostics.Debug.WriteLine("Mean error");
        System.Diagnostics.Debug.WriteLine(Grey.SummaryStatistics.ME);
    End If;
End Sub;

See also:

ISmGreyForecast