# 2 – M2L4 02 Autoregressive Models V5

When we look at log returns of a stock, we assume that the previous period’s value gives us some insight into the next period’s value. It’s also reasonable to assume that the past couple of data points give us hints as to what the next value will be. This is the main principle behind Auto-regressive Models. An autoregressive model, also called an AR model, tries to fit a line that is a linear combination of previous values. The AR model includes an Intercept which represents some constant that is independent of the previous values. The AR model also includes an Error term, which represents movements that cannot be predicted using the previous values. Let’s see how we prepare the time-series data, to feed it into an Autoregressive model. As an example, our AR model will use the previous two values to predict the current value. For example, if we have daily data for Monday, Tuesday, and Wednesday, then we use Monday and Tuesday as the independent variables. We also define Wednesday as the dependent variable that the Model tries to predict. Then, when we move on to Thursday, we use the previous two days to predict Thursday’s value. If data from a previous period has some predictive value, then this coefficient will be non-zero. The number of past values used in the model is known as the Lag. We define an AR model by its Lag. For example, a model that only uses yesterday’s value and ignores the rest, is an AR 1 Model. Whereas, a model that uses the two previous days’ values and ignores the rest is an AR 2 Model, and a model that uses the previous three days’ values and ignores the rest is an AR 3 Model. We write Auto-regressive Models as ARP, where p stands for the lag. We can choose different lag values to train your model and see how they perform on test data. We can check if the coefficients are significantly different from zero. If some coefficients are likely zero, then you can reduce the lag and focus the model on the more recent values. As with any regression model, you can also check the adjusted R squared to get a sense of how well the independent variables explain the movements of the dependent variables. Note that an AR model is designed to represent a single time series. If you have several different time series, you could build a separate AR model for each. But what if the movement of one stock has some relation to the movement of another? You may be seeing something similar with multivariate multiple regression. To account for interdependence among more than one time series, we can use the multivariate version of autoregression. This is called a vector autoregressive model. Note that having some familiarity with the vector autoregressive model will help you as you learn about pairs trading in a later lesson.