# Autoregression

Learn how to use autoregression to forecast with time series data.

## We'll cover the following

## Understanding autoregression

**Autoregression**, as the name suggests, is a regression of a value over itself at some other moment. It means we look at the model like this:

Where:

$x_t$ is the variable we want to predict at a time,$t$ ,$x_{t-1}$ is that same variable at time$t-1$ , and so on.$\alpha$ is a constant.$\beta_1$ is the coefficient used for$x_{t-1}$ ,$\beta_2$ is the coefficient used for$x_{t-2}$ , and so on.$\epsilon$ is the error term.

Intuitively, that model works almost as a weighted average between past observations, and the

How far does

## Forecasting with autoregression

Fortunately, we don't have to do that regression on our own. We can use the same Python function, ARIMA, which we used to calculate the MA(n) model. To implement AR(2), let us set the MA parameter to zero and the AR parameter to two, in the ARIMA function.

Get hands-on with 1200+ tech skills courses.