IModelling.InterpolateP

Syntax

InterpolateP(Input: ITimeSeries;

             TargetFrequency: MsFrequency;

             Pattern: ITimeSeries;

             [PatternType: MsPatternType = 0;]

             [Period: IMsPeriod = Null]): Variant;

Parameters

Input. Input variable.

TargetFrequency. Output frequency.

Pattern. Pattern variable, on which the interpolation is based.

PatternType. Pattern type, on which the interpolation is based.

Period. Period, at which the method is calculated.

Description

The InterpolateP method interpolates variable values according to a pattern.

Comments

Features of setting parameters:

On data disaggregation the following calendar frequency settings are taken into account: start period offset relative to its start/end.

Example of data aggregation from weekly to daily frequency

Example

Executing the example requires that the repository contains a modeling container with the MS identifier. This container includes a determinate equation model with the annual frequency with the MODEL_D identifier. This model should contain several factors. Each factor should contain annual and quarterly frequency.

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;
    InputTerm, PatternTerm: IMsFormulaTermInfo;
    Expr: IExpression;
Begin
    Mb := MetabaseClass.Active;
    ModelSpace := Mb.ItemById("CONT_MODEL").Bind;
    ModelObj := Mb.ItemByIdNamespace("M_DETERM", 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);
    InputTerm := Transf.CreateTermInfo;
    InputTerm.Slice := Slice;
    TransVar := Transf.Inputs.Item(1);
    Slice := TransVar.Slices.Item(0);
    PatternTerm := Transf.CreateTermInfo;
    Slice.Level := DimCalendarLevel.Quarter;
    PatternTerm.Slice := Slice;
    Expr := Determ.Expression;
    Expr.References := "Ms";
    Expr.AsString := "InterpolateP(" + InputTerm.TermInnerText + ",MsFrequency.Quarterly," +
        PatternTerm.TermInnerText + ",MsPatternType.First,SetPeriod(" +
        """" + "01.01.2000" + """" + "," + """" + "01.01.2015" + """" + "))";
    If Expr.Valid
        Then ModelObj.Save;
        Else Debug.WriteLine("Model is not saved: error in equation");
   End If;
End Sub UserProc;

After executing the example the model will interpolate the first input variable data from annual frequency to quarterly one for the period from 2000 to 2015. A pattern, set by the second input variable, is used for interpolation.

Example of Use in Expressions

Expression 1:

InterpolateP({Brazil|BCA[t]},MsFrequency.Quarterly,{China|BCA[t]})

Result: the Brazil|BCA series data will be disaggregated to quarterly frequency by pattern set by the China|BCA series at the entire time period.

Use: it can be used in formulas of cross functional expression editor in any platform tool where it is available.

Expression 2:

InterpolateP(X1,MsFrequency.Monthly,X2,MsPatternType.Last, SetPeriod("01.01.2000","01.01.2015"))

Result: the X1 factor data will be disaggregated to monthly frequency by the last pattern element set by the X2 factor for the period from 2000 to 2015.

Use: it can be used in model formulas of modeling container based on variables.

See also:

IModelling | Interpolation Methods | Time Series Database: Calculator, Interpolation Modeling Container: The InterpolationModel, Editing Regressor or Formula