Irregula: ITimeSeries;
The Irregula property returns irregular component.
Below is the example of custom calculation method that returns a smoothed series for the Census1 method.
Add a link to the Ms system assembly.
Public Function Census1Result(Result: Variant): ITimeSeries;
Var
Census1Res: IMsCensus1Result;
Series: ITimeSeries;
Begin
Census1Res := Result As IMsCensus1Result;
// Display method name
Debug.WriteLine("Method name: " + Census1Res.BaseMethod.Name);
Debug.WriteLine("");
// Get irregular component and display it in the console window
Series := Census1Res.Irregula;
Debug.WriteLine("Irregular component");
Print(Series);
// Get ratio/difference and display it in the console window
Series := Census1Res.RatioDifferences;
Debug.WriteLine("Ratio/difference");
Print(Series);
// Get seasonal component and display it in the console window
Series := Census1Res.Seasonal;
Debug.WriteLine("Seasonal component");
Print(Series);
// Get seasonal adjustment and display it in the console window
Series := Census1Res.SeasonalAdjustment;
Debug.WriteLine("Seasonal adjustment");
Print(Series);
// Get trend-cycle component and display it in the console window
Series := Census1Res.TrendCycle;
Debug.WriteLine("Trend cycle component");
Print(Series);
// Return smoothed series
Return Census1Res.MovingAverage;
End Function Census1Result;
// Procedure of displaying series values in the console window
Sub Print(Series: ITimeSeries);
Var
CF: ICultureInfo;
i: Integer;
d: DateTime;
Begin
CF := CultureInfo.Current;
Debug.Indent;
For i := Series.StartIndex To Series.EndIndex Do
d := Series.IndexToDate(i);
Debug.WriteLine(CF.FormatShortDate(d) + ": " + Series.Item(i));
End For;
Debug.Unindent;
Debug.WriteLine("");
End Sub Print;
After executing the example the console window displays results of Census1 method calculation.
This custom method can be used in determinate equation, in calculator in time series analysis and in expression editor. For example, the use of custom method in determinate equation:
IMSCENSUS1RESULT_IRREGULA.Census1Result(census1(X1, SetPeriod("01.01.2000", "01.01.2015"), MsOutputCensus1SeriesType.MovingAverage, SeasonalityType.Additive))
Where:
IMSCENSUS1RESULT_IRREGULA. Identifier of the unit including custom method.
Census1Result. Custom method name.
Census1. Census1 calculation method.
X1. Model factor.
See also: