# Does it violate the assumptions of linear regression to perform it on time series data?

One of the assumptions of linear regression says that the errors must be independent i.e., the residuals must not depend on each other.

Let's say we are using linear regression to model the temperature on a given day. If it is 13:00 and 20 degrees, the temperature at 13:15 will be similar and thus depends on the time before it - it cannot suddenly fall to -20 in the space of 15 minutes. Likewise, the temperature at 20:00 will be more closely related to the temperature at 19:50 than 13:00.

Does the linear regression assumption 'independence of errors' mean that you cannot perform it on time series data?

You are correct when you say that there might be autocorrelation in the error terms when some observation in time $$t$$ is contingent on $$t-1$$. Find a rigorous discussion of the problem here.

Usually a solution to cope with this problem is to include additional variables to "control for" autocorrelation. This usually means adding lagged $$y$$-variables (which are called autoregressive variables or $$AR(t)$$). So you could simply add a lagged variable $$y_{t-1}$$ to your model, which reads like "todays $$y$$ is (among other things) explained by yesterdays $$y$$".

Say you have a model which is contingent on time (omitting $$i$$ for convenience):

$$y_t = \beta X_t + u_t.$$

You can add an autoregressive term like:

$$y_t = \beta X_t + \gamma y_{t-1} + u_t.$$

For a detailled discussion including testing procedures, please refer to the link above.