MissingData: IMissingData;
The MissingData property returns parameters for handling empty values of source series.
Executing the example requires that the repository contains a modeling container with the KONT_MODEL identifier. The container contains three variables that will be used in model calculation.
Add links to the Metabase, Ms, Stat system assemblies.
Sub UserProc;
Var
MB: IMetabase;
KM: IMetabaseObjectDescriptor;
CrInf: IMetabaseObjectCreateInfo;
MObj: IMetabaseObject;
Model: IMsModel;
Trans: IMsFormulaTransform;
Varr1, Varr2, Varr3: IVariableStub;
VarTrans: IMsFormulaTransformVariable;
Tree: IMsFormulaTransformSlicesTree;
Slice: IMsFormulaTransformSlice;
Selector: IMsFormulaTransformSelector;
Formula: IMsFormula;
BPFilter: IMsBandpassFilterTransform;
MData: IMissingData;
Info: IMsFormulaTermInfo;
Begin
MB := MetabaseClass.Active;
KM := Mb.ItemById("KONT_MODEL");
CrInf := Mb.CreateCreateInfo;
CrInf.ClassId := MetabaseObjectClass.KE_CLASS_MSMODEL;
CrInf.Id := "New_BPFilter";
CrInf.Name := "New_BPFilter";
CrInf.Parent := KM;
MObj := MB.CreateObject(CrInf).Edit;
Model := MObj As IMsModel;
Trans := Model.Transform;
//Output
Varr1 := MB.ItemByIdNamespace("Var_1", KM.Key).Bind As IVariableStub;
VarTrans := Trans.Outputs.Add(Varr1);
//Variables for weights
Varr2 := MB.ItemByIdNamespace("temp_Var2", KM.Key).Bind As IVariableStub;
Trans.Series.Add(Varr2);
//Variable for a modeling series
Varr3 := MB.ItemByIdNamespace("temp_Var3", KM.Key).Bind As IVariableStub;
Trans.Series.Add(Varr3);
Tree := VarTrans.SlicesTree(VarTrans);
Slice := Tree.CreateSlice(1);
Selector := Model.Transform.CreateSelector;
Selector.Slice := Slice;
Formula := Model.Transform.Transform(Selector);
Formula.Kind := MsFormulaKind.BandpassFilter;
BPFilter := Formula.Method As IMsBandpassFilterTransform;
BPFilter.Width := 2;
BPFilter.FrequencyLow := 1;
BPFilter.FrequencyHigh := 10;
//Missing data treatment order
MData := BPFilter.MissingData;
MData.Method := MissingDataMethod.NPointsAverage;
MData.MethodParameter := 7;
Info := Trans.CreateTermInfo;
//Weights
Info.Slice := Trans.Series.Item(0).Slices.Add(Null);
BPFilter.WeightsTerm := Info;
//Modeling series
Info.Slice := Trans.Series.Item(1).Slices.Add(Null);
BPFilter.FittedTerm := Info;
MObj.Save;
End Sub;
After executing the example the model that uses the Baxter-King filter for calculation is created in the modeling container. The output variable and the variables, to which the weights and modeling series values are loaded, are added to the model. Also, the values of cut frequencies and window size for the model are set. The N-point average method is selected as a missing data treatment method. The value is calculated by seven neighbor points.
See also: