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.
- 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
- 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.
A structured data pipeline was implemented to convert unstructured PDF reports into a clean, model-ready dataset.
- Used
pdfplumberto 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
- Renamed all PDF files to snake_case for consistency and reliable date extraction
- 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
- Log returns fluctuate around zero → stationary behavior
- Visual inspection revealed volatility clustering
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.
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)
- 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
