Time Series Analysis

 

What is Time Series Analysis?

Time Series Analysis is a statistical technique that involves analyzing data collected over time to uncover patterns, trends, and insights.

  • The data points are ordered in chronological order (e.g., daily, monthly, yearly).

  • It is used for forecasting, trend analysis, seasonality detection, and more.


๐Ÿ“Œ Key Components of Time Series

  1. Trend
    Long-term increase or decrease in the data.
    ๐Ÿ” Example: A company’s revenue increasing steadily over years.

  2. Seasonality
    Repeating short-term cycle based on the time of year.
    ๐Ÿ” Example: Ice cream sales peaking every summer.

  3. Cyclic Patterns
    Long-term fluctuations not fixed in time, often tied to economic cycles.
    ๐Ÿ” Example: Business cycles, stock market ups and downs.

  4. Irregular or Random Component
    Unpredictable and random variations.
    ๐Ÿ” Example: Sudden stock market crash or natural disasters.


Example: Monthly Sales Data

MonthSales 
Jan2000
Feb2200
Mar2500
Apr2400
May3000
Jun3500
Jul3700
Aug3400
Sep3100
Oct3300
Nov3600
Dec4000

From the data above:
  • Trend: Sales are gradually increasing.

  • Seasonality: Sales peak in December.

  • Randomness: Slight dip in April despite general upward trend.


Methods of Time Series Analysis

1. Visualization

Plotting data over time to observe trends and seasonality.

2. Moving Averages

Smoothens short-term fluctuations and highlights trends.

MAt=yt1+yt+yt+13\text{MA}_t = \frac{y_{t-1} + y_t + y_{t+1}}{3}

3. Decomposition

Splits time series into:

  • Trend

  • Seasonal

  • Residual components

4. Exponential Smoothing

Weighted average of past observations; recent observations get more weight.

5. ARIMA (AutoRegressive Integrated Moving Average)

A powerful model for forecasting future values.


๐Ÿ“Š Example Use Cases

DomainUse Case
Business        Forecasting product sales or revenue
Finance        Stock price prediction
Meteorology        Weather forecasting
Healthcare        Monitoring patient vitals over time
Energy        Predicting electricity demand

๐Ÿ“˜ What is ARIMA?

ARIMA is a time series forecasting model used to describe and predict future points in a time series.

The acronym ARIMA stands for:

ComponentMeaning
ARAutoRegressive part (uses past values)
IIntegrated part (makes series stationary by differencing)
MAMoving Average part (uses past errors)

๐Ÿ“Œ When to Use ARIMA?

  • When the time series data is non-seasonal.

  • When there is a clear trend but not a clear seasonal pattern.

  • When you want to forecast future values based on past patterns.


๐Ÿ”ข The ARIMA Model Notation

ARIMA is defined as:

ARIMA(p,d,q)\text{ARIMA}(p, d, q)

Where:

  • pp: number of autoregressive (AR) terms

  • dd: number of differences to make the series stationary

  • qq: number of moving average (MA) terms


๐Ÿ“Œ Components Explained

1. Autoregressive (AR)p

  • Model that uses past values to predict the current value.

  • Example:

    yt=c+ฯ•1yt1+ฯ•2yt2++ฮตty_t = c + \phi_1 y_{t-1} + \phi_2 y_{t-2} + \dots + \varepsilon_t

2. Integrated (I)d

  • Refers to the differencing of raw observations to make the time series stationary.

  • A stationary series has constant mean, variance, and autocorrelation over time.

Example of first-order differencing:

yt=ytyt1y'_t = y_t - y_{t-1}

3. Moving Average (MA)q

  • Uses past forecast errors to predict future values.

  • Example:

    yt=c+ฮธ1ฮตt1+ฮธ2ฮตt2++ฮตty_t = c + \theta_1 \varepsilon_{t-1} + \theta_2 \varepsilon_{t-2} + \dots + \varepsilon_t

๐Ÿ“ˆ Step-by-Step ARIMA Modeling (Workflow)

Step 1: Visualize the data

  • Plot the time series

  • Check for trend and stationarity

Step 2: Make data stationary

  • Use differencing to remove trends (choose d)

  • Use the ADF test (Augmented Dickey-Fuller) to confirm stationarity

Step 3: Identify p and q

  • Use ACF (Autocorrelation Function) for q

  • Use PACF (Partial ACF) for p

Step 4: Fit ARIMA model

  • Try different values for (p,d,q)

  • Use tools like AIC or BIC for model selection

Step 5: Forecast

  • Predict future values and plot results

Comments

Popular posts from this blog

Statistical Methods Lab ( R Language) PCCBL308 Semester 3 KTU BTech CB 2024 Scheme - Dr Binu V P

Statistical Methods Lab ( R Language) PCCBL308 Course Details and Syllabus

t -test