Inflation & Media Sentiment in Egypt

This project provides interactive, visual, and accessible explanations of inflation's impact on everyday life and, alternatively, people's impact on inflation. In parallel, the project is geared towards those with an economics background by visualizing my undergraduate dissertation findings on the role of media in affecting consumer behavior and inflationary outcomes. Finally, the project automates these findings through an inflation forecasting system that scrapes and analyzes media sentiment across Egypt and provides forecasts based on the preceding findings.

Project Banner

Image was shot by Riad Ghoneim for a project in London on Arab Identity

Egypt's Inflation: A Regional Comparison

</> View Code

The first section illustrates the aggressive value loss of real income for Egyptians over the past two decades. The opening visualization contrasts Egypt with similar North African economies—Algeria and Morocco—showing how Egypt has consistently experienced higher inflation, at its peak experiencing 32.6% more inflation than Morocco.

The data uses the International Monetary Fund's API, which I accessed through their API Guide. I chose the IMF over the World Bank due to its more frequent and timely inflation updates.

The Double Burden: Inflation & Devaluation

</> View Code

The second section illustrates the effects of inflation (green) and devaluation (yellow) on the weakening purchasing power of the Egyptian Pound. The top red visualization emphasizes the cumulative effect of both phenomena, highlighting the percentage loss of income and savings value each year. During the run-up, spike, and cooldown of the inflationary crises in 2017 and 2023, Egyptian households lost approximately 40-50% of their income and savings value annually.

The inflation and devaluation data utilize World Bank APIs; the value loss figure has been manually calculated and stored in egypt_value_loss_rate.csv.

Cumulative Erosion of Savings

</> View Code

To emphasize the loss of savings value for Egyptian households, this visualization illustrates cumulative income loss from 2010 to 2024, where Egyptian households lost 84% of their savings value in 14 years. In comparison, Morocco experienced only 24% value loss and Algeria 54%.

This data was manually calculated using World Bank inflation figures.

How Far Will Your Money Take You?

For a less economics-oriented explanation, I created an interactive section where users can adjust their income and inflation levels to visually observe variations in their real income. Highlighting this project's Egyptian heritage, the text above the toggle poses the question "How far will your money take you?" alongside an automated Egyptian taxi meter.

Purchasing Power

Taxi Meter Base
this will likely move out of place with different screen sizes
Arabic Text
Egypt Current: 12.3% Real Income 0 EGP
Nominal Income
Egypt Inflation
Real Income
50,000
EGP
25
Egypt: 12.3%
Project Banner

Image was shot by Riad Ghoneim in the Birqash Camel Market North of Cairo

Consumer Confidence & Inflation Expectations

</> View Code

The second section introduces the role of consumer behavior in perpetuating inflation in Egypt. The figures are based on calculations from my undergraduate dissertation. This section begins by visualizing the portion of inflation attributed to consumer behavior, emphasizing consumers' role in perpetuating inflation.

Media Sentiment Analysis

</> View Code

The following visualization captures media sentiment—a dominant driver of consumer confidence. To track media sentiment, I scrape three Egyptian news outlets daily for economy-related articles. I use CAMeL-BERT and FinBERT for Arabic and English sentiment analysis, amassing over 2,500 data points in the past two months. The scraper runs every morning using GitHub Actions and remains within GitHub Actions' free tier. This code can be replicated on any Arabic or English economics news websites without CloudFlare protection.

Replication tip: Use websites with dedicated economics sections to ease scraping complexity and reduce runtime. View the scraper code and raw data.

Finally, using media as a proxy for consumer behavior (with a weighting of 20% at different lag points), I create an inflation forecasting tool. I use real-time media sentiment data to predict inflation up to six months ahead. The model uses empirically-derived structures from an 8-year, 400,000 data-point study to predict media and consumer impact on inflation.

The main challenge was finding data on Egyptian media sentiment. After resorting to scraping, bypassing CloudFlare was the primary obstacle. I used Claude AI to test a compiled list of websites rather than rewriting code for each attempt. The availability of sentiment analyzers such as CAMeL-BERT and FinBERT provided significant support in processing data. However, their variations in output created visualization challenges. Due to this, I plotted each language separately.

Conclusion

These visualizations create an accessible visual explanation of inflation's impact on Egyptians and, alternatively, Egyptians' impact on inflation. The project highlights the potential of interactive visual tools for explaining relevant economic phenomena and reinforces my dissertation's claim that as disinformation and misinformation rise, understanding media's role on consumers is paramount.

📄 View Dissertation View Full Project Repository →

References & Data Sources

International Monetary Fund (IMF). (2024). International Financial Statistics - Inflation Data. Retrieved from https://data.imf.org/

World Bank. (2024). World Development Indicators - Inflation (GDP Deflator), Exchange Rates, and Economic Indicators. Retrieved from https://api.worldbank.org/v2/

Ghoneim, R. (2024). The Role of Media Sentiment in Driving Consumer Confidence and Inflation Expectations: Evidence from Egypt. Undergraduate Dissertation, King's College London.

Egyptian News Sources. (2024-2025). Scraped economic sentiment data from Al-Ahram, Al-Masry Al-Youm, and Daily News Egypt. Analyzed using CAMeL-BERT and FinBERT models.