top of page
Search
Writer's picturePujitha Gangarapu

Auto Regression



Auto Regression is a kind of regression where the dependent variable (y) is a function of past values of the dependent variable (yt ). The term auto regression indicates that it is a regression of the variable itself.

Thus an auto-regressive model can be mathematically written as

yt=c+ϕ1yt−1+ϕ2yt−2+⋯+ϕpyt−p+εt


Where εt = white noise.


For instance, if the p-value is 5, then predictors for y would be

y = c+ϕ1yt−1+ϕ2yt−2+⋯+ϕpyt−5



The auto-regressive model assumes that the observations at the previous time steps are correlated with the next time step value. This relationship is called the auto-correlation.


In order to check for dependence, a visual method pandas lag_plot() function is widely used. This plot helps us to see if the correlation-ship exists. If the series is highly correlated, a tight close group of data points that align along some point/line on the plot. Here is an example




Another way to identify the correlation is through pandas built-in function to plot auto-correlation.








The dark central line at zero is a zero line. The light-dark line is a 95% confidence line and the dotted line indicates 99% confidence.

The points on the graph show its confidence levels. In the above chart, we can see that there is a significant correlation between t= 3(roughly) and t = 6. This makes sense because the data has a high seasonality with peaks in the first quarter and second quarter. The data is not stationary. We need to convert the series to stationary before proceeding further. To understand more on stationary and non-stationary, please refer here. (A topic for another blog.)



So, let's see the python implementation of Auto Regression (p)







11 views0 comments

Recent Posts

See All

Excel Hyperlinks Through Pandas

Data collection is a very common task. As a part of our daily routines, we might need to pull data through web-scraping from a website. ...

Comments


bottom of page