An examination of the Twitter habits of Kentucky lawmakers

Jan 24, 2018 at 11:26 am
Twitter habits of Kentucky lawmakers

Politicians, by nature, care about being popular. It’s how they get elected!

And, as we now know all too well, Twitter has become a wildly popular medium for some politicians to get their message to constituents. As such, I think politicians use Twitter at a rate disproportionate to the population as a whole because the app puts metrics around popularity, or followers — which, by nature, is a measure of how well they are doing their jobs. (I recently cracked 1,000, and I was embarrassed about how excited I was).

Of lawmakers who tweet, state Rep. Brandon Reed, R-Hodgenville, was the legislator with the most followers at the time this was written. Rep. Attica Scott, D-Louisville, was second. Both are freshmen legislators. (Among the legislature’s 138 members, 105 tweet.)

Using a mean, Republicans have a larger average following, 1,449 to 1,346. However, Democrats have the advantage when we use median to judge the average, 1120 to 985. (The mean is what you learned as average in school: add all your values, and then divide by the count of values. Median is a different way to measure central tendency — arrange all your numbers in order, and then pick the one in the middle.) Since the mean number of followers is greater for GOP members, and the median is greater for Democratic legislators, this indicates that there were a small number of GOP members with a lot of followers, while most of the members had fewer followers than Democrats.

Now, let’s take a look at who is on #TeamFollowBack:

Reed was definitely not on #TeamFollowBack, as he followed only 253 accounts, 97 percent fewer than the number who followed him. However, it was pretty clear that Democratic women are good listeners — out of the six Democrats who followed the most accounts, five were women. Also, Sen. Julia Raque Adams was the only Republican woman in the top 10 of her caucus, using that metric. (There are 10 Republican women in the House, and nine Democrats there. The Senate has two women from each party.)

The Number Of Followers Each Member Has, By Party
The Number Of Followers Each Member Has, By Party

Heavy Users

The Twitter API gave us all the tweets from an account, including retweets. I thought it would be interesting to look at who used Twitter the most — both by writing their own tweets, and by retweeting others.

Scott and Sen. Whitney Westerfield, R-Hopkinsville, were the heaviest users of Twitter overall, with 2,584 and 2,265 tweets between Jan. 1, 2017 and when this piece was written, Aug. 31, respectively. However, when looking at original content only, Rep. Jason Nemes, R-Louisville, and Sen. Reggie Thomas, D-Lexington, were among the heavier users. These four legislators were the only members who had sent more than 750 original tweets in that time period.

The story of retweets is similar to the story about the number of accounts followed: Three Democratic women lead their caucus.

That said, it was tough to find the average number of tweets per user because so many are robots who tweet thousands of times per day, and others who are people who created an account and then never used it again. Over the past 28 days, for example, I tweeted 15.2 times a day. By comparison, Donald Trump sent out an average of nine tweets a day over the past 30 days, according to Barack Obama posted none during that period.

Tweets Per Legislator, By Party
Tweets Per Legislator, By Party

The average by party

While Democrats and Republicans had about the same amount of retweets per legislator (total number of retweets per number of caucus members on Twitter), Democrats sent significantly more original tweets.

The Twitter API gives us access to the exact moment each tweet was sent.

That’s fun.

Let’s take a look at the tweets over time using density plots, and then a density plot of the time of day when each tweet was sent:

The 2017 legislative session kicked off in January, and then, after organizing, took a break for about a month. Then, lawmakers were back in session until March. This was reflected clearly in this data. Tweets are on the rise again, though! It might be about national politics, or the calls for a special session about pensions and tax reform.

Legislators stay up late!

The most common time at which tweets were sent was after midnight. Not until about 2:30 a.m. does the tweeting stop! Y’all need to go to bed. Nothing good ever happened to an elected official after the bars close.

This begged to be analyzed by party:

It looked like the peaks and valleys around the legislative session were more pronounced among Democrats. Democrats also seemed to have had a significant bump in tweets during the early summer.

Regarding time of day: It looked like Republicans were the culprits when it came to who stays up late. Democrats definitely were up late as well, but the most common time for Dems to tweet was around noon. The GOP peaked about 1 a.m.

Tweets By Time Of Day, By Party
Tweets By Time Of Day, By Party

What tweets may mean

Sentiment analysis is a process by which individual words are associated with specific sentiments. To do this, data analysts use lexicons. Lexicons used in sentiment analysis identify words that are inherently positive and negative. These lexicons are the word of researchers (typically in linguistics) who have done the association. Sentiment analysis allows us to gauge the overall feelings in a piece of writing or group of statements. By performing this type of analysis, we gain insight into the mood of the writer/speaker/commenter.

This work is inherently problematic.

Please know while you read this, don’t form your full opinion about these legislators using sentiment analysis. However, I think this kind of work is useful. Let’s first take a look at the sentiment by legislator using the Bing lexicon. The Bing lexicon was developed by Bing Liu (et al) and is a very straightforward positive-negative lexicon. It includes 6,788 words.

Bing Pops, Per Legislator, By Party
Bing Pops, Per Legislator, By Party

I used the incredible tidytext package to do this analysis. I pulled each word out of all the tweets, and scaled them using the Bing lexicon. Then, I scaled by the number of tweets. We’ve already done enough analysis on who tweeted the most: This shows us on average, which legislators use the most positive and negative words. The lollipops above 0 represent the usage rate of positive words, while the lollipops below 0 represent the usage rate of negative words.

This graph is arranged by net sentiment: positive words minus negative words. You can see that Rep. Dennis Horlander and Rep. Mary Lou Marzian, both Louisville Democrats, had a fairly high usage rate of positive words, but were among the most negative Democratic tweeters because of their high rates of negative words.

Meanwhile, Reed, the legislator with the most followers, was the most positive Republican. This might help to explain how he has so many followers despite not making that many actual tweets.

Scaled Sentiment, By Party
Scaled Sentiment, By Party

A look by party

Republicans were more emotive than Democrats, at least according to Bing, et al. The GOP had a higher usage rate of negative words and positive words. While the GOP lawmakers were only slightly less negative than are Democrats, their usage rate of positive words was double that of the Democrats.

“Positive” and “negative” are straightforward, but they aren’t very descriptive. The other lexicon I used is the NRC Emotion Lexicon. In addition to positive and negative sentiments, this lexicon adds eight emotions, which adds a level of specificity into the analysis. The NRC lexicon includes 13,301 entries, much more than Bing uses. For instance, “legislator” and “legislature” are associated with trust, while “police” is associated with trust, positive and fear. “Politics” is tied to anger, and “reporter,” trust and positive (imagine that).

The best way to view this is in a tree map:

It looks like the emotions most likely to be expressed by Kentucky legislators were “positive” and “anticipation.” I think it’s good to have forward looking legislators! It also appears that emotions that tile toward “positive” such as “trust” and “joy” outnumber those that tilt negative, like “fear” and “disgust.”

Tree Plot
Tree Plot

DIY digging

If you’d like to dig deeper, check out this shiny app I built ( You can drill down to view the Twitter behavior of individual legislators!

I hope they don’t get too mad at me — I’ll take it down if they promise to raise taxes on cigarettes and expand the sales tax to luxury services. •

You can reach Robert Kahne at [email protected], or on Twitter: @rkahne.


The Kentucky Legislative Research Commission director, David Byerman, manages a list of all the Kentucky legislators who use the twitter application. When I was a student in the Code Louisville program, I registered a Twitter application that I never used. I repurposed that application to pull data from the twitter API about legislators’ tweets.

In order to grab the usernames of the legislators, I used the browser-based Twitter API console, and then used the R package rtweet to pull the timelines of the legislators. For this exercise, I grabbed only the tweets from Jan. 1, 2017 (the 2017 legislative session started shortly after that). I pulled the public data about the legislators accounts on Aug. 20, 2017, and last refreshed the timelines of the legislators around 10 p.m. on Aug. 30, 2017.