Functions to estimate the number of differences required to make a given
time series stationary.
nsdiffs estimates the number of seasonal differences
nsdiffs( x, alpha = 0.05, m = frequency(x), test = c("seas", "ocsb", "hegy", "ch"), max.D = 1, ... )
A univariate time series
Level of the test, possible values range from 0.01 to 0.1.
Deprecated. Length of seasonal period
Type of unit root test to use
Maximum number of seasonal differences allowed
Additional arguments to be passed on to the unit root test
An integer indicating the number of differences required for stationarity.
nsdiffs uses seasonal unit root tests to determine the number of
seasonal differences required for time series
x to be made stationary
(possibly with some lag-one differencing as well).
Several different tests are available:
test="seas" (default), 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).
test="ch", the Canova-Hansen (1995) test is used
(with null hypothesis of deterministic seasonality)
test="hegy", the Hylleberg, Engle, Granger & Yoo (1990) test is used.
test="ocsb", the Osborn-Chui-Smith-Birchenhall
(1988) test is used (with null hypothesis that a seasonal unit root exists).
Wang, X, Smith, KA, Hyndman, RJ (2006) "Characteristic-based clustering for time series data", Data Mining and Knowledge Discovery, 13(3), 335-364.
Osborn DR, Chui APL, Smith J, and Birchenhall CR (1988) "Seasonality and the order of integration for consumption", Oxford Bulletin of Economics and Statistics 50(4):361-377.
Canova F and Hansen BE (1995) "Are Seasonal Patterns Constant over Time? A Test for Seasonal Stability", Journal of Business and Economic Statistics 13(3):237-252.
Hylleberg S, Engle R, Granger C and Yoo B (1990) "Seasonal integration and cointegration.", Journal of Econometrics 44(1), pp. 215-238.