# How to model a linear regression based on time?

I have some training set data variables $x_1$, $x_2$, $x_3$, $x_4$, and $x_5$ and a response variable $y$. But these are time series data. So the for the same set of values of $x_1$, $x_2$, $x_3$, $x_4$, and $x_5$ the response variable $y$ may be different in different observations. Can anyone please suggest me how to model my linear regression in this case? I am learning newly statistics. Please explain in the simplest way possible.

I am uploading a picture explaining the same question for more clarity

-

## migrated from math.stackexchange.comSep 8 '12 at 8:31

This question came from our site for people studying math at any level and professionals in related fields.

If I understand correctly, the difference in the dependent variable $y$ may depend: 1) on another variable $x_6$ you didn't detect (it may be the time); 2) on random errors. Which may be your case? –  Libra Sep 3 '12 at 20:53
What is it that you want to test? –  user13253 Sep 8 '12 at 10:35

## 1 Answer

If your aim is to "detrend" the data (i.e., remove the "time dependent" component from your estimates), you can estimate the model as

$Y = \alpha + \beta t + \gamma_i X_i + \epsilon$

Where the $\beta t$ term captures your linear time variance and the $\gamma_i$ terms capture the marginal effect of your $X_i$s, assuming all your other modelling assumptions hold.

The time component in your data is referred to as "non-stationarity" and there is a whole literature on dealing with this sort of time-series analysis. The above is perhaps the simplest model you could suggest, however embodied in it is a huge set of assumptions about the state of your data generating process.

-