Is the second stimulus package really a good idea?

Risa Ryan
Social Media: Theories, Ethics, and Analytics
6 min readNov 17, 2020

The second stimulus package is a critical means to assist families and businesses suffering from the pandemic. It is intended to help out the small business owner and ensure that he or she can feed their families, pay their rent and pay their employees. It is also intended to help those furloughed or let go from their jobs. It will also provide funds over and above unemployment for those seeking employment. It is a very critical means for the government to help the vulnerable.

Unfortunately, the current stimulus (there was one in May already), is being held up because the Democrats and Republicans can’t agree on the scope. The Republicans want a big stimulus focused on those who need the help the most while the democrats are looking for broader assistance.

Given the latest signs that the economy is showing signs of recovery, the Republicans believe that a smaller package can get the country over the hump until the COVID-19 vaccine is ready for mass distribution.

The Democrats disagree and believe the vaccine won’t be effective at least mid 2021 and therefore more help is needed now.

Proposals from both sides have included another stimulus payment of up to $1,200 for individuals who meet the requirements, among topics like aid for airlines, enhanced unemployment insurance and extending the Paycheck Protection Program for businesses.

In order to get a sense for how this is playing out on Social Media, I evaluated the sentiment of the latest tweets on Twitter. I wanted to get a feel for what the public actually thinks, not what the politicians think. Very often the politicians don’t listen to the public. By analyzing the trending tweets, I was able to understand what the public has on their minds. It’s important because the media doesn’t always reflect the true sentiment of the people.

Using this code, I downloaded a set of tweets related to the hashtag #stimulus. I used Tweepy to do it. As you can see form the code I define a function called goget() which reads in a hashtag that the user is interested in. From those tweets I pull in ‘Name’, ‘ScreenName’, ‘TweetDate’, and ‘TweetContent’.

import numpy as np
from textblob import TextBlob
import sys,csv,re
from textblob import TextBlob
import matplotlib.pyplot as plt
import seaborn as sns
import tweepy
import pandas as pd
import osNoOfTerms = 1342
searchTerm = input(“Enter Keyword/Tag to search about: “)class SentimentAnalysis:def __init__(self):
self.tweets = []
self.tweetText = []def DownloadData(self):
# authenticating
consumerKey = ‘xxx’
consumerSecret = ‘xxx’
accessToken = ‘xxx’
accessTokenSecret = ‘xxx’
auth = tweepy.OAuthHandler(consumerKey, consumerSecret)
auth.set_access_token(accessToken, accessTokenSecret)
api = tweepy.API(auth)

# function to calculate percentage
def percentage(part,whole):
temp = 100 * float(part) / float(whole)
return format(temp, ‘.2f’)# creating some variables to store info
polarity = 0
positive = 0
wpositive = 0
spositive = 0
negative = 0
wnegative = 0
snegative = 0
neutral = 0for tweet in df[‘polarity’]:
#print(“Polarity is:”, tweet)
if tweet > 0.1:
wpositive += 1
elif (tweet > 0.2) & (tweet <= 0.3):
wpositive += 1
elif (tweet > 0.) & (tweet <= 0.6):
positive += 1
elif (tweet > 0.6) & (tweet <= 1):
spositive += 1
elif (tweet > -0.3) & (tweet <= 0):
wnegative += 1
elif (tweet > -0.6) & (tweet <= -0.3):
negative += 1
elif (tweet > -1) & (tweet <= -0.6):
snegative += 1


# finding average of how people are reacting
positive = percentage(positive, NoOfTerms)
wpositive = percentage(wpositive, NoOfTerms)
spositive = percentage(spositive, NoOfTerms)
negative = percentage(negative, NoOfTerms)
wnegative = percentage(wnegative, NoOfTerms)
snegative = percentage(snegative, NoOfTerms)
neutral = percentage(neutral, NoOfTerms)print()
print(“Detailed Report: “)
print(str(positive) + “% people thought it was positive”)
print(str(wpositive) + “% people thought it was weakly positive”)
print(str(spositive) + “% people thought it was strongly positive”)
print(str(negative) + “% people thought it was negative”)
print(str(wnegative) + “% people thought it was weakly negative”)
print(str(snegative) + “% people thought it was strongly negative”)
print(str(neutral) + “% people thought it was neutral”)sizes = [positive, wpositive, spositive, neutral, negative, wnegative, snegative]#create new df
df2 = pd.DataFrame({‘col’:sizes})
print (df2)def plotPieChart(positive, wpositive, spositive, negative, wnegative, snegative, neutral, searchTerm, NoOfTerms):
labels = [‘Positive [‘ + str(positive) + ‘%]’, ‘Weakly Positive [‘ + str(wpositive) + ‘%]’,’Strongly Positive [‘ + str(spositive) + ‘%]’, ‘Neutral [‘ + str(neutral) + ‘%]’,
‘Negative [‘ + str(negative) + ‘%]’, ‘Weakly Negative [‘ + str(wnegative) + ‘%]’, ‘Strongly Negative [‘ + str(snegative) + ‘%]’]
sizes = [positive, wpositive, spositive, neutral, negative, wnegative, snegative]
colors = [‘yellowgreen’,’lightgreen’,’darkgreen’, ‘gold’, ‘red’,’lightsalmon’,’darkred’]
patches, texts = plt.pie(sizes, colors=colors, startangle=90)
plt.legend(patches, labels,bbox_to_anchor=(1.25, 1))
plt.title(‘How people are reacting on ‘ + searchTerm + ‘ by analyzing ‘ + str(NoOfTerms) + ‘ Tweets.’)
plt.axis(‘equal’)
plt.tight_layout()
plt.show()# creating the bar plot#create new df
df2 = pd.DataFrame({‘col’:sizes},dtype=np.int8)
df2[‘col1’] = pd.to_numeric(df2[‘col’])
df2[‘category’]=[‘Strongly Negative ‘, ‘Negative ‘, ‘Weakly Negative ‘,’Neutral’,’Weakly Positive’,’Positive’, ‘Strongly Positive’ ]
df2.info()
ax = df2.plot.bar(y=’col1', x=’category’,rot=90,color = ‘r’,title=”How do people feel about the Stimulus”)
ax.legend([“Polarity %”])
ax.set(xlabel=”Sentiment”)
ax.set(ylabel=”Polarity”)

Once I have the dataset I need, I use TextBlob to create the polarity and subjectivity.

The sentiment polarity tells if the sentiment of a particular tweet is positive or negative. The subjectivity score indicates how subjective is the text. I then assign the tweet to a category based on the level of polarity. Additionally, I calculated the average polarity in each category.

Once I had this information, I created a bar chart showing the sentiment analysis. You can see this in Chart 1.

The results of the analysis were not really a surprise. It seems that most everyone is in favor or is supportive of another $1200 stimulus bill. As you can see in the chart. Table 1 shows the percentages associated with the analysis. For instance, 88% of the tweets fell in the region between Weakly Negative and Weakly positive. This to me suggests that there is no strong opposition. That being the case, the government should move beyond the impasse and pass the bill.

Using Gephi I then also developed a network showing who was tweeting about the stimulus.

What I found was incredibly interesting. It turns out that of the people tweeting about the second stimulus bill that I analyzed, about 3000 in total, the average degree was only .889. The user that had the highest degree TheReal DonaldTrump is shown in Chart 2. Among those in his network very few were actually politicians. This underscores what I found by analyzing the sentiment of the tweets and tells me that the general public, more so than the politicians are very interested in it. It seems that the public, much more so than the politicians, are engaged and supportive. So it should pass, now!

Chart 2 shows the largest network of the user with the highest degree, TheRealDonaldTrump. You notice in this network that the few politicians that show up are Speaker Nancy Pelosi, Governor Cuomo and Vice President Mike Pence.

A limitation of this analysis is the fact that TextBlob is essentially an NLP package. Writing out the NLP tools themselves instead of relying on the functionality of TextBlob may be preferable to ensure a good understanding of the NLP algorithms applied. It’s entirely possible if you were to perform the NLP coding from scratch then perhaps the polarity may be different. A blind acceptance of TextBlob may not always be advisable. That said, if you are new to NLP then Text Blob is an amazing feature!

--

--