This function is a class of seasonality tests using corrgram_test
from ATAforecasting package, ndiffs
and nsdiffs
functions from forecast package.
Also, this function is modified version of ndiffs
and nsdiffs
written by Hyndman et al. forecast
package.
Please review manual and vignette documents of latest forecast
package. According to forecast
package,
ndiffs
and nsdiffs
functions to estimate the number of differences required to make a given time series stationary.
ndiffs
uses unit root tests to determine the number of differences required for time series to be made trend stationary. Several different tests are available:
uroot.test = 'kpss' : the KPSS test is used with the null hypothesis that x
has a stationary root against a unit-root alternative. Then the test returns the least number of differences required to pass the test at the level uroot.alpha
.
uroot.test = 'adf' : the Augmented Dickey-Fuller test is used.
uroot.test = 'pp' : the Phillips-Perron test is used. In both of these cases, the null hypothesis is that x
has a unit root against a stationary root alternative. Then the test returns the least number of differences required to fail the test at the level uroot.alpha
.
nsdiffs
uses seasonal unit root tests to determine the number of seasonal differences required for time series to be made stationary. Several different tests are available:
suroot.test = 'seas' : a measure of seasonal strength is used, where differencing is selected if the seasonal strength (Wang, Smith & Hyndman, 2006) exceeds 0.64 (based on minimizing MASE when forecasting using auto.arima on M3 and M4 data).
suroot.test = 'ch' : the Canova-Hansen (1995) test is used (with null hypothesis of deterministic seasonality)
suroot.test = 'hegy' : the Hylleberg, Engle, Granger & Yoo (1990) test is used.
suroot.test = 'ocsb' : the Osborn-Chui-Smith-Birchenhall (1988) test is used (with null hypothesis that a seasonal unit root exists).
suroot.test = 'correlogram' : this function is written based on M4 Competition Seasonality Test.
ATA.Seasonality(input, ppy, attr_set)
The data.
Frequency of the data.
Assign from ATA.SeasAttr
function. Attributes set for unit root, seasonality tests.
TRUE
if the serie has seasonality. Otherwise, FALSE
.
#'Dickey DA, Fuller WA (1979). “Distribution of the Estimators for Autoregressive Time Series With a Unit Root.” Journal of the American Statistical Association, 74(366), 427--431.
#'Said SE, Dickey DA (1984). “Testing for Unit Roots in Autoregressive-Moving Average Models of Unknown Order.” Biometrika, 71(3), 599--607.
#'Dickey DA, Hasza DP, Fuller WA (1984). “Testing for Unit Roots in Seasonal Time Series.” Journal of the American Statistical Association, 79(386), 355--367.
#'Phillips PCB, Perron P (1988). “Testing for a Unit Root in Time Series Regression.” Biometrika, 75(2), 335--346.
#'Osborn DR, Chui APL, Smith J, Birchenhall CR (1988). “Seasonality and the order of integration for consumption.” Oxford Bulletin of Economics and Statistics, 50(4), 361--377.
#'Hylleberg S, Engle RF, Granger CWJ, Yoo BS (1990). “Seasonal integration and cointegration.” Journal of Econometrics, 1344(1), 215--238.
#'Kwiatkowski D, Phillips P, Schmidt P, Shin Y (1992). “Testing the null hypothesis of stationarity against the alternative of a unit root: How sure are we that economic time series have a unit root?” Journal of Econometrics, 54(1--3), 159--178.
#'Canova F, Hansen BE (1995). “Are Seasonal Patterns Constant over Time? A Test for Seasonal Stability.” Journal of Business and Economic Statistics, 13(3), 237--252.
#'Wang X, Smith KA, Hyndman RJ (2006). “Characteristic-based clustering for time series data.” Data Mining and Knowledge Discovery, 13(3), 335--364.