## What is Autoregression ?

Autoregression is a time series analysis technique that uses previous values of a time series to predict future values. This technique is commonly used in forecasting and modeling time-series data, such as stock prices, demand for products, or weather patterns.

For example, if we have a time series of monthly sales data for a particular product, we can use autoregression to predict the sales for the next month based on the sales data from previous months. To do this, we would first identify the number of lags, or previous values, that we want to use in our model. We could use 3 lags, for example, which would mean that our model would use the sales data from the current month, as well as the previous 2 months, to predict the sales for the next month.

Next, we would use a regression analysis to identify the relationship between the sales data and the lagged values. This would allow us to create a mathematical equation that could be used to predict the sales for the next month based on the sales data from the previous 3 months.

To illustrate this with an example, let’s say that we have the following monthly sales data for a product:

Month 1: 100 units

Month 2: 120 units

Month 3: 140 units

Month 4: 160 units

Using autoregression with 3 lags, we can predict the sales for Month 5 based on the sales data from the previous 3 months. Using regression analysis, we can identify the relationship between the sales data and the lagged values as follows:

Sales (Month 5) = 100 + 20*(Sales (Month 4) – Sales (Month 3)) + 20*(Sales (Month 3) – Sales (Month 2))

Substituting the values from our sales data, we get:

Sales (Month 5) = 100 + 20*(160 – 140) + 20*(140 – 120) = 100 + 2020 + 2020 = 300 units

Therefore, using autoregression with 3 lags, we can predict that the sales for Month 5 will be 300 units.

Another example of autoregression is in the context of stock prices. Let’s say that we have the following daily stock prices for a particular company:

Day 1: $100

Day 2: $105

Day 3: $110

Day 4: $115

Using autoregression with 2 lags, we can predict the stock price for Day 5 based on the stock prices from the previous 2 days. Using regression analysis, we can identify the relationship between the stock prices and the lagged values as follows:

Stock Price (Day 5) = $100 + 5*(Stock Price (Day 4) – Stock Price (Day 3)) + 5*(Stock Price (Day 3) – Stock Price (Day 2))

Substituting the values from our stock prices, we get:

Stock Price (Day 5) = $100 + 5*($115 – $110) + 5*($110 – $105) = $100 + 55 + 55 = $125

Therefore, using autoregression with 2 lags, we can predict that the stock price for Day 5 will be $125.

In summary, autoregression is a time series analysis technique that uses previous values of a time series to predict future values. This technique is commonly used in forecasting and modeling time-series data, such as stock prices, demand for products, or weather patterns. By identifying the relationship between the time series data and the lagged values, we can create a mathematical equation that can be used to predict future values of the time series.