University of East London
Analyzing Twitter/X Sentiment and Topic Signals for the 2024 UK General Election: Measurement and Forecasting under the First-Past-The-Post System
Abstract
dc:descriptionSocial media platforms have become an increasingly important source of large-scale public discourse, offering researchers new opportunities to measure political attitudes and preferences in near real time. Among these platforms, Twitter (now X) provides a particularly rich and temporally dense stream of user-generated content, making it a valuable resource for studying political communication and electoral dynamics. As a result, social media data has attracted growing academic interest as a potential tool for measuring public opinion and forecasting election outcomes.This thesis investigates the effectiveness of social media signals in measuring and predicting electoral outcomes, using the 2024 United Kingdom General Election as a case study. Twitter/X data were collected between 1 March and 4 July 2024 to capture online political discourse throughout the election campaign period. A dataprocessing pipeline was developed to generate two key social media indicators; sentiment classifications and issue-salience signals derived from topic modelling. Because social media data are prone to sampling bias and methodological pitfalls, the study also emphasizes careful analytical design to avoid the limitations that have affected earlier approaches to social media-based election prediction.Several machine learning and deep learning models were evaluated for sentiment classification, including a TF– IDF logistic regression baseline, a Convolutional Neural Network (CNN), and transformer-based architectures such as RoBERTa and BERTweet. In addition, an ensemble combining the transformer models was implemented. The results show that the ensemble approach achieved the highest performance in three-class sentiment classification, reaching approximately 80% accuracy and weighted F1-score, outperforming both traditional machine learning baselines (approximately 49–52%) and individual transformer models (approximately 74%).To complement sentiment analysis, topic modelling techniques including Latent Dirichlet Allocation (LDA) and BERTopic were applied to identify the main political issues discussed on Twitter/X during the campaign. These models successfully extracted prominent themes consistent with the broader political agenda, including the National Health Service (NHS), the cost-of-living crisis, climate policy, immigration, and education. Further statistical analysis using a two-way ANOVA revealed significant interactions between political parties and sentiment; however, the effect sizes were very small (η² ≪ 0.01), suggesting that sentiment signals alone explain only a limited proportion of variance in electoral outcomes under the United Kingdom’s first-past-the-post (FPTP) electoral system.When sentiment indices were directly translated into forecasts of national vote shares or parliamentary seat counts, the resulting predictions diverged substantially from the actual election outcome. Most notably, the model significantly under-predicted the landslide victory of the Labour Party, which ultimately secured 411 seats compared to approximately 165 predicted by the social media-based model. This discrepancy highlights structural limitations in the pipeline, including the absence of demographic post-stratification methods such as Multilevel Regression and Post-stratification (MRP), the lack of geographic and constituency-level variables, and the omission of a seat-conversion model tailored to the mechanics of the FPTP electoral system.The primary contribution of this thesis is therefore twofold. First, it establishes a robust measurement framework for extracting sentiment and issue salience from social media data using validated machine learning and topic modelling techniques. Second, it proposes a diagnostic framework that links social media signals to electoral variables and systematically evaluates the conditions under which social media sentiment fails to translate into electoral outcomes. By combining predictive modelling with detailed error analysis, this study provides important insights into both the potential and the limitations of using social media data for election measurement and forecasting.
Author and committee
dc:creator, dc:contributor.*- Author dc:creator
-
- Dennis, Everton George
Rights
dc:rights- Statement dc:rights
-
- openAccess
- Language dc:language
- English