Auto regressive models,
it remarkably flexible at handling a wide range of different time series patterns.
1 – Time series and forecasting.
2 – What is auto regression.
3 – What is stationarity.
4 – Types of autoregressive models.
5 – How to pick the autoregressive model and
6 – Use cases of Ar
1 – Time Series And Forecasting.
In mathematics a time series is a
sequence taken at a successively equally spaced points in time,
therefore it's a sequence of separate time data.
The time can be of any order such as
in terms of years months hours or minutes,
for example analyzing profits in a company
over many years would be an example of time series or,
checking the weather at different
time stamps can also be a time series.
however checking the temperature
over different matrix such as city or latitude will not be an example of time
series.
so using suitable time series
forecasts can be made
Soothsaying is a fashion that uses literal data as inputs to make informed estimates,
that are prophetic in determining the direction of unborn trends.
There are various notations used in time series data.
The alphabet t taking numeric values
such as 1 2 3 etc is the index denoting the particular time period.
y t would be the series of n values corresponding
to each time index d.
The greek alphabet phi denotes the coefficient
for each value of y t.
c is a constant term denoting the
bias of the model,
and eta denotes the error in forecast in time t given the actual value y t minus the forecasted value f d.
2 – What is Auto Regression.
The term auto regression is composed
of two terms auto and regression.
The term regression refers to the prediction
of some numeric value this value can be of any scale and still be regressive.
And auto here means self that is prediction
of numeric value based on its own previous cells.
No other factors are taken into consideration,
except for its own historical data
consider this example,
here the price of an object is determined
based on the date.
The predictions are only based on
its own older values,
thus we can say that auto regression
is a time series model that uses observations from previous time steps as
inputs to predict the same characteristics at the next time step.
To calculate the value at time step
t for value y the regression equation looks like this,
where y d is the value at time t,
c is the constant,
phi is the coefficient to each of
the previous time stem values and,
eta is the error term of the equation.
A constraint to using autoregression
is that the time series data needs to be stationary.
3 – What is Stationarity.
Time series data is said to be
stationary, if the statistical properties do not change over time,
it is supposed to show an inclining
or declining overall trend,
so the mean and variance should
remain constant over different slices in the data,
also a time series with seasonal patterns
with no clear trend is not stationary.
For example this data depicts
incline in some months and decline in some others forming a seasonal pattern,
hence it is not stationary.
however this data is showing a clear
inclining trend.
so it is an example of stationary
data so guys when we know that the data is stationary.
we can proceed with auto regression.
4 – Types of Autoregressive Models.
The types of autoregressive models i
mean the number of previous values to take into account.
let's see in this example we have
data till 2020 for profit and,
we want to find the profit for the
coming year that is 2021.
the type of ar model will determine
which of the date from the previous years we will take into consideration.
Ar1 will only take one previous
year's data point into consideration.
The equation shows that to determine
yt we are only taking the value of y of t minus 1 along with its coefficient
phi constant c and error term eta,
similarly ar2 takes both the data of
t minus 1 and t minus 2 to predict y t,
note that in the equation there's
always one constant and one error term,
but the number of coefficients of
older values depends on the type of autoregressive model we take.
the number of previous values is not
limited to one or two,
it can be any p values taken into
consideration.
accordingly the equation will
contain p coefficients 2.
5 – How To Pick The Autoregressive Model
Let's find out how to pick the number
of lag values to consider
You might think that it's obvious toconsider
all the previous data points to build a model.
however the rule of auto regression
is to make the simplest model with least number of parameters,
to determine which lag values to
take we can consider something known as a pacf plot.
pacf stands for partial
autocorrelation function,
as explanatory with the name it determines
the partial correlation between a given point and its lag or previous value,
we can only take into account those
parameters for which the lag is higher than the threshold value,
consider this plot the data points
corresponding to each year looks like this,
we have profit for each year from
this data we need to make a derived chart where we will take the difference in
profit between that year and two years before.
so lag will be equal to 2 and we
will find the value of y of t minus y of t minus 2.
thus lag of 2020 will be profit of
2020 which is 82 minus profit of 2018 which is 93 that is equal to minus 11.
lag of 2018 will be profit in 2018
minus profit in 2016 which is 93 minus 94 equals minus 1 and so on.
for this data we make a pacf plot
taking threshold as magnitude of 10.
From this plot we see that the
profit lag for the years 2014 and 2018 is below the magnitude of 10.
thus we will only take the points of
yt with t equals 2012 2016 and 2020.
The equation for this function will
be the forecasted value for 2021 equals constant c plus phi into y of 2012 plus
phi into y of 2016 plus phi into y of 2020 plus the error term eta.
this is the simplest equation of
auto regression to forecast the time series taking only the significant lags.
6 – Use cases of Ar
The model of auto regression is
based on auto correlation,
thus auto regression can help us
find if there is a lack of randomness in the data.
Secondly as we have seen the primary
use case of autoregression is to predict future changes using time series indexing.
aAuto regression is also commonly
used to analyze markets such as stock market.
it can also forecast any kind of recurring or seasonal pattern in the data.
0 Comments