Election Prediction Based on Messages Feature Analysis in Twitter Social Network

Document Type : Original Article


1 Department of Computer Engineering and IT, Payame Noor University, Tehran, Iran

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


With the emergence of virtual social networks, predicting social events such as elections using social network data has attracted the attention of researchers. In this paper, three indicators for election prediction have been proposed. First, the tweets are grouped based on a specific time window. Next, the indicator values for each candidate in each time window are calculated based on the sentiment scores and re-tweet numbers. In fact, the indicators are calculated based on the ratio of features related to positive to negative sentiments. Finally, using the aging estimation method, the indicator values for each party on the election date are predicted. The party with larger predicted indicator values will be considered as the winner. Investigations into Twitter data related to 2016 and 2020 US presidential elections on a four-month time span indicate that the indicator values and elections can be predicted with a high accuracy.


Main Subjects

  1. Jennings, W. and Wlezien, C., "Election polling errors across time and space", Nature Human Behaviour, Vol. 2, No. 4, (2018), 276-283. https://doi.org/10.1038/s41562-018-0315-6
  2. Antonakaki, D., Fragopoulou, P. and Ioannidis, S., "A survey of twitter research: Data model, graph structure, sentiment analysis and attacks", Expert Systems with Applications, Vol. 164, No., (2021), 114006. https://doi.org/10.1016/j.eswa.2020.114006
  3. Yavari, A., Hassanpour, H., Rahimpour Cami, B. and Mahdavi, M., "Event prediction in social network through twitter messages analysis", Social Network Analysis and Mining, Vol. 12, No. 1, (2022), 78. https://doi.org/10.1007/s13278-022-00911-x
  4. Erfanian, P.Y., Cami, B.R. and Hassanpour, H., "An evolutionary event detection model using the matrix decomposition oriented dirichlet process", Expert Systems with Applications, Vol. 189, (2022), 116086. https://doi.org/10.1016/j.eswa.2021.116086
  5. Yavari, A., Hassanpour, H., Rahimpour Cami, B. and Mahdavi, M., "Election prediction based on sentiment analysis using twitter data", International Journal of Engineering, Transactions B: Applications,, Vol. 35, No. 2, (2022), 372-379. doi: 10.5829/IJE.2022.35.02B.13.
  6. Zhou, Z., Serafino, M., Cohan, L., Caldarelli, G. and Makse, H.A., "Why polls fail to predict elections", Journal of Big Data, Vol. 8, No. 1, (2021), 1-28.
  7. Wang, J. and Yang, Y., "Tweet retweet prediction based on deep multitask learning", Neural Processing Letters, (2022), 1-14. doi: 10.1007/s11063-021-10642-3.
  8. Chauhan, P., Sharma, N. and Sikka, G., "The emergence of social media data and sentiment analysis in election prediction", Journal of Ambient Intelligence and Humanized Computing, Vol. 12, (2021), 2601-2627. https://doi.org/10.1007/s12652-020-02423-y,(2021)
  9. Ceron, A., Curini, L. and 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.
  10. Burnap, P., Gibson, R., Sloan, L., Southern, R. and 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.
  11. Thelwall, M., Buckley, K., Paltoglou, G., Cai, D. and 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: 10.1002/asi.21416
  12. Oueslati, O., Hajhmida, M.B., Ounelli, H. and Cambria, E., "Sentiment analysis of influential messages for political election forecasting", in Computational Linguistics and Intelligent Text Processing: 20th International Conference, CICLing 2019, La Rochelle, France, April 7–13, 2019, Revised Selected Papers, Part II, Springer., (2023), 280-292.
  13. Singh, P., Dwivedi, Y.K., Kahlon, K.S., Pathania, A. and Sawhney, R.S., "Can twitter analytics predict election outcome? An insight from 2017 punjab assembly elections", Government Information Quarterly, Vol. 37, No. 2, (2020), 101444. doi: 10.1016/j.giq.2019.101444.
  14. Wang, L. and Gan, J.Q., "Prediction of the 2017 french election based on twitter data analysis", in 2017 9th Computer Science and Electronic Engineering (CEEC), IEEE., (2017), 89-93.
  15. Wicaksono, A.J., "A proposed method for predicting us presidential election by analyzing sentiment in social media", in 2016 2nd international conference on science in information technology (ICSITech), IEEE., (2016), 276-280.
  16. Firdaus, S.N., Ding, C. and Sadeghian, A., "Retweet prediction based on topic, emotion and personality", Online Social Networks and Media, Vol. 25, (2021), 100165. https://doi.org/10.1016/j.osnem.2021.100165
  17. Abraham, S. and Greg, G., Operating system concepts essentials.-2nd. 2014, Wiley.
  18. Sabuncu, İ., "USA nov. 2020 election 20 mil", Tweets (With Sentiment And Party Name Labels) Dataset, Vol. 20, (2020). doi: 10.21227/25te-j338.
  19. Hutto, C. and Gilbert, E., "Vader: A parsimonious rule-based model for sentiment analysis of social media text", in Proceedings of the international AAAI conference on web and social media. Vol. 8, (2014), 216-225.