Extrapolate(Input: ITimeSeries;
Period: IMsPeriod;
Type: DependenceType;
[SeasonalEffect: SeasonalityType = 0;]
[SeasonalPeriod: Integer = 4;]
[PolinomPower: Integer = 3;]
[Value: Integer = 0;]
[Casewise: MsCasewise = 0]): Variant;
Input. Output variable.
Period. Period, at which the method is calculated
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.
The Extrapolate method transforms a variable using a trend with functional dependency estimation.
Features of setting parameters:
Period. If the parameter is set to Null, the method is calculated at the entire time period
SeasonalEffect. Optional parameter. The seasonal model is not used by default.
SeasonalPeriod. Optional parameter. The default value is four. The parameter should be greater or equal to four. The parameter value is taken into account if the additive or multiplicative seasonal model is used.
PolinomPower. Optional parameter. The default value is three. The parameter should 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.
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 at least one 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;
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 will transform 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.
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 cross functional expression editor in any platform tool where it is available.
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 seasonal model (length of seasonal period is 4), calculation is executed at the entire period using the Casewise missing data treatment method.
Use: it can be used in model formulas of modeling container based on variables.
See also:
IModelling |Trend with Matching of Functional Dependency | Time Series Database: Calculator, Trend Modeling Container: The Trend with Matching of Functional DependencyModel, Editing Regressor or Formula