Election Prediction Based on Sentiment Analysis using Twitter Data

Document Type : Original Article


1 Faculty of Computer Engineering and IT, Shahrood University of Technology, Shahrood, Iran

2 Faculty of Computer and IT Engineering, Mazandaran University of Science and Technology, Babol, Iran

3 Sydney International School of Technology and Commerce, Sydney, Australia


Election prediction has always been of interest to many people. In the last decade, an increasing influence of social networks and the possibility of sharing opinions and ideas has rendered election prediction based on social network data analysis. This paper, drawing on Twitter data and sentiment analysis, uses the proportion of positive messages rate to negative messages rate as an effective indicator for predicting elections. Then, using the aging estimation method, it predicts the values of this indicator in future time windows. The experiments conducted on Twitter data related to the 2020 United States presidential election in a four-month time window indicate that the indicator values and eventually the election results can be predicted with high accuracy.


Main Subjects

  1. Lewis-Beck, M. S., “Election forecasting: Principles and practice”, The British Journal of Politics and International Relations, Vol. 7, No. 2, (2005), 145-164. DOI: 10.1111/j.1467-856X.2005.00178.x.
  2. Salunkhe, P., Deshmukh, S., “Twitter based election prediction and analysis”, International Research Journal of Engineering and Technology, Vol. 4, No. 10, (2017), 539-544.
  3. Pak, A., Paroubek, P., "Twitter as a corpus for sentiment analysis and opinion mining", Language Resources and Evaluation, Vol. 10, (2010), 1320-1326.
  4. Wang, L., Gan, J. Q., “Prediction of the 2017 French election based on Twitter data analysis”, In 9th Computer Science and Electronic Engineering, (2017), 89-93. DOI: 1109/CEEC.2018.8674188.
  5. Kolasani, S. V., Assaf, R., “Predicting Stock Movement Using Sentiment Analysis of Twitter Feed with Neural Networks”, Journal of Data Analysis and Information Processing, Vol. 8, No. 4, (2020), 309-319. DOI: 4236/jdaip.2020.84018.
  6. Patel, R., Passi, K, “Sentiment Analysis on Twitter Data of World Cup Soccer Tournament Using Machine Learning”, Internet of Things, Vol. 1, No. 2, (2020). 218-239. DOI: 3390/iot1020014.
  7. Fu, X., Jiang, X., Qi, Y., Xu, M., Song, Y., Zhang, J., Wu, X., “An event-centric prediction system for COVID-19,” IEEE International Conference on Knowledge Graph, (2020), 195-202. DOI: 1109/ICBK50248.2020.00037
  8. Silberschatz, A., Galvin, P. B., Gagne, G, “Operating System Concepts (9 Ed.).” Wiley Publishing. 187. (2012). ISBN 978-0470128725.
  9. Tumasjan, A., Sprenger, T., Sandner, P., Welpe, I., “Predicting elections with twitter: What 140 characters reveal about political sentiment”, In Proceedings of the International AAAI Conference on Web and Social Media, Vol. 4, No. 1, (2010).
  10. Ceron, A., Curini, L., Iacus, S. M., “Using sentiment analysis to monitor electoral campaigns: Method matters—evidence from the United States and Italy”, Social Science Computer Review, Vol. 33, No. 1, (2015), 3-20, DOI: 10.1177/0894439314521983.
  11. Burnap, P., Gibson, R., Sloan, L., Southern, R., Williams, M., “140 characters to victory?: Using Twitter to predict the UK 2015 General Election”, Electoral Studies, Vol. 41, (2016), 230-233. DOI: 10.1016/j.electstud.2015.11.017.
  12. Thelwall, M., Buckley, K., Paltoglou, G., Cai, D., Kappas, A., “Sentiment strength detection in short informal text”, Journal of the American Society for Information Science and Technology, Vol. 61, No. 12, (2010), 2544-2558. DOI: 1002/asi.21416.
  13. Nugroho, D. K., "US presidential election 2020 prediction based on Twitter data using lexicon-based sentiment analysis" 11th International Conference on Cloud Computing, Data Science & Engineering (Confluence), (2021), 136-141. DOI: 10.1109/Confluence51648.2021.9377201.
  14. Xia, E., Yue, H., Liu, H. “Tweet Sentiment Analysis of the 2020 US Presidential Election”, In Companion Proceedings of the Web Conference 2021, (2021), 367-371. DOI: 10.1145/3442442.3452322.
  15. Sabuncu, I., Balci, M. A., Akguller, O., "Prediction of USA November 2020 Election Results Using Multifactor Twitter Data Analysis Method", arXiv:2010.15938, (2020).
  16. Baccianella, S., Esuli, A., Sebastiani, F., “Sentiwordnet 3.0: an enhanced lexical resource for sentiment analysis and opinion mining”, In Language Resources and Evaluation, Vol. 10, (2010), 2200-2204.
  17. Ibrahim, M., Abdillah, O., Wicaksono, A. F., Adriani, M., “Buzzer detection and sentiment analysis for predicting presidential election results in a twitter nation”, IEEE International Conference on Data Mining Workshop, (2015), 1348-1353. DOI: 1109/ICDMW.2015.113.
  18. Sharma, P., Moh, T. S., “Prediction of Indian election using sentiment analysis on Hindi Twitter.” IEEE International Conference on Big Data, (2016), 1966-1971. DOI: 1109/BigData.2016.7840818.
  19. Liu, R., Yao, X., Guo, C., Wei, X., “Can We Forecast Presidential Election Using Twitter Data? An Integrative Modelling Approach”, Annals of GIS, Vol. 27, No. 1, (2021), 43-56, DOI: 10.1080/19475683.2020.1829704.
  20. Sabuncu, I., “USA Nov.2020 Election 20 Mil. Tweets (with Sentiment and Party Name Labels) Dataset”, IEEE Dataport, (2020). DOI: 10.21227/25te-j338.
  21. Hutto, C.J. Gilbert, E.E., “VADER: A Parsimonious Rule-based Model for Sentiment Analysis of Social Media Text.” 8th International Conference on Weblogs and Social Media, (2014).
  22. Singh, P., Dwivedi, Y. K., Kahlon, K. S., Pathania, A., Sawhney, R. S., “Can twitter analytics predict election outcome? An insight from 2017 Punjab assembly elections.” Government Information Quarterly, Vol. 37, No. 2, (2020), DOI: 1016/j.giq.2019.101444.
  23. Wicaksono, A. J., “A proposed method for predicting US presidential election by analyzing sentiment in social media.” 2nd International. Conference on Science in Information Technology, (2016), 276-280. DOI: 10.1109/ICSITech.2016.7852647.