Regression Analysis > Detrend Data
What does it mean to Detrend Data?
Detrending is removing a trend from a time series; a trend usually refers to a change in the mean over time. When you detrend data, you remove an aspect from the data that you think is causing some kind of distortion. For example, you might detrend data that shows an overall increase, in order to see subtrends. Usually, these subtrends are seen as fluctuations on a time series graph.
Detrending MethodsYou must know the underlying structure of the trend in order to detrend it. For example, if you have a simple linear trend for the mean, calculate the least squares regression line to estimate the growth rate, r. Then subtract the deviations from the least squares fit line (i.e. the differences) from your data.
Many other methods exist, some of which are very complex. For example:
- Quadratic detrending is similar to linear detrending with one major difference: you assume the data follows an exponential patterns and add a time2.
- Moving average trend lines can be detrended with the Baxter-King filter.
- Cyclical components of time series can be removed with the Hodrick-Prescott filter.
Detrending techniques are often very specific to your field of study; if you have data that isn’t linearly correlated, you may want to look for subject-specific detrending methods. For example, Dave Meko of The University of Arizona has detailed notes about various types of detrending techniques used in tree-ring research. You can find those notes here.
Most statistical software packages have options to detrend. For example:
Use one of the following commands:
- y = detrend(x) to remove the best straight-line fit from vector x.
- y = detrend(x,’constant’) to remove the mean value from vector x.
- y = detrend(x,’linear’,bp) to remove a continuous, piecewise linear trend from vector x.
Need help with a homework or test question? With Chegg Study, you can get step-by-step solutions to your questions from an expert in the field. Your first 30 minutes with a Chegg tutor is free!
Comments? Need to post a correction? Please post a comment on our Facebook page.