B1Result: Array;
The B1Result property returns a prior adjusted series or source series.
The value is available only after method calculation.
To set the term, to which these results will be loaded, use the IMsCensus2Transform.B1Term property.
The X11 method is supported only in Windows.
Executing the example requires that the repository contains a modeling container with the MODEL_SPACE identifier containing a model with the MODEL_CENSUS2 identifier. The model should be calculated using the X11 method.
Add links to the Metabase, Ms system assemblies.
Sub X11;
Var
mb: IMetabase;
MsObj: IMetabaseObjectDescriptor;
Model: IMsModel;
Transform: IMsFormulaTransform;
Vars: IMsFormulaTransformVariables;
OutputVar: IMsFormulaTransformVariable;
Coord: IMsFormulaTransformCoord;
Formula: IMsFormula;
Census2: IMsCensus2Transform;
Calc: IMsMethodCalculation;
Data: Array Of Double;
Begin
mb := MetabaseClass.Active;
// Get modeling container
MsObj := mb.ItemById("MODEL_SPACE");
// Get model
Model := mb.ItemByIdNamespace("MODEL_CENSUS2", MsObj.Key).Edit As IMsModel;
// Get model parameters
Transform := Model.Transform;
// Get parameters of X11 method calculation
Formula := Transform.FormulaItem(0);
Census2 := Formula.Method As IMsCensus2Transform;
// Set component that is loaded to output variable
Census2.OutputType := MsCensus2OutputType.D11;
// Set up model calculation
Vars := Transform.Outputs;
OutputVar := Vars.Item(0);
Coord := Transform.CreateCoord(OutputVar);
// Set calculation period parameters
Calc := Transform.CreateCalculation;
Calc.Period.IdentificationStartDate := Model.Transform.Period.IdentificationStartDate;
Calc.Period.IdentificationEndDate := Model.Transform.Period.IdentificationEndDate;
Calc.Period.ForecastStartDate := Model.Transform.Period.ForecastStartDate;
Calc.Period.ForecastEndDate := Model.Transform.Period.ForecastEndDate;
// Execute calculation
Census2.Execute(Calc, Coord);
// Display calculation results
Data := Census2.Explained.Serie(Calc);
Debug.WriteLine("Modeled data");
Print(Data); Debug.WriteLine("");
Data := Census2.B1Result;
Debug.WriteLine("Prior adjusted series or source series");
Print(Data); Debug.WriteLine("");
Data := Census2.D10Result;
Debug.WriteLine("Seasonal component");
Print(Data); Debug.WriteLine("");
Data := Census2.D11Result;
Debug.WriteLine("Seasonal adjustment");
Print(Data); Debug.WriteLine("");
Data := Census2.D12Result;
Debug.WriteLine("Trend-cycle component");
Print(Data); Debug.WriteLine("");
Data := Census2.D13Result;
Debug.WriteLine("Irregular component");
Print(Data); Debug.WriteLine("");
// Save model
(Model As IMetabaseObject).Save;
End Sub X11;
// Data output procedure
Sub Print(Data: Array Of Double);
Var
i: Integer;
Begin
Debug.Indent;
For i := 0 To Data.Length - 1 Do
Debug.WriteLine(i.ToString + " " + Data[i].ToString);
End For;
Debug.Unindent;
End Sub Print;
After executing the example the model will be calculated using the X11 method, and calculation results will be displayed in the console window.
See also: