# Detrending a Series in Practice

Say I want to regress a variable $y_t$ on $X_t$ using ordinary least squares, with the inclusion of a constant, when $X_t$ exhibits a deterministic trend.

Let's say I detrend $X_t$ by running a regression on a time index variable and obtain the residuals $(\hat{u}_t)$.

When it is time to regress $y_t$ on $X_t$, do I use $\hat{u}_t$ instead of $X_t$?

For example:

$y_t=\beta_0+\beta_1\hat{u}_t$

The most obvious thing to do would seem to include a time trend in the regression of $y_t$ on $X_t$, i.e. $$y_t=\beta_0+\beta_1t+\beta_2X_t+error$$ Now, by the Frisch-Waugh-Lovell theorem, the estimate for $\beta_2$ of that regression will be exactly the same if you
• first regress $y_t$ on a constant and the trend, save the residuals, call them $\hat{u}_{yt}$,
• then regress $X_t$ on a constant and the trend, save the residuals, call them $\hat{u}_{Xt}$,
• and finally regress $\hat{u}_{yt}$ on $\hat{u}_{Xt}$ and take the resulting coefficient.
• Actually, you don't need the first step. The estimate of $\beta_2$ will be the same even if the original dep var is used. So the answer to the question is yes, even without the addition of step one. Commented Oct 21, 2015 at 19:40