# Can an ordinary least squares regression be used with time-series data?

Mar 3, 2016

Yes.

#### Explanation:

Least-squares regression is as applicable to time-series data as it is to data which is dependent on any other variable. One can use least-squares to find a best fit of a function of time to data gathered in a time series.

For example, imagine a pendulum swinging back a forth, and a measurement apparatus which gathers data on the position of the pendulum. This data has a time, $t$, and a position, $x$.

We can use a least-squares approach to determine the coefficients of a fit function, in this case we may be using the following function:

$x \left(t\right) = {c}_{1} \cdot \sin \left({c}_{2} x - {c}_{3}\right)$

Where we adjust the coefficients ${c}_{1} , {c}_{2} ,$ and ${c}_{3}$ to minimize the sum of squares of the error between the points and the function evaluated at those time values.