4.8.9.1.5. statsmodels.tsa.tsatools.detrend

statsmodels.tsa.tsatools.detrend(x, order=1, axis=0)[source]

detrend an array with a trend of given order along axis 0 or 1

Parameters:

x : array_like, 1d or 2d

data, if 2d, then each row or column is independently detrended with the same trendorder, but independent trend estimates

order : int

specifies the polynomial order of the trend, zero is constant, one is linear trend, two is quadratic trend

axis : int

for detrending with order > 0, axis can be either 0 observations by rows, or 1, observations by columns

Returns:

detrended data series : ndarray

The detrended series is the residual of the linear regression of the data on the trend of given order.