IModelling.Fill

Syntax

Fill(Input: ITimeSeries;

     Method: MsFillMethod;

     [NumberOfPoints: Integer = 1;]

     [SpecifiedValue: Double = 0;]

     [AdditionalSeries: ITimeSeries = Null;]

     [FillBound: MsFillBoundType = 2;]

     [EndsFill: Boolean = false]): Variant;

Parameters

Input. Output variable.

Method. Missing data treatment method.

NumberOfPoints. An additional parameter for the missing data treatment method, which determines the number of points or periods (depending on the method in use).

SpecifiedValue. Value to substitute missing data.

AdditionalSeries. The variable, which values are used for missing data substitution.

FillBound. Period of missing data substitution.

EndsFill. Missing data substitution on the period border.

Description

The Fill parameter fills empty values of the series using various missing data treatment methods.

Comments

Features of setting parameters:

Example

Executing the example requires that the repository contains a modeling container with the MS identifier. This container includes a model with the MODEL_D identifier that is calculated using the determinate equation method and contains at least one input variable.

Add links to the Metabase and Ms system assemblies.

Sub UserProc;
Var
    Mb: IMetabase;
    ModelSpace, ModelObj: IMetabaseObject;
    Transf: IMsFormulaTransform;
    Formula: IMsFormula;
    Model: IMsModel;
    Determ: IMsDeterministicTransform;
    TransVar: IMsFormulaTransformVariable;
    Slice: IMsFormulaTransformSlice;
    TermInfo: IMsFormulaTermInfo;
    Expr: IExpression;
Begin
    Mb := MetabaseClass.Active;
    ModelSpace := Mb.ItemById("MS").Bind;
    ModelObj := Mb.ItemByIdNamespace("MODEL_D", ModelSpace.Key).Edit;
    Model := ModelObj As IMsModel;
    Transf := Model.Transform;
    Formula := Transf.FormulaItem(0);
    Determ := Formula.Method As IMsDeterministicTransform;
    TransVar := Transf.Inputs.Item(0);
    Slice := TransVar.Slices.Item(0);
    TermInfo := Transf.CreateTermInfo;
    TermInfo.Slice := Slice;
    TermInfo.Type := MsFormulaTermType.Pointwise;
    Expr := Determ.Expression;
    Expr.References := "Ms;Stat";
    Expr.AsString := "Fill(" + TermInfo.TermInnerText +
        ", MsFillMethod.NPointAverage, 4, 0, Null, MsFillBoundType.EndIdentify, True)";
    If Expr.Valid
        Then ModelObj.Save;
        Else Debug.WriteLine(Model is not saved: error in formula);
    End If;
End Sub UserProc;

After executing the example the model transforms the first input variable by using the Four Neighbor Points Average method of missing data treatment to the end of the forecasting period with missing data substitution on period border.

Example of Use in Expressions

Expression 1:

Fill({Brazil|BCA}, MsFillMethod.Pattern, 0, 0, {China|BCA}, MsFillBoundType.EndIdentify)

Result: pattern interpolation using the pattern specified with the China|BCA time series is used to substitute missing data at the sample period for the Brazil|BCA time series.

Use: it can be used in formulas of cross functional expression editor in any platform tool where it is available.

Expression 2:

Fill(X1,MsFillMethod.Value)

Result: the random value from interval [minimum value of the X1 series; maximum value of the X1 series] is used for filling of empty points of the X1 factor.

Use: it can be used in model formulas of modeling container.

See also:

IModelling | Methods of Missing Data Treatment |Time Series Database: Calculator, Methods of Missing Data Treatment Modeling Container: The Missing Data TreatmentModel, Editing Regressor or Formula