Show contents 

Stat Assembly > Stat Assembly Interfaces > ISmCurveEstimation > ISmCurveEstimation.MissingData

ISmCurveEstimation.MissingData

Syntax

MissingData: IMissingData;

Description

The MissingData property determines missing data treatment parameters.

Comments

By default missing data is not treated.

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 the modeling series and the source series, dependency criteria values, the best dependency number, the forecasting series calculated by means of polynomial dependency, seasonal component values.

See also:

ISmCurveEstimation