IModelling.GreyForecast

Syntax

GreyForecast(Input: ITimeSeries; Period: IMsPeriod): Variant;

Parameters

Input. Output variable.

Period. Period, at which the method is calculated.

Description

The GreyForecast method models a variable using the Grey forecast.

Comments

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

Missing data treatment is not applied in the source data.

Example

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 input variable.

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";
    Expr.AsString := "GreyForecast(" + TermInfo.TermInnerText + ",SetPeriod(" +
        """" + "01.01.2000" + """" + "," + """" + "01.01.2015" + """" +
        "))";
    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 model the first input variable using the Grey forecast at the period 2010-2015.

Example of Use in Expressions

Expression 1:

GreyForecast({GDP|Anchorage[t]}, SetPeriod("01.01.2000", "01.01.2015"))

Result: the Grey forecast is applied to the GDP|Anchorage series at the period 2010-2015.

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

Expression 2:

GreyForecast(X1)

Result: the Grey forecast will be applied to the X1 factor at the entire time period.

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

See also:

IModelling | Model GM(1,1)(Grey Forecast) | Time Series Database: Calculator, Grey Forecast | Modeling Container: Specification of Grey Forecast, Editing Regressor or Formula