Skip to content

Latest commit

 

History

20 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

NSE Volatility Modeling with AR-GARCH

Overview

This project analyzes the volatility dynamics of selected Nairobi Securities Exchange (NSE) stocks using time series econometric techniques. Specifically, it models the returns of Equity Group using an AR(1)-GARCH(1,1) framework to capture both mean dynamics and time-varying volatility.

The workflow covers data extraction, preprocessing, exploratory analysis, volatility modeling, and diagnostic validation.


Objectives

  • Transform raw stock price data into a structured time series dataset
  • Compute and analyze log returns
  • Test for volatility clustering using ARCH effects
  • Fit a GARCH model to capture time-varying volatility
  • Perform residual diagnostics to validate model adequacy

Dataset

  • Source: AIB-AXYS Daily Market Watch PDFs
  • Frequency: Daily
  • Stocks analyzed:
    • Safaricom
    • Equity Group
    • KCB Group

Due to inconsistencies in PDF formatting in earlier months, the analysis focuses on data from August 21, 2025 onwards, where extraction was reliable and consistent.


Methodology

Data Preprocessing

A structured data pipeline was implemented to convert unstructured PDF reports into a clean, model-ready dataset.

1. PDF Extraction

  • Used pdfplumber to extract text from the Market Scorecard section of each report
  • Focused specifically on the "Current Price" column
  • Extracted data for:
    • Safaricom
    • Equity Group
    • KCB Group

2. File Standardization

  • Renamed all PDF files to snake_case for consistency and reliable date extraction

3. Data Preparation

  • Cleaned and structured data into a tabular format
  • Converted prices into time series indexed by date
  • Computed log returns to:
    • stabilizes variance
    • ensures stationarity
    • makes data suitable for GARCH modeling

4. Exploratory Analysis

Log Returns

  • Log returns fluctuate around zero → stationary behavior
  • Visual inspection revealed volatility clustering

5. ARCH Test

An ARCH test was conducted to determine whether volatility clustering exists.

  • Equity: Significant ARCH effects (p < 0.05)
  • Safaricom & KCB: No significant ARCH effects

GARCH modeling was therefore applied only to Equity.


6. Model Specification

Initial model:

  • Constant Mean + GARCH(1,1)

Issue:

  • Residual autocorrelation detected (Ljung-Box test)

Solution:

  • Introduced AR(1) term

Final model: AR(1) - GARCH(1,1)


Future Improvements

  • Extend analysis to longer time horizons
  • Explore higher-order GARCH models (e.g., GARCH(2,1))
  • Compare with EGARCH or TGARCH models
  • Incorporate macroeconomic variables

Author: Nazra JN

About

This project demonstrates a complete volatility modelling pipeline, including data engineering, statistical testing, model specification, and diagnostic validation, reflecting real-world financial time series analysis.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages