Lrxf(Input: ITimeSeries;
Period: IMsPeriod;
PrioryValues: ITimeSeries;
Weights1: ITimeSeries;
Weights2: ITimeSeries;
Smoothing: Integer]): Variant;
Input. Output variable.
Period. Period, at which the method is calculated
PrioryValues. Input series of pre values.
Weights1. First weight values.
Weights2. Second weight value.
Smoothing. Smoothing parameter.
The Lrxf method models the variable by means of LRX-filter.
If the Period parameter is set to Null, the method is calculated at the entire time period.
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 by the determinate equation method and contains more than one input factor.
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;
Inp_1, Inp_2: String;
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;
Inp_1 := TermInfo.TermInnerText;
TransVar := Transf.Inputs.Item(1);
Slice := TransVar.Slices.Item(0);
TermInfo := Transf.CreateTermInfo;
TermInfo.Slice := Slice;
TermInfo.Type := MsFormulaTermType.Pointwise;
Inp_2 := TermInfo.TermInnerText;
Expr := Determ.Expression;
Expr.References := "Ms";
Expr.AsString := "Lrxf(" + Inp_1 + ",SetPeriod(" +
"""" + "01.01.2000" + """" + "," + """" + "01.01.2015" + """" +
"), " + Inp_2 + " ,Null, Null, 110)";
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 will transform the first input variable using LRX filter for the period from 2000 to 2015.
Expression 1:
Lrxf({Brazil|BCA}, SetPeriod("01.01.2005", "01.01.2015"),{Sudan|BCA[t]},{China|BCA[t]},Null,100)
Result: smoothing using LRX filter is applied for the Brazil|BCA series for the period from 2005 to 2015. The input series of preliminary values is set by the Sudan|BCA series, first weight values - by the China|BCA series, the smoothing parameter is equal to one hundred.
Use: it can be used in formulas of cross functional expression editor in any platform tool where it is available.
Expression 2:
Lrxf(X1,Null,X2,Null,Null,50)
Result: smoothing by the LRX filter is applied for the X1 factor at the entire time period. The input series of preliminary values is set by the X2 factor, weight values are not set, the smoothing parameter is equal to fifty.
Use: it can be used in model formulas of modeling container based on variables.
See also:
IModelling | The method LRX Filter | Time Series Database: Calculator Modeling Container: The LRX FilterModel, Editing Regressor or Formula