IModelling.Lrxf

Fore Syntax

Lrxf(Input: ITimeSeries;

     Period: IMsPeriod;

     PrioryValues: ITimeSeries;

     Weights1: ITimeSeries;

     Weights2: ITimeSeries;

     Smoothing: Integer]): Variant;

Fore.NET Syntax

Lrxf(Input: Prognoz.Platform.Interop.Ms.ITimeSeries;

     Period: Prognoz.Platform.Interop.Ms.IMsPeriod;

     PrioryValues: Prognoz.Platform.Interop.Ms.ITimeSeries;

     Weights1: Prognoz.Platform.Interop.Ms.ITimeSeries;

     Weights2: Prognoz.Platform.Interop.Ms.ITimeSeries;

     Smoothing: integer;

     Context: Prognoz.Platform.Interop.Fore.ForeRuntimeContext): object;

Parameters

Input. Output variable.

Period. Period, at which the method is calculated. If the parameter is set to Null, the method is calculated at the entire time period.

PrioryValues. Input series of pre values.

Weights1. First weight values.

Weights2. Second weight value.

Smoothing. Smoothing parameter.

Context. Context. The parameter is used only in Fore.NET.

Description

The Lrxf method models the variable by means of LRX-filter.

Fore Example

Executing the example requires that the repository contains a modeling container with the MS identifier. This container contains a model with the MODEL_D identifier calculated using by determinate expression method and containing more than one factor.

Add links to the Metabase, 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("The model is not saved: error in formula");
    
End If;
End Sub UserProc;

After executing the example the model transforms the first input variable using LRX filter for the period from 2000 to 2015.

Fore Example

The requirements and result of the Fore.NET example execution match with those in the Fore example.

Imports Prognoz.Platform.Interop.Ms;
Imports Prognoz.Platform.Interop.ForeSystem;

    [STAThread]
Public Shared Sub Main(Params: StartParams);
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 := Params.Metabase;
    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.mfttPointwise;
    Inp_1 := TermInfo.TermInnerText;
    TransVar := Transf.Inputs.Item[1];
    Slice := TransVar.Slices.Item[0];
    TermInfo := Transf.CreateTermInfo();
    TermInfo.Slice := Slice;
    TermInfo.Type := MsFormulaTermType.mfttPointwise;
    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 System.Diagnostics.Debug.WriteLine("Model is not saved: error in formulaquot;);
    End If;
End Sub;

Example of Use in Expressions

Expression 1:

Lrxf({Brazil|BCA}, SetPeriod("01.01.2005", "01.01.2015"),{Sudan|BCA[t]},{China|BCA[t]},Null,100)

Result: smoothing using LRX filters will be applied for the Brazil|BCA series for the period from 2005 to 2015. The input series of pre 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 calculated series of time series database and in formulas of attribute-based models of modeling container.

Expression 2:

Lrxf(X1,Null,X2,Null,Null,50)

Result: the smoothing by LRX-filter is applied for the X1 factor for the entire period. The input series of pre value is set by the X2 factor, the weight values are not set, the smoothing parameter is equal to fifty.

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

See also:

IModelling | The method LRX Filter | Time Series Database: Calculator   Modeling Container: The LRX Filter Model, Editing Regressor or Formula