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) – axis can be either 0, observations by rows, or 1, observations by columns
Returns:

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

Return type:

ndarray

© 2009–2012 Statsmodels Developers
© 2006–2008 Scipy Developers
© 2006 Jonathan E. Taylor
Licensed under the 3-clause BSD License.
http://www.statsmodels.org/stable/generated/statsmodels.tsa.tsatools.detrend.html