Width: Integer;
The Width property determines the size of lead/lag for method.
The default value depends on the calendar frequency that is applied for method calculation:
Frequency | Lead/lag |
Annual | 3 |
Semi-annual | 6 |
Quarterly | 12 |
Monthly | 36 |
Weekly | 156 |
5-days | 783 |
7-days | 1095 |
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. Variable identifiers: VAR_1, VAR_2, VAR_3.
Add links to the Cubes, Metabase, Ms 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;
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);
//Variable for weights
Varr2 := MB.ItemByIdNamespace("Var_2", KM.Key).Bind As IVariableStub;
Trans.Series.Add(Varr2);
// Variable for modeling series
Varr3 := MB.ItemByIdNamespace("Var_3", 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;
//Weights
BPFilter.Weights := Varr2 As IMsVariableStub;
//Modeling series
BPFilter.Fitted := Varr3 As IMsVariableStub;
MObj.Save;
End Sub UserProc;
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. The borders values of the seasonal period and the size of lead/lag for model are also set.
See also: