X11(Input: ITimeSeries;
Period: IMsPeriod
OutputSeries: MsOutputSeriesType;
SeasonalEffect: SeasonalityType;
[TradingDaysAdjustment: MsTradingDaysAdjustment = 0;]
[LowerSigma: Double = 1.5;]
[UpperSigma: Double = 2.5;]
[MovingAverage: String = "";]
[WeightCoefficients: String = "";]
[HolidayAdjustment: MsHolidayAdjustment = 0;]
[SSAnalysis: Boolean = False]): Variant;
Input. Input variable.
Period. Period, at which the method is calculated.
OutputSeries. Series type that is loaded to the output variable.
SeasonalEffect. Seasonal model.
TradingDaysAdjustment. Working day adjustment.
LowerSigma. Lower sigma limit.
UpperSigma. Upper sigma limit.
MovingAverage. Moving average.
WeightCoefficients. Weight coefficients.
HolidayAdjustment. Holiday adjustment.
SSAnalysis. Indicates whether moving intervals are used in calculation.
The X11 method executes seasonal decomposition and data adjustment.
The method is supported only in Windows.
The method returns correct results only during work with monthly or quarterly frequency.
Features of setting parameters:
Period. If the parameter is set to Null, the method is calculated at the entire time period.
TradingDaysAdjustment. Optional parameter for Fore, working day adjustment is not calculated by default.
LowerSigma. Optional parameter for Fore, the default value is 1.5.
UpperSigma. Optional parameter for Fore, the default value is 2.5.
MovingAverage, WeightCoefficients. Optional parameters for Fore, the default value is not set.
HolidayAdjustment. Optional parameter for Fore, holiday adjustment is not calculated by default.
SSAnalysis. Optional parameter for Fore, the default value is False (sliding spans are not used in calculation).
Executing the example requires that the repository contains a modeling container with the MS identifier. This container includes a model with the MODEL_D_Q 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_Q", 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 := "X11(" + TermInfo.TermInnerText + ",SetPeriod(" +
"""" + "01.01.2000" + """" + "," + """" + "01.01.2015" + """" +
"),MsOutputSeriesType.D10, SeasonalityType.Additive, " +
"MsTradingDaysAdjustment.No, 1.8, 2.1, """", """", MsHolidayAdjustment.None, False)";
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 execute seasonal decomposition and seasonal adjustment by the X11 method without the working day and holiday adjustment and using of sliding spans for 2000 to 2015 years.
Expression 1:
x11({Brazil|BCA[t]}, SetPeriod("2000", "2015"), MsOutputSeriesType.D10, SeasonalityType.Additive, MsTradingDaysAdjustment.Auto)
Result: seasonal decomposition and seasonal adjustment are executed for the Brazil|BCA factor with automatic working day adjustment 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:
x11(X1, Null, MsOutputSeriesType.D10, SeasonalityType.Additive, MsTradingDaysAdjustment.No, 1.8, 2.1
, "", "", MsHolidayAdjustment.None, False)
Result: seasonal decomposition and seasonal adjustment are executed for the X1 factor at the entire period without the working day and holiday adjustment and using of sliding spans.
Use: it can be used in model formulas of modeling container based on variables.
See also:
IModelling | The X11Method | Time Series Database: Calculator, Seasonal Adjustment Modeling Container: The X11Model, Editing Regressor or Formula