You are on page 1of 55

TIME SERIES MODELLING

LEARN FROM TIME BASED PATTERN


DEMAND OF FORECASTING

 “Demand forecasting is crucial to electricity providers


because their ability to produce energy exceeds their ability
to store it. Excess demand can cause “brown outs,” while
excess supply ends in waste. In an industry worth over $1
trillion in the U.S. alone [1], almost 9% of GDP [2], even
marginal improvements can have a huge impact.”
GOAL OF FORECASTING

 “The main aim of time series modelling is to carefully


collect and rigorously study the past observations of a time
series to develop an appropriate model
which describes the inherent structure of the series. This
model is then used to generate future
values for the series, i.e. to make forecasts..”
WHAT IS TIME SERIES FORECASTING

 “Time series forecasting thus can be termed as the


act of predicting the future by understanding the past.”
EXAMPLES OF FORECASTING

• Forecasting the corn yield in tons by state each year


• Forecasting whether an EEG trace in seconds indicates a patient is having
a seizure or not.
• Forecasting the closing price of a stock each day.
• Forecasting the birth rate at all hospitals in a city each year.
• Forecasting product sales in units sold each day for a store.
• Forecasting the number of passengers through a train station each day.
• Forecasting unemployment for a state each quarter.
• Forecasting utilization demand on a server each hour.
• Forecasting the size of the rabbit population in a state each breeding
season.
• Forecasting the average price of gasoline in a city each day.
EXAMPLES OF FORECASTING
AREAS TO IMPLEMENT FORECASTING

• Business
• Economics
• Finance
• Science
• Engineering
CHALLENGES OF FORECASTING

“It is obvious that a successful time series forecasting


depends on an appropriate model fitting. “
MODELLING TECHNIQUES:

“Popular methods to build right forecasting models


are listed below“

ARIMA(Autoregressive Integrated Moving Average)


ARMA(Autoregressive Moving Average)
SARIMA(Seasonal ARIMA)
TLNN
LSTM
SVM
ARCH
DEFINITION OF TIME SERIES:

“A time series is a sequential set of data points, measured


typically over successive times. It is mathematically defined as a
set of vectors x(t),t = 0,1,2,... where t represents the time
elapsed.”
TYPES OF TIME SERIES:

“A time series containing records of a single variable is termed


as univariate. But if records of more than one variable are
considered, it is termed as multivariate. A time series can be
continuous or discrete. “
TYPES OF TIME SERIES:

“In a continuous time series observations are measured at every


instance of time

Temperature Readings
Flow of the river
Concentration of Chemical etc.
TYPES OF TIME SERIES:

“Discrete time series contains observations measured at


discrete points

Population of country
Production of a company
Exchange rates.
COMPONENTS OF TIME SERIES
MODELLING:

“A time series in general is supposed to be affected by four


main components, which can be separated from the observed
data. These components are: Trend, Cyclical, Seasonal and
Irregular components.”
TREND:

“The general tendency of a time series to increase, decrease or


stagnate over a long period of time is termed as Secular Trend
or simply Trend ”
TREND:
TREND:
“It is observable that the tendencies may increase, decrease or are stable in different
sections of time.  But the overall trend must be upward, downward or stable. The
trend is linear otherwise it is non-linear (Curvilinear).”
SEASONALITY:

“Seasonal variations in a time series are fluctuations within a


year during the season. The important factors causing seasonal
variations are: climate and weather conditions, customs,
traditional habits, etc. For example sales of ice-cream increase
in summer, sales of woolen cloths increase in winter. Seasonal
variation is an important factor for businessmen, shopkeeper
and producers for making proper future plans ”
SEASONALITY:
SEASONALITY:
CYCLIC:

“The cyclical variation in a time series describes the medium-


term changes in the series, caused by circumstances, which
repeat in cycles. The duration of a cycle extends over longer
period of time, usually two or more years. Most of the
economic and financial time series show some kind of cyclical
variation”
CYCLIC:
CYCLIC:
IRREGULAR:

“Irregular or random variations in a time series are caused by


unpredictable influences, which are not regular and also do not
repeat in a particular pattern. These variations are caused by
incidences such as war, strike, earthquake, flood, revolution, etc.
There is no defined statistical technique for measuring random
fluctuations in a time series.”
IRREGULAR:

“Multiplicative and Additive models.


Multiplicative Model: Y(t) =T(t)×S(t)×C(t)×I(t).
Additive Model: Y (t ) = T (t ) + S (t ) + C (t ) + I (t ).”
IRREGULAR:
TIME-SERIES & STOCHASTIC:

“A time series is non-deterministic in nature, i.e. we cannot


predict with certainty what will occur in future ”
TIME-SERIES & STOCHASTIC:

“Generally a time series {x(t),t = 0,1,2,...} is assumed to follow


certain probability model which describes the joint distribution
of the random variable x . The mathematical expression
t

describing the probability structure of a time series is termed as


a stochastic process.”
TIME-SERIES & STOCHASTIC:
CONCEPT OF STATIONARITY:

“The concept of stationarity of a stochastic process can be


visualized as a form of statistical equilibrium. The statistical
properties such as mean and variance of a stationary process
do not depend upon time. It is a necessary condition for
building a time series model that is useful for future forecasting.
Further, the mathematical complexity of the fitted model
reduces with this assumption.”
CONCEPT OF STATIONARITY:

“A process {x(t),t = 0,1,2,...} is Strongly Stationary or Strictly


Stationary if the joint probability distribution function of
{x ,x ,...,x ,...x ,x }is independent of t for all s.”
t−s t−s+1 t t+s−1 t+s
MODEL PARSIMONY:

“While building a proper time series model we have to


consider the principle of parsimony [2, 7, 8, 23]. According to
this principle, always the model with smallest possible number
of parameters is to be selected so as to provide an adequate
representation of the underlying time series data .”
MODEL PARSIMONY:
STEPS FOR BUILDING ARIMA MODEL:

Step 1 — Check stationarity: If a time series has a trend or


seasonality component, it must be made stationary before we
can use ARIMA to forecast. .”
STEPS FOR BUILDING ARIMA MODEL:

Step 2 — Difference: If the time series is not stationary, it needs


to be stationarized through differencing. Take the first
difference, then check for stationarity. Take as many differences
as it takes. Make sure you check seasonal differencing as well.
STEPS FOR BUILDING ARIMA MODEL:

Step 3 — Filter out a validation sample: This will be used to


validate how accurate our model is. Use train test validation
split to achieve this
STEPS FOR BUILDING ARIMA MODEL:

Step 4 — Select AR and MA terms: Use the ACF and PACF to


decide whether to include an AR term(s), MA term(s), or both.
STEPS FOR BUILDING ARIMA MODEL:

Step 5 — Build the model: Build the model and set the number
of periods to forecast to N (depends on your needs).
STEPS FOR BUILDING ARIMA MODEL:

Step 6 — Validate model: Compare the predicted values to the


actuals in the validation sample.
WHAT IS ARIMA MODEL:

• AR: Autoregression. A model that uses the dependent


relationship between an observation and some number of
lagged observations.
• I: Integrated. The use of differencing of raw observations (e.g.
subtracting an observation from an observation at the
previous time step) in order to make the time series
stationary.
• MA: Moving Average. A model that uses the dependency
between an observation and a residual error from a moving
average model applied to lagged observations.
AUTOREGRESSION:
MOVING AVERAGE
ARMA
ARIMA
VARIABLES IN ARIMA MODEL:

• Here, p, d and q are integers greater than or equal to zero and


refer to the order of the autoregressive, integrated, and
moving average parts of the model respectively.

• The integer d controls the level of differencing. Generally d=1


is enough in most cases. When d=0, then it reduces to an
ARMA(p,q) model.

• An ARIMA(p,0,0) is nothing but the AR(p) model and


ARIMA(0,0,q) is the MA(q) model.
VARIABLES IN ARIMA MODEL:

• P = Periods to lag for eg: (if P= 3 then we will use the three
previous periods of our time series in the autoregressive
portion of the calculation) P helps adjust the line that is being
fitted to forecast the series
• D = Differencing is a method of transforming a non-stationary
time series into a stationary one. This is an important step in
preparing data to be used in an ARIMA model.
• Q = This variable denotes the lag of the error component,
where error component is a part of the time series not
explained by trend or seasonality
AUTOCORRELATION FUNCTION PLOT:

• Autocorrelation refers to how correlated a time series is with


its past values whereas the ACF is the plot used to see the
correlation between the points, up to and including the lag
unit. In ACF, the correlation coefficient is in the x-axis whereas
the number of lags is shown in the y-axis.
AUTOCORRELATION FUNCTION PLOT:

• Normally in an ARIMA model, we make use of either the AR


term or the MA term. We use both of these terms only on rare
occasions. We use the ACF plot to decide which one of these
terms we would use for our time series
• If there is a Positive autocorrelation at lag 1 then we use
the AR model
• If there is a Negative autocorrelation at lag 1 then we use
the MA model
PARTIAL AUTOCORRELATION FUNCTION
PLOT:

• A partial autocorrelation is a summary of the relationship


between an observation in a time series with observations at
prior time steps with the relationships of intervening
observations removed.
• If the PACF plot drops off at lag n, then use an AR(n)
model and if the drop in PACF is more gradual then we
use the MA term
EXPONENTIAL SMOOTHING

• Exponential smoothing is a time series forecasting method


for univariate data that can be extended to support data with
a systematic trend or seasonal component.
• It is a powerful forecasting method that may be used as an
alternative to the popular Box-Jenkins ARIMA family of
methods.
EXPONENTIAL SMOOTHING

• Time series methods like the Box-Jenkins ARIMA family of


methods develop a model where the prediction is a
weighted linear sum of recent past observations or lags.
• Exponential smoothing forecasting methods are similar in
that a prediction is a weighted sum of past observations, but
the model explicitly uses an exponentially decreasing weight
for past observations. Specifically, past observations are
weighted with a geometrically decreasing ratio.
SINGLE EXPONENTIAL SMOOTHING

• Exponential smoothing methods may be considered as peers


and an alternative to the popular Box-Jenkins ARIMA class of
methods for time series forecasting.
• Alpha parameter controls the rate at which the influence of
the observations at prior time steps decay exponentially.
Alpha is often set to a value between 0 and 1. Large values
mean that the model pays attention mainly to the most recent
past observations, whereas smaller values mean more of the
history is taken into account when making a prediction.
DOUBLE EXPONENTIAL SMOOTHING

• In addition to the alpha parameter for controlling smoothing


factor for the level, an additional smoothing factor is added
to control the decay of the influence of the change in trend
called beta (b).
• Double Exponential Smoothing with an additive trend is
classically referred to as Holt’s linear trend model, named
for the developer of the method Charles Holt.
TRIPLE EXPONENTIAL SMOOTHING

• Triple Exponential Smoothing is an extension of Exponential


Smoothing that explicitly adds support for seasonality to the
univariate time series.
• This method is sometimes called Holt-Winters Exponential
Smoothing, named for two contributors to the method:
Charles Holt and Peter Winters.
• In addition to the alpha and beta smoothing factors, a new
parameter is added called gamma (g) that controls the
influence on the seasonal component.
TRIPLE EXPONENTIAL SMOOTHING

• Being an adaptive method, Holt-Winter’s exponential


smoothing allows the level, trend and seasonality patterns to
change over time.

You might also like