This project investigates how sentiment influences engagement in political social media content. Specifically, we analyze whether negative sentiment leads to higher engagement in posts by Donald Trump, and whether this relationship changed after 2021. Using a combination of sentiment analysis, feature engineering, and regression modeling, we compare:
- Pre-2021 Twitter posts
- Post-2021 social media posts
Our findings show that negative sentiment is strongly associated with higher engagement, and that this relationship shifted significantly after 2021.
- Does sentiment polarity predict engagement (likes & retweets)?
- Did the relationship between sentiment and engagement change after 2021?
We combine two datasets:
- Twitter data (pre-2021)
- Post-2021 social media data
Each observation includes:
Post textFavorites (likes)RetweetsTimestampRetweet indicator
To ensure comparability across platforms, engagement metrics were standardized using z-scores
We used a lexicon-based approach (AFINN) to compute sentiment scores. Improvements:
- Baseline accuracy: 63.5%
- Extended lexicon accuracy: 65%
- Improved negative sentiment detection by ~5%
Common Negative Words
Examples: "fake”, “bad”, “crime”, “crooked”, “illegal”, “radical”
Key Insights:
- Most posts are neutral or mildly emotional.
- Negative posts receive higher engagement.
- Neutral & positive posts show lower, similar engagement.
- Boxplots show higher median engagement for negative sentiment.
We fit multivariable linear regression models:

- 𝑌𝑖: relative engagement (favorites or retweets)
- 𝑋𝑖: control variables (length, capitalization, etc.)
Models:
- Model 1: Sentiment → Engagement
- Model 2: Sentiment × Period interaction
- Negative sentiment significantly increases engagement.
- Sentiment is a strong predictor of both likes and retweets.
- Stylistic features (e.g., exclamation marks, emphasis) also matter.
- Lexicon-based sentiment may miss sarcasm and context-specific meaning.
- High engagement may reflect controversy, not agreement.