B1: ITimeSeries;
B1: Prognoz.Platform.Interop.Ms.ITimeSeries;
The B1 property returns series after prior adjustment or source series.
This interface also enables the user to get:
IMsX11Result.D10. Seasonal component of source series
IMsX11Result.D11. Seasonal adjustment
IMsX11Result.D12. Trend-cycle component
IMsX11Result.D13. Irregular component.
Custom method of calculation which returns forecast values for any forecast calculation method is given.
Add links to the Ms, Stat system assemblies.
Public Function X11Result(Result: Variant): ITimeSeries;
Var
X11Res: IMsX11Result;
Series: ITimeSeries;
Begin
X11Res := Result As IMsX11Result;
// Display method name
Debug.WriteLine("Method name: " + X11Res.BaseMethod.Name);
Debug.WriteLine("");
// Get series after prior adjustment or source series and display it in the console window
Series := X11Res.B1;
Debug.WriteLine("Series after a prior adjustment or source series");
Print(Series);
// Get seasonal component of the source series and display it in the console window
Series := X11Res.D10;
Debug.WriteLine("Seasonal component of the source series");
Print(Series);
// Get seasonal adjustment and display it in the console window
Series := X11Res.D11;
Debug.WriteLine("Seasonal adjustment");
Print(Series);
// Get trend-cycle component and display it in the console window
Series := X11Res.D12;
Debug.WriteLine("Trend-cycle component");
Print(Series);
// Get irregular component and display it in the console window
Series := X11Res.D13;
Debug.WriteLine("Irregular component");
Print(Series);
// Return forecast series
Return X11Res.Fitted;
End Function X11Result;
// Procedure of series values displaying in the console window
Sub Print(Series: ITimeSeries);
Var
i: Integer;
d: DateTime;
Begin
Debug.Indent;
For i := Series.StartIndex To Series.EndIndex Do
d := Series.IndexToDate(i);
Debug.WriteLine(CultureInfo.Current.FormatShortDate(d) + ": " + Series.Item(i));
End For;
Debug.Unindent;
Debug.WriteLine("");
End Sub Print;
After executing the example the console window displays results of the X11 method calculation.
This custom method can be used in determinate equation, in calculator nbsp; in time series analysis and in expression editor. For example, the use of custom method in determinate equation:
IMSX11RESULT_B1.X11Result(x11(X1, Null, MsOutputSeriesType.B1, SeasonalityType.Multiplicative))
Where:
IMSX11RESULT_B1. Identifier of the module including custom method
X11Result. Custom method name
x11. The X11 calculation method
X1. Model factor.
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;
Imports Prognoz.Platform.Interop.Stat;
…
Public Shared Function X11Result(Result: object): ITimeSeries;
Var
X11Res: IMsX11Result;
Series: ITimeSeries;
Begin
X11Res := Result As IMsX11Result;
// Display method name
System.Diagnostics.Debug.WriteLine("Method name: " + X11Res.BaseMethod.Name);
System.Diagnostics.Debug.WriteLine("");
// Get series after prior adjustment or source series and display it in the console window
Series := X11Res.B1;
System.Diagnostics.Debug.WriteLine("Series after a priori adjustment or the source series");
Print(Series);
// Get seasonal component of the source series and display it in the console window
Series := X11Res.D10;
System.Diagnostics.Debug.WriteLine("Seasonal component of source series");
Print(Series);
// Get seasonal adjustment and display it in the console window
Series := X11Res.D11;
System.Diagnostics.Debug.WriteLine("Seasonal adjustment");
Print(Series);
// Get trend-cycle component and display it in the console window
Series := X11Res.D12;
System.Diagnostics.Debug.WriteLine("Trend-cycle component");
Print(Series);
// Get irregular component and display it in the console window
Series := X11Res.D13;
System.Diagnostics.Debug.WriteLine("Irregular component");
Print(Series);
// Return forecast series
Return X11Res.Fitted;
End Function X11Result;
// Procedure of series values displaying in the console window
Public Shared Sub Print(Series: ITimeSeries);
Var
CultureInfo: CultureInfoClassClass = New CultureInfoClassClass();
i: Integer;
d: DateTime;
Begin
System.Diagnostics.Debug.Indent();
For i := Series.StartIndex To Series.EndIndex Do
d := Series.IndexToDate(i);
System.Diagnostics.Debug.WriteLine(CultureInfo.Current.FormatShortDate(d) + ": " + Series.Item[i]);
End For;
System.Diagnostics.Debug.Unindent();
System.Diagnostics.Debug.WriteLine("");
End Sub Print;
See also: