OutliersARIMAao: ISlOutliers;
OutliersARIMAao: Prognoz.Platform.Interop.Stat.ISlOutliers;
The OutliersARIMAao property returns the list of additive outliers, accounted for in the ARIMA stage.
To determine whether to account for the outliers in the procedure, use the ISmx12arima.OutliersDetection prooperty.
To execute the example, add a link to the Stat system assembly.
Sub UserProc;
Var
cens: ISmX12ARIMA;
y: Array[62] Of Double;
AR, MA: Array[1] Of Integer;
outlier: ICensus2PeriodBegin;
i, res: Integer;
Begin
cens := New SmX12ARIMA.Create;
// Values of explained series
y[0] := 284; y[1] := 277; y[2] := 338; y[3] := 363; y[4] := Double.Nan; y[5] := 388;
y[6] := 407; y[7] := 427; y[8] := 368; y[9] := Double.Nan; y[10] := 353; y[11] := 375;
y[12] := 248; y[13] := 263; y[14] := 322; y[15] := 396; y[16] := 412; y[17] := 451;
y[18] := 457; y[19] := 457; y[20] := 463; y[21] := 443; y[22] := 411; y[23] := 398;
y[24] := 335; y[25] := 321; y[26] := 393; y[27] := 418; y[28] := 431; y[29] := 499;
y[30] := 583; y[31] := 578; y[32] := 497; y[33] := 519; y[34] := 528; y[35] := 508;
y[36] := 422; y[37] := 439; y[38] := 494; y[39] := 539; y[40] := 559; y[41] := 603;
y[42] := 627; y[43] := 612; y[44] := 548; y[45] := 480; y[46] := 385; y[47] := 428;
y[48] := 307; y[49] := 273; y[50] := 334; y[51] := 390; y[52] := 415; y[53] := 453;
y[54] := 450; y[55] := 479; y[56] := 420; y[57] := 387; y[58] := 381; y[59] := 414;
y[60] := 335; y[61] := 326;
/// General settings ///
//Calculation period
cens.ModelPeriod.FirstPoint := 1;
cens.ModelPeriod.LastPoint := 62;
//Select explanatory variable
cens.Serie.Value := y;
//Quarters or months
cens.SeasonalComponentCycleType := SeasonalityCycleType.Month;
cens.StartPeriod.MonthOrQuarter := 2;
cens.StartPeriod.Year := 2000;
//Missing data treatment
cens.MissingData.Method := MissingDataMethod.SampleAverage;
// Autoregression order
AR[0] := 2;
cens.OrderAR := AR;
// Moving average order
MA[0] := 1;
cens.OrderMA := MA;
// Seasonal autoregression order
AR[0] := 2;
cens.OrderARSeas := AR;
// Seasonal moving average order
MA[0] := 1;
cens.OrderMASeas := MA;
/// Seasonality settings ///
//Seasonality type
cens.SeasonalAdjustmentMode := SeasonalityTypeX12.Additive;
//Seasonal filter
cens.SeasonalFilter := SeasonalFilterType.Auto;
/// Working day and holiday adjustments ///
// Whether there are adjustments
cens.AdjustmentOptions := AdjustmentOptionsX12Type.X11Step;
// Use adjustments only if it is required
cens.AICtest := False;
// Working day adjustment
cens.TradingDayEffects := TradingDayEffectsX12Type.TdStock;
cens.TdstockValue := 1;
// Source series transformation
cens.DataTransformation := DataTransformationX12Type.BoxCoxPower;
cens.BoxCoxPowerTransform := 1;
/// Outliers ///
outlier := cens.OutliersARIMAao.Add;
outlier.Year := 2000;
outlier.MonthOrQuarter := 2;
outlier := cens.OutliersARIMArpbegin.Add;
outlier.Year := 2002;
outlier.MonthOrQuarter := 1;
outlier := cens.OutliersARIMArpend.Add;
outlier.Year := 2002;
outlier.MonthOrQuarter := 5;
// Regressors
cens.PredefinedVariableConst := False;
cens.PredefinedVariableSeasonal := False;
/// Diagnostics ///
// Analysis of seasonal component stability
cens.StabilityAnalysisofSeasonals := StabilityAnalysisofSeasonalsX12Type.None;
//Other
cens.ResidualsDiagnostic := False;
cens.OutliersDetection := True;
/// Model calculation ///
res := cens.Execute;
Debug.WriteLine(cens.Errors);
For i := 0 To cens.WarningsCount - 1 Do
Debug.WriteLine(cens.Warnings[i]);
End For;
If (res = 0) Then
Debug.WriteLine("=== Seasonal component ===");
Debug.Indent;
For i := 0 To cens.SeasonallyAdjusted.Length - 1 Do
Debug.WriteLine(cens.SeasonallyAdjusted[i]);
End For;
Debug.Unindent;
Debug.WriteLine("=== Seasonal adjustment ===");
Debug.Indent;
For i := 0 To cens.SeasonalFactors.Length - 1 Do
Debug.WriteLine(cens.SeasonalFactors[i]);
End For;
Debug.Unindent;
Debug.WriteLine("=== Seasonal component ===");
Debug.Indent;
For i := 0 To cens.CombinedSeasonalFactors.Length - 1 Do
Debug.WriteLine(cens.CombinedSeasonalFactors[i]);
End For;
Debug.Unindent;
End If;
End Sub UserProc;
After executing the example the X12 model is created, the console window displays:
Seasonal component.
Seasonal adjustment.
Seasonal component.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Stat;
…
Public Shared Sub Main(Params: StartParams);
Var
cens: ISmX12ARIMA;
y: Array[62] Of Double;
AR, MA: Array[1] Of Integer;
outlier: ICensus2PeriodBegin;
i, res: Integer;
Warnings, SAdj, SFactors, CSFactors: System.Array;
Begin
cens := New SmX12ARIMA.Create();
// Values of explained series
y[0] := 284; y[1] := 277; y[2] := 338; y[3] := 363; y[4] := Double.Nan; y[5] := 388;
y[6] := 407; y[7] := 427; y[8] := 368; y[9] := Double.Nan; y[10] := 353; y[11] := 375;
y[12] := 248; y[13] := 263; y[14] := 322; y[15] := 396; y[16] := 412; y[17] := 451;
y[18] := 457; y[19] := 457; y[20] := 463; y[21] := 443; y[22] := 411; y[23] := 398;
y[24] := 335; y[25] := 321; y[26] := 393; y[27] := 418; y[28] := 431; y[29] := 499;
y[30] := 583; y[31] := 578; y[32] := 497; y[33] := 519; y[34] := 528; y[35] := 508;
y[36] := 422; y[37] := 439; y[38] := 494; y[39] := 539; y[40] := 559; y[41] := 603;
y[42] := 627; y[43] := 612; y[44] := 548; y[45] := 480; y[46] := 385; y[47] := 428;
y[48] := 307; y[49] := 273; y[50] := 334; y[51] := 390; y[52] := 415; y[53] := 453;
y[54] := 450; y[55] := 479; y[56] := 420; y[57] := 387; y[58] := 381; y[59] := 414;
y[60] := 335; y[61] := 326;
/// General settings ///
//Calculation period
cens.ModelPeriod.FirstPoint := 1;
cens.ModelPeriod.LastPoint := 62;
//Select explanatory variable
cens.Serie.Value := y;
//Quarters or months
cens.SeasonalComponentCycleType := SeasonalityCycleType.sctMonth;
cens.StartPeriod.MonthOrQuarter := 2;
cens.StartPeriod.Year := 2000;
//Missing data treatment
cens.MissingData.Method := MissingDataMethod.mdmSampleAverage;
// Autoregression order
AR[0] := 2;
cens.OrderAR := AR;
// Moving average order
MA[0] := 1;
cens.OrderMA := MA;
// Seasonal autoregression order
AR[0] := 2;
cens.OrderARSeas := AR;
// Seasonal moving average order
MA[0] := 1;
cens.OrderMASeas := MA;
/// Seasonality settings ///
//Seasonality type
cens.SeasonalAdjustmentMode := SeasonalityTypeX12.stx12Additive;
//Seasonal filter
cens.SeasonalFilter := SeasonalFilterType.sftAuto;
/// Working day and holiday adjustments ///
// Whether there are adjustments
cens.AdjustmentOptions := AdjustmentOptionsX12Type.aox12tX11Step;
// Use adjustments only if it is required
cens.AICtest := False;
// Working day adjustment
cens.TradingDayEffects := TradingDayEffectsX12Type.tdex12tTdStock;
cens.TdstockValue := 1;
// Source series transformation
cens.DataTransformation := DataTransformationX12Type.dtx12tBoxCoxPower;
cens.BoxCoxPowerTransform := 1;
/// Outliers ///
outlier := cens.OutliersARIMAao.Add();
outlier.Year := 2000;
outlier.MonthOrQuarter := 2;
outlier := cens.OutliersARIMArpbegin.Add();
outlier.Year := 2002;
outlier.MonthOrQuarter := 1;
outlier := cens.OutliersARIMArpend.Add();
outlier.Year := 2002;
outlier.MonthOrQuarter := 5;
// Regressors
cens.PredefinedVariableConst := False;
cens.PredefinedVariableSeasonal := False;
/// Diagnostics ///
// Analysis of seasonal component stability
cens.StabilityAnalysisofSeasonals := StabilityAnalysisofSeasonalsX12Type.sasx12tNone;
//Other
cens.ResidualsDiagnostic := False;
cens.OutliersDetection := True;
/// Model calculation ///
res := cens.Execute();
System.Diagnostics.Debug.WriteLine(cens.Errors);
Warnings := cens.Warnings;
For i := 0 To cens.WarningsCount - 1 Do
System.Diagnostics.Debug.WriteLine(Warnings[i]);
End For;
If (res = 0) Then
System.Diagnostics.Debug.WriteLine("=== Seasonal component ===");
System.Diagnostics.Debug.Indent();
SAdj := cens.SeasonallyAdjusted;
For i := 0 To cens.SeasonallyAdjusted.Length - 1 Do
System.Diagnostics.Debug.WriteLine(SAdj[i]);
End For;
System.Diagnostics.Debug.Unindent();
System.Diagnostics.Debug.WriteLine("=== Seasonal adjustment ===");
System.Diagnostics.Debug.Indent();
SFactors := cens.SeasonalFactors;
For i := 0 To cens.SeasonalFactors.Length - 1 Do
System.Diagnostics.Debug.WriteLine(SFactors[i]);
End For;
System.Diagnostics.Debug.Unindent();
System.Diagnostics.Debug.WriteLine("=== Seasonal component ===");
System.Diagnostics.Debug.Indent();
CSFactors := cens.CombinedSeasonalFactors;
For i := 0 To cens.CombinedSeasonalFactors.Length - 1 Do
System.Diagnostics.Debug.WriteLine(CSFactors[i]);
End For;
System.Diagnostics.Debug.Unindent();
End If;
End Sub;
See also: