Fortune tellers, Horoscopes and Soothsayers are always valued very high, as we are worried about our future and obsessed to know it upfront.
Time series modeling/forecasting are scientific ways to predict the future. We try to estimate a dependent variable based on how it changed over time.
Time series data is collected in sequence and at equal intervals of time. Other types of data, wherein we ignore the effect of time, are called Cross-sectional data.
The conventional data models look into the relationship/effect of independent variables to predict a dependent variable.
In time series data we look at the effect of time on the dependent variable, means time is the independent variable.
We can use a simple linear regression model to predict the dependent variable using time. These type of models which deal with dependent and independent variables are called "Model-based forecasting models".
In few scenarios, we might not look into other independent variables effect on target variable. Models, where dependent and independent variables are same are called as "Data-Driven forecasting models".
Let’s talk about the ARIMA model which is a combination of 3 different models,also called a mixed model,where we have 3 models in conjunction working to extract information.
AR: Autoregressive - regression model between target variable and its lagged variable
I : Integration - one stepped lag value differencing from current value , this helps in making the data trend-free(Stationary)
MA : Moving average - relationships between the previous time periods error terms on the current period’s error team.
Notation is ARIMA (p,d,q), where
P is the order of AR model
d is differencing order for I model
q is order of MA model
Note that the ARIMA model assumes the time series to be non-seasonal.The ARIMA model is making the overall residual a white noise,which means it extracts all the information from the time series.
If the original time series is stationary, that is a constant trend,then we can go ahead and apply the ARAMA model.ARIMA model is applied for non-stationary time series.
Order of execution:
Integration [I (d)] : Differencing is performed to make the data stationary (trend-free),that is time series will be having a constant trend( constant average). We subtract Yt(current value) from one-stepped lag(Yt-1) value.One-step lagged difference will make data trend-free,if not then we can go with 2-step lagged differencing
ARIMA (0,1,0) = Yt-Yt-1
ARIMA (0,2,0) = Yt-Yt-1-(Yt-Yt-2)=Yt-2(Yt-1)+Yt-2
Note: In some cases, we might also have to perform seasonal differencing that is to remove seasonality aspect from time series; we subtract the current value Yt with Yt-M; where M is the seasonality of time series.
Auto regression [AR (p)]: This model is a linear regression model,which takes into account the correlation between, response variable(Yt) and its lagged value (Yt-k).
The lag value which has a strong correlation is considered for building an equation, and ‘p’ represents the order of the lag.
Where b0,b1,b2,are coefficients of linear regression model
ARIMA (1,0,0) = Yt=b0+b1*Yt-1+et
Order ‘p’ for AR model is identified by Autocorrelation Function,also called as ACF plot; it is a visualization of lag values on x-axis and respective correlation coefficient ® values on y-axis
3.Moving Average [MA (q)] : Model extracts information if any left out in errors (residuals) of the previous forecasts made to make current forecasts
MA model also follows linear regression equation on lagged errors
Yt=b0 + et+b1*et-1+b2*et-2+-------------+bq*et-q
ARIMA (0,0,1) = b0+et+b1*et-1
Forecasting techniques applied on any timeseries will leave out some residuals and these residuals/errors should not contain any information.That means they should exhibit white noise properties.
To identify precisely a white noise from a signal we can ACF plot.For white noise, only the ‘lag 0’ correlation value should be significant, rest all other lagged correlations should be insignificant in ACF plot.
We can also use PACF ( Partial Autocorrelation Function), which captures conditional correlation between two variables (Yt and Yt-k), Considering that partial correlation is the correlation between residuals from two different regressions. Assume we have dependent variable ‘y’ , and the three independent variables x1,x2,x3
1)Regression of y from x1 and x2,
2) Regression of x3 from x1 and x2.
Partial correlation is the correlation between the errors from 1st regression and 2nd regression. ( In other words, Correlation of y and x3 that are not predicted by x1 and x2)