ISmCurveEstimation.MissingData

Fore Syntax

MissingData: IMissingData;

Fore.NET Syntax

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

Description

The MissingData property determines missing data treatment parameters.

Comments

By default missing data is not treated.

Fore Example

Add a link to the Stat system assembly.

Sub UserProc;
Var
    trend: SmCurveEstimation;
    ar: Array[25Of Double;
    d0: Double;
    MData: IMissingData;
    status, i, s: Integer;
    Forms: IDependenceForms;
    Poly: IDependenceForm;
    Forecast: IForecast;
    Period: IStatPeriod;
Begin
    // Create object for method calculation
    trend := New SmCurveEstimation.Create;
    // Set explained series values
    ar[00] := 4110; ar[01] := 4280; ar[02] := 4459; ar[03] := 4545; ar[04] := 4664;
    ar[05] := 4861; ar[06] := 5195; ar[07] := 4664; ar[08] := 9054; ar[09] := Double.Nan;
    ar[10] := 5948; ar[11] := Double.Nan; ar[12] := 6521; ar[13] := 6788; ar[14] := 7222;
    ar[15] := 7486; ar[16] := 7832; ar[17] := 8153; ar[18] := 8468; ar[19] := Double.Nan;
    ar[20] := 9499; ar[21] := 9866; ar[22] := 10217; ar[23] := 10763; ar[24] := 10683;
    trend.Explained.Value := ar;
    // Set explanatory series parameters
    trend.Explanatory.IsTrend := True;
    // Set sample period
    Period := trend.ModelPeriod;
    Period.FirstPoint := 10;
    Period.LastPoint := 20;
    // Set forecasting period borders
    trend.ForecastFirstPoint := 20;
    trend.ForecastLastPoint := 30;
    // Determine confidence limit relevance of forecasting series
    trend.ForecastConfidenceLevel := 0.85;
    // Determine type of best dependency form selection criterion
    trend.Criterion := DependenceCriterion.R2Adj;
    // Set seasonal component parameters
    trend.SeasonalComponent.Mode := SeasonalityType.Additive;
    trend.SeasonalComponent.Cycle := 4;
    // Set polynomial degree for polynomial dependency form
    trend.PolynomOrder := 4;
    // Set missing data treatment method parameters
    MData := trend.MissingData;
    MData.Method := MissingDataMethod.SampleAverage;

    // Execute calculation
    status := trend.Execute;
    If status <> 0 Then
        // If calculation is finished with errors, output them to console window
        Debug.WriteLine(trend.Errors);
        Else
            // If calculation is completed successfully, display values to the console window
            Debug.WriteLine("== Modeling series == ");
            Debug.Indent;
            For i := 0 To trend.Explained.Value.Length - 1 Do
                Debug.WriteLine(trend.Explained.Value[i]);
            End For;
            Debug.Unindent;
            Debug.WriteLine("== Source series ==");
            Debug.Indent;
            For i := 0 To trend.Explained.Value.Length - 1 Do
                Debug.WriteLine(trend.Explained.OriginalValue[i]);
            End For;
            Debug.Unindent;
            Forms := trend.DependenceForms;
            Debug.WriteLine("== Criterion values ==");
            For i := 0 To Forms.Count - 3 Do
                s := trend.SortedModelList[i];
                d0 := Forms.Item(s).CriterionValue;
                Debug.WriteLine(Forms.Item(s).DisplayName + ": " + d0.ToString);
            End For;
            Debug.WriteLine("== Best dependency ==");
            Debug.WriteLine(trend.BestDependenceForm);
            Poly := Forms.Item(2);
            Forecast := Poly.Forecast;
            Debug.WriteLine("Dependency " + Poly.DisplayName + " criterion value " + Poly.CriterionValue.ToString);
            Debug.WriteLine("== Forecasting series ==");
            Debug.Indent;
            For i := trend.ForecastFirstPoint To Forecast.Value.Length - 1 Do
                Debug.WriteLine(Forecast.Value[i]);
            End For;
            Debug.Unindent;
            Debug.WriteLine("== Seasonal component ==");
            Debug.Indent;
            For i := Period.FirstPoint To trend.SeasonalAdjustment.Length - 1 Do
                d0 := trend.SeasonalAdjustment[i];
                Debug.WriteLine(d0.ToString);
            End For;
            Debug.Unindent;
    End If;
End Sub UserProc;

After executing the example the console window displays a modeling and source series, dependency criterion values, best dependency number, the forecasting series calculated by polynomial dependency, seasonal component values.

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 UserProc();
Var
    trend: SmCurveEstimation;
    ar: Array[
25Of Double;
    d0: Double;
    MData: IMissingData;
    status, i, s: Integer;
    Forms: IDependenceForms;
    Poly: IDependenceForm;
    Forecast: IForecast;
    Period: IStatPeriod;
Begin
    
// Create object for method calculation
    trend := New SmCurveEstimation.Create();
    
// Set values of the explained series
    ar[00] := 4110; ar[01] := 4280; ar[02] := 4459; ar[03] := 4545; ar[04] := 4664;
    ar[
05] := 4861; ar[06] := 5195; ar[07] := 4664; ar[08] := 9054; ar[09] := Double.Nan;
    ar[
10] := 5948; ar[11] := Double.Nan; ar[12] := 6521; ar[13] := 6788; ar[14] := 7222;
    ar[
15] := 7486; ar[16] := 7832; ar[17] := 8153; ar[18] := 8468; ar[19] := Double.Nan;
    ar[
20] := 9499; ar[21] := 9866; ar[22] := 10217; ar[23] := 10763; ar[24] := 10683;
    trend.Explained.Value := ar;
    
// Set explanatory series parameters
    trend.Explanatory.IsTrend := True;
    
// Set identification period
    Period := trend.ModelPeriod;
    Period.FirstPoint := 
10;
    Period.LastPoint := 
20;
    
// Set forecasting period borders
    trend.ForecastFirstPoint := 20;
    trend.ForecastLastPoint := 
30;
    
// Determine confidence limits relevance of forecasting series
    trend.ForecastConfidenceLevel := 0.85;
    
// Determine type of best dependency form selection criterion
    trend.Criterion := DependenceCriterion.dctR2Adj;
    
// Set seasonal component parameters
    trend.SeasonalComponent.Mode := SeasonalityType.sstAdditive;
    trend.SeasonalComponent.Cycle := 
4;
    
// Set polynomial degree for polynomial dependency form
    trend.PolynomOrder := 4;
    
// Set missing data treatment method parameters
    MData := trend.MissingData;
    MData.Method := MissingDataMethod.mdmSampleAverage;
    
// Perform calculation
    status := trend.Execute();
    
If status <> 0 Then
        
// If calculation is finished with errors, output them to console window
        System.Diagnostics.Debug.WriteLine(trend.Errors);
        
Else
            
// If calculation is completed successfully, display values to the console window
            System.Diagnostics.Debug.WriteLine("== Modeling series == ");
            System.Diagnostics.Debug.Indent();
            
For i := 0 To trend.Explained.Value.Length - 1 Do
                System.Diagnostics.Debug.WriteLine(trend.Explained.Value.GetValue(i));
            
End For;
            System.Diagnostics.Debug.Unindent();
            System.Diagnostics.Debug.WriteLine(
"== Source series ==");
            System.Diagnostics.Debug.Indent();
            
For i := 0 To trend.Explained.Value.Length - 1 Do
                System.Diagnostics.Debug.WriteLine(trend.Explained.OriginalValue.GetValue(i));
</font><font color="#008080">End</font><font color="#000000"> </font><font color="#008080">For</font><font color="#000000">;<br/> System.Diagnostics.Debug.Unindent();<br/> Forms := trend.DependenceForms;<br/> System.Diagnostics.Debug.WriteLine(</font><font color="#800000">&quot;== Criterion values ==&quot;</font><font color="#000000">);<br/> </font><font color="#008080">For</font><font color="#000000"> i := </font><font color="#008000">0</font><font color="#000000"> </font><font color="#008080">To</font><font color="#000000"> Forms.Count - </font><font color="#008000">3</font><font color="#000000"> </font><font color="#008080">Do</font><font color="#000000"><br/> s := trend.SortedModelList.GetValue(i) </font><font color="#008080">As</font><font color="#000000"> integer;<br/> d0 := Forms.Item[s].CriterionValue;<br/> System.Diagnostics.Debug.WriteLine(Forms.Item[s].DisplayName + </font><font color="#800000">&quot;: &quot;</font><font color="#000000"> + d0.ToString());<br/> </font><font color="#008080">End</font><font color="#000000"> </font><font color="#008080">For</font><font color="#000000">;<br/> System.Diagnostics.Debug.WriteLine(</font><font color="#800000">&quot;== Best dependency ==&quot;</font><font color="#000000">);<br/> System.Diagnostics.Debug.WriteLine(trend.BestDependenceForm);<br/> Poly := Forms.Item[</font><font color="#008000">2</font><font color="#000000">];<br/> Forecast := Poly.Forecast;<br/> System.Diagnostics.Debug.WriteLine(</font><font color="#800000">&quot;Dependency &quot;</font><font color="#000000"> + Poly.DisplayName + </font><font color="#800000">&quot; criterion value &quot;</font><font color="#000000"> + Poly.CriterionValue.ToString());<br/> System.Diagnostics.Debug.WriteLine(</font><font color="#800000">&quot;== Forecasting series ==&quot;</font><font color="#000000">);<br/> System.Diagnostics.Debug.Indent();<br/> </font><font color="#008080">For</font><font color="#000000"> i := trend.ForecastFirstPoint </font><font color="#008080">To</font><font color="#000000"> Forecast.Value.Length - </font><font color="#008000">1</font><font color="#000000"> </font><font color="#008080">Do</font><font color="#000000"><br/> System.Diagnostics.Debug.WriteLine(Forecast.Value.GetValue(i));<br/> </font><font color="#008080">End</font><font color="#000000"> </font><font color="#008080">For</font><font color="#000000">;<br/> System.Diagnostics.Debug.Unindent();<br/> System.Diagnostics.Debug.WriteLine(</font><font color="#800000">&quot;== Seasonal component ==&quot;</font><font color="#000000">);<br/> System.Diagnostics.Debug.Indent();<br/> </font><font color="#008080">For</font><font color="#000000"> i := Period.FirstPoint </font><font color="#008080">To</font><font color="#000000"> trend.SeasonalAdjustment.Length - </font><font color="#008000">1</font><font color="#000000"> </font><font color="#008080">Do</font><font color="#000000"><br/> d0 := trend.SeasonalAdjustment.GetValue(i) </font><font color="#008080">As</font><font color="#000000"> double;<br/> System.Diagnostics.Debug.WriteLine(d0.ToString());<br/> </font><font color="#008080">End</font><font color="#000000"> </font><font color="#008080">For</font><font color="#000000">;<br/> System.Diagnostics.Debug.Indent();<br/> </font><font color="#008080">End</font><font color="#000000"> </font><font color="#008080">If</font><font color="#000000">;<br/> </font><font color="#008080">End</font><font color="#000000"> </font><font color="#008080">Sub</font><font color="#000000"> UserProc;</font>

See also:

ISmCurveEstimation