IModelling.Extrapolate

Fore Syntax

Extrapolate(Input: ITimeSeries;
            Period: IMsPeriod;

            Type: DependenceType;

            [SeasonalEffect: SeasonalityType = 0;]

            [SeasonalPeriod: Integer = 4;]

            [PolinomPower: Integer = 3;]

            [Value: Integer = 0;]

            [Casewise: MsCasewise = 0]): Variant;

Fore.NET Syntax

Extrapolate(Input: Prognoz.Platform.Interop.Ms.ITimeSeries;
            Period: Prognoz.Platform.Interop.Ms.IMsPeriod;

            Type: Prognoz.Platform.Interop.Stat.DependenceType;

            SeasonalEffect: Type: Prognoz.Platform.Interop.Stat.SeasonalityType;

            SeasonalPeriod: integer;

            PolinomPower: integer = 3;

            Value: integer;

            Casewise: Prognoz.Platform.Interop.Ms.MsCasewise;
            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.

Type. Type of functional dependency.

SeasonalEffect. Seasonal model.

SeasonalPeriod. Length of seasonal period.

PolinomPower. Polynomial degree for multinomial functional dependency.

Value. Set value of extrapolation.

Casewise. Missing data treatment method.

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

Description

The Extrapolate method transforms a variable using a trend with functional dependency estimation.

Comments

SeasonalEffect. Optional parameter. The seasonal value is not used by default.

SeasonalPeriod. Optional parameter. The default value is four. The SeasonalPeriod parameter must be greater or equal to four. The parameter value is taken into account if the additive or multiplicative seasonality model is used.

PolinomPower. Optional parameter. The default value is three. The PolinomPower parameter must be greater or equal to zero. If a negative value is specified, the polynomial degree is regarded as equal to zero.

Value. Optional parameter. The default value is zero. It is used if extrapolation by set value is used: Type = DependenceType.Value.

Casewise. Optional parameter. Missing data treatment is not used by default.

Fore Example

Executing the example requires that the repository contains a modeling container with the MS identifier. A model with the MODEL_D identifier calculated by the method of determinate equation and containing at least one factor must be available in this container.

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;
    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;
    Expr := Determ.Expression;
    Expr.References := "Ms;Stat";
    Expr.AsString := "Extrapolate(" + TermInfo.TermInnerText + ", SetPeriod(" +
        """" + "01.01.2000" + """" + "," + """" + "01.01.2015" + """" +
        "), DependenceType.Linear, SeasonalityType.Additive, 4, 3, 0, MsCasewise.Yes)";
    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 transforms the first input variable using the trend with functional dependency estimation for the period from 2000 to 2015. Calculation is executed using the Casewise missing data treatment method.

Fore.NET 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;

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;
    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;
    Expr := Determ.Expression;
    Expr.References := "Ms;Stat";
    Expr.AsString := "Extrapolate(" + TermInfo.TermInnerText + ", SetPeriod(" +
        """" + "01.01.2000" + """" + "," + """" + "01.01.2015" + """" +
        "), DependenceType.Linear, SeasonalityType.Additive, 4, 3, 0, MsCasewise.Yes)";
    If Expr.Valid Then
        ModelObj.Save();
    Else
        System.Diagnostics.Debug.WriteLine("Model is not saved: error in the formula");
    End If;
End Sub;

Example of Use in Expressions

Expression 1:

Extrapolate({Brazil|BCA[t]}, SetPeriod("01.01.2000","01.01.2015"),DependenceType.Linear)

Result: the Brazil|BCA series is transformed using the trend with linear functional dependency, calculation is executed without missing data treatment for the period from 2000 to 2015.

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:

Extrapolate(X1,DependenceType.Logarithmic,SeasonalityType.Additive,4,0,0, MsCasewise.Yes)

Result: the X1 factor is transformed using the logarithmic trend with additive seasonality model (length of seasonal period is 4), calculation is executed for the entire period using the Casewise missing data treatment method.

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

See also:

IModelling |Trend with Matching of Functional Dependency | Time Series Database: Calculator, Trend   Modeling Container: The Trend with Matching of Functional Dependency Model, Editing Regressor or Formula