IMsFillGapsTransform.MissingData

Syntax

MissingData: IMissingData;

Description

The MissingData property returns an object containing parameters of missing data treatment in the source series.

Comments

The following missing data treatment methods cannot be used: MissingDataMethod.Casewise and MissingDataMethod.None.

Example

Executing the example requires that the repository contains a modeling container with the CONT_MODEL identifier. Three modeling variables with the INPUT_FILL_GRAPS, OUTPUT_FILL_GRAPS, and VAR_EXPL identifiers must be available in this container.

Add links to the Metabase and Ms system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    Cont: IMetabaseObjectDescriptor;
    Descript: IMetabaseObjectDescriptor;
    ModelKey: Integer;
    CrInf: IMetabaseObjectCreateInfo;
    MObj: IMetabaseObject;
    Model: IMsModel;
    Obj_x1: IMetabaseObject;
    Transform: IMsFormulaTransform;
    Out: IMsFormulaTransformVariables;
    TransformVar: IMsFormulaTransformVariable;
    Slice: IMsFormulaTransformSlice;
    Selector: IMsFormulaTransformSelector;
    Formula: IMsFormula;
    FillGaps: IMsFillGapsTransform;
    ModelVar_x1: IVariableStub;
    TermInfo: IMsFormulaTermInfo;
Begin
    MB := MetabaseClass.Active;
    Cont := Mb.ItemById("CONT_MODEL").Bind;
    ModelKey := Cont.Key;
    // Create a new model in modeling container
    CrInf := MB.CreateCreateInfo;
    CrInf.ClassId := MetabaseObjectClass.KE_CLASS_MSMODEL;
    CrInf.Name := "New_Fill_Graps_Model";
    CrInf.Parent := Cont;
    CrInf.Permanent := True;
    MObj := MB.CreateObject(CrInf).Edit;
    Model := MObj As IMsModel;
    Transform := Model.Transform;
    // Set output variable
    Descript := MB.ItemByIdNamespace("INPUT_FILL_GRAPS",ModelKey);
    Obj_x1 := Descript.Bind;
    ModelVar_x1 := Obj_x1 As IVariableStub;
    Out := Transform.Outputs;
    Out.Clear;
    Out.Add(ModelVar_x1);
    // Determine model type
    TransformVar := Out.Item(0);
    Slice := TransformVar.Slices.Add(Null);
    Selector := Transform.CreateSelector;
    Selector.Slice := Slice;
    Formula := Transform.Transform(Selector);
    Formula.Kind := MsFormulaKind.FillGaps;
    FillGaps := Formula.Method As IMsFillGapsTransform;
    TermInfo := Transform.CreateTerminfo;
    TermInfo.Slice := Slice;
    FillGaps.InputFactorTerm:= TermInfo;
    // Set variable, to which results will be loaded
    Descript := MB.ItemByIdNamespace("OUTPUT_FILL_GRAPS",ModelKey);
    Obj_x1 := Descript.Bind;
    ModelVar_x1 := Obj_x1 As IVariableStub;
    FillGaps.Fitted := ModelVar_x1;
    // Determine model calculation options
    FillGaps.MissingData.Method:= MissingDataMethod.Overlay;
    Descript := MB.ItemByIdNamespace("VAR_EXPL",ModelKey);
    Obj_x1 := Descript.Bind;
    ModelVar_x1 := Obj_x1 As IVariableStub;
    TransformVar := Transform.Inputs.Add(ModelVar_x1);
    Slice := TransformVar.Slices.Add(Null);
    TermInfo.Slice := Slice;
    FillGaps.Specified := TermInfo;
    MObj.Save;
End Sub;

After executing the example, the NEW_FILL_GRAPS_MODEL model that uses missing data treatment method for calculation is created in the modeling container. The output variable is INPUT_FILL_GRAPS, the results are loaded to the OUTPUT_FILL_GRAPS variable. The skipped values of output series are replaced with values from the series that is determined by the VAR_EXPL variable.

See also:

IMsFillGapsTransform