Fill(Input: ITimeSeries;
Method: MsFillMethod;
[NumberOfPoints: Integer = 1;]
[SpecifiedValue: Double = 0;]
[AdditionalSeries: ITimeSeries = Null;]
[FillBound: MsFillBoundType = 2]): Variant;
Fill(Input: Prognoz.Platform.Interop.Ms.ITimeSeries;
Method: Prognoz.Platform.Interop.Ms.MsFillMethod;
NumberOfPoints: integer;
SpecifiedValue: double;
AdditionalSeries: Prognoz.Platform.Interop.Ms.ITimeSeries);
FillBound: Prognoz.Platform.Interop.Ms.MsFillBoundType;
Context: Prognoz.Platform.Interop.Fore.ForeRuntimeContext): object;
Input. Output variable.
Method. Missing data treatment method.
NumberOfPoints. An additional parameter for the missing data treatment method, which determines the number of points or periods (depending on the method in use). In Fore: optional parameter with the default value set to 1.
SpecifiedValue. Value to treat missing data. The parameter is used for the Specified Value method. In Fore: optional parameter with the default value set to 0.
AdditionalSeries. The variable, which values are used for missing data treatment. The parameter is used for the Pattern Overlay methods. In Fore: optional parameter, the variable is not specified by default.
FillBound. Period of missing data substitution. In Fore: optional parameter, by default, missing data is substituted up to the end of the forecasting period.
Context. Context. The parameter is used only in Fore.NET.
The Fill parameter fills empty values of the series using various missing data treatment methods.
The NumberOfPoints parameter can take only positive values. The parameter is relevant for the following missing data treatment methods:
NPointsAverage. N-point average. InterpolateParam determines the N that is the number of neighbor points.
PreviousGrowthRate. SucceedingGrowthRate. Growth rate to previous or succeeding period. InterpolateParam determines the number of periods.
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 input variable 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 := "Fill(" + TermInfo.TermInnerText +
", MsFillMethod.NPointAverage, 4, 0, Null, MsFillBoundType.EndIdentify)";
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 by using the Four Neighbor Points Average missing data treatment method.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.ForeSystem;
Imports Prognoz.Platform.Interop.Ms;
…
[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;
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 := "Fill(" + TermInfo.TermInnerText +
", MsFillMethod.NPointAverage, 4, 0, Null, MsFillBoundType.EndIdentify)";
If Expr.Valid
Then ModelObj.Save();
Else System.Diagnostics.Debug.WriteLine("Model is not saved: error in formulaquot;);
End If;
End Sub;
Expression 1:
Fill({Brazil|BCA}, MsFillMethod.Pattern, 0, 0, {China|BCA}, MsFillBoundType.EndIdentify)
Result: pattern interpolation using the pattern specified with the China|BCA time series is used to substitute missing data at the sample period for the Brazil|BCA time series.
Use: it can be used in formulas of calculated series of time series database and in formulas of attribute-based models.
Expression 2:
Fill(X1,MsFillMethod.Value)
Result: the random value from interval [minimum value of the X1 series; maximum value of the X1 series] is used for filling of empty points of the X1 factor.
Use: it can be used in model formulas of modeling container.
See also:
IModelling | Methods of Missing Data Treatment |Time Series Database: Calculator, Methods of Missing Data Treatment Modeling Container: The Missing Data Treatment Model, Editing Regressor or Formula