pmdarima.arima.nsdiffs(x, m, max_D=2, test='ocsb', **kwargs)[source][source]

Estimate the seasonal differencing term, D.

Perform a test of seasonality for different levels of D to estimate the number of seasonal differences required to make a given time series stationary. Will select the maximum value of D for which the time series is judged seasonally stationary by the statistical test.


x : array-like, shape=(n_samples, [n_features])

The array to difference.

m : int

The number of seasonal periods (i.e., frequency of the time series)

max_D : int, optional (default=2)

Maximum number of seasonal differences allowed. Must be a positive integer. The estimated value of D will not exceed max_D.

test : str, optional (default=’ocsb’)

Type of unit root test of seasonality to use in order to detect seasonal periodicity. Valid tests include (“ocsb”, “ch”). Note that the CHTest is very slow for large data.


D : int

The estimated seasonal differencing term. This is the maximum value of D such that D <= max_D and the time series is judged seasonally stationary. If the time series is constant, will return 0.