Module 4_ Time Series Analysis
Module 4_ Time Series Analysis
Smoothing
Smoothing techniques aim to reduce noise in time series data, making it easier to
identify underlying trends and patterns.
● Moving Averages:
○ Simple Moving Average (SMA): This technique calculates the average of a
specified number of past observations. For example, if you have monthly
sales data, a 3-month SMA for January would be the average of sales in
November, December, and January.
■ Example: If sales for November, December, and January are 100,
120, and 140, respectively, the 3-month SMA for January would be:
● Exponential Moving Average (EMA): This method gives more weight to recent
observations, making it more responsive to changes.
○ Example: Using a smoothing factor (α) of 0.2, if the previous EMA was
120, the current value is 140:
● Exponential Smoothing: This method allows for forecasting future values based
on past observations, adjusting for trends and seasonality.
○ Example: If you have a sales series with a recent trend, you can apply
Holt’s linear trend method to forecast future sales by considering both the
level and the trend.
Extrapolation
Linear Extrapolation: This method fits a straight line to historical data and extends it to
predict future values.
Seasonal Adjustment
Seasonal adjustment is the process of removing seasonal effects from time series data,
allowing for a clearer view of underlying trends and cycles.
Common Methods:
● X-12-ARIMA: This method adjusts for seasonality by decomposing the time
series into seasonal, trend, and irregular components. It is widely used in
economic data.
○ Example: Monthly retail sales data may show a consistent increase in
December due to holiday shopping. X-12-ARIMA adjusts for this seasonal
effect to reveal the underlying trend.
● STL (Seasonal and Trend decomposition using Loess): This method decomposes
a time series into seasonal, trend, and remainder components using local
regression.
○ Example: If you have monthly temperature data, STL can help separate the
seasonal variations (e.g., higher temperatures in summer) from the overall
trend (e.g., increasing average temperatures over decades).
Understanding the properties of stochastic time series is essential for modeling and
forecasting.
Stationarity
● A stationary time series has constant mean and variance over time.
Non-stationary series often need to be transformed (e.g., differencing) to achieve
stationarity.
○ Example: A time series of stock prices is often non-stationary due to
trends. Differencing the data (subtracting the previous observation from
the current one) can help achieve stationarity.
Random Walk
● A random walk is a non-stationary process where the current value is a random
step from the previous value. It implies that future values cannot be predicted
based on past values.
○ Example: Stock prices often follow a random walk, where today's price is
influenced by yesterday's price plus a random shock.
● When two or more non-stationary series move together over time, they are said to
be cointegrated, indicating a long-term equilibrium relationship.
○ Example: The prices of two related stocks may drift apart in the short term
but tend to revert to a long-term relationship, indicating cointegration.
Linear time series models are foundational for analyzing time series data.
● These models express the current value as a function of past error terms.
○ Example: An MA(1) model uses the previous period's error to predict the
current value:
● These models express the current value as a function of its past values.
○ Example: An AR(1) model predicts the current value based on its previous
value:
Mixed Autoregressive and Moving Average (ARMA) Models
● ARIMA models are used for non-stationary time series that can be made
stationary through differencing. The model is characterized by three parameters:
(p, d, q).
○ Example: An ARIMA(1,1,1) model indicates one autoregressive term, one
differencing operation, and one moving average term.
Box-Jenkins Methodology
● This involves determining the appropriate values of p, d, and q based on the data
characteristics.
○ Example: If the ACF shows a cutoff after lag 2, you might choose p=2. If
the series is non-stationary, d might be 1.
● Incorporates external variables into the ARMA framework, allowing for the
modeling of relationships with other time series.
○ Example: If you are modeling sales based on past sales data and
advertising spend, the ARMAX model would include both the AR and MA
components along with the advertising variable.