A fair go – a Twitter analysis of the 2022 Australian Federal Election

With the countdown to the 2022 Federal Election reaching its climax today, the Young Data Analytics Working Group (YDAWG) has once again traversed into the ‘Twittersphere’ to take in what the candidates, parties and the public have been saying, and have applied a machine learning algorithm to mimic the candidates’ tweets.

This is a sequel to the YDAWG’s 2019 Australian Federal Election Twitter analysis and 2020 US Presidential Election Twitter analysis and in no way tries to predict the election results.
‘Aussie Voters’ – An AI artist’s impression, generated on 6 May 2022

Whilst the DALL-E mini is, let’s just say, not as skilled an artist as the new DALL-E 2, access is free unlike the bigger model, and the AI, dare we say, has better art skills than some politicians. Let’s move on to some tweets.

Spotlight on candidate and parties’ tweets

We first seek to understand the most frequent keywords in the tweets which would shed light on the candidates, the two parties’ main messages and agendas. It also instigated some other questions, for example:

  • How often do they directly call out each other?

  • What thematics emerge from the candidates?

  • How do the general public react to the candidates and two parties? Is this election very polarised?

 

To understand this, historical tweets from the following accounts were sourced:

The most recent 3,000 tweets were extracted from the four accounts and after some data cleansing and removing retweets, the clean tweets are ready to be explored.

For the first exercise, we used a number of Python packages to create word cloud images based on the account’s own tweets.

A sample of code showing the Python Packages used for this analysis.

 

@ScottMorrisonMP

@AlboMP

@LiberalAus

@AustralianLabor

Other than *literal* name calling, Labor as the Opposition has a more critical tone with words such as ‘punish’, ’mistakes’, ’anxiety’. Meanwhile, the Liberal’s messaging is focused on sustainability, social and defence themes, e.g. ‘defence’, ’energy’, ’renewable’, ’training’, and ’help’.

Investigate frequency of key topics using Scattertext

Using a python package called Scattertext, we can visualise the tweets and search (in the HTML format) for words which will then receive the frequency of the searched word by the two candidates. In addition, hovering around the words in the texts gives some info/location.

Understanding the public’s sentiment on candidates

Adopting a similar technique as above by analysing a set of tweets with keywords related to the two candidates and parties, public sentiment was gauged. Whilst the analysis is simple and high level, the insights can be useful to campaign staff, strategists, and political pundits looking for an audience. On each side, the most recent circa 3,000 tweets were analysed as of 7 May 2022 and we used a number of sentiment analysis packages for this analysis.

A sample of code showing the Python Packages used for this analysis.

 

Sentiment analysis results for Scott Morrison (left) and Anthony Albanese (right).
Scott Morrison – keywords: ‘Scomo’, ‘Scott Morrison’, ‘Morrison’.
Anthony Albanese – keywords: ‘Anthony Albanese’, ‘Albanese’.

From the sample tweets, Albanese transpires to be a more polarised public sentiment, having a higher percentage for both positive sentiment and negative sentiment compared to Morrison. The public’s sentiment on Morrison is unremarkable. With almost half the portion of neutral sentiment, this may be indicative of the public indecisiveness.

Sentiment analysis results for Liberal (left) and Labor (right).

Turning to the parties, the sample tweets suggest the opposite with Liberal holding a more polarised view than Labor. The large portion of neutral sentiment on the Labor Party suggests the public may still be monitoring the campaigns and don’t have a strong preference at this stage.

Campaigning for Twitter followers

With a little bit of basic web-scraping, we can also track the number of Twitter followers between the two leaders and parties over the past few years.

Follower count for official party Twitter accounts

It appears Labor’s account followers grew by almost 25% since July 2020 while Liberal only had a 7% increase in followers.

Follower count for party leader Twitter accounts

As might be expected Anthony Albanese has a much lower count of Twitter followers than the sitting Prime Minister Scott Morrison. Both leaders have had a huge growth in followers over the last two years, but Albanese appears to have gained a lot of momentum as the election campaign ramped up.

With a little bit of more advanced web-scraping, we are able to find the Twitter accounts for a number of prominent Liberal and Labor party members. Let’s take a closer look at how follower counts have changed for the biggest of these accounts in the lead up to the election.

Change in Twitter follower count over four weeks of campaigning

We see the party leaders are also the Twitter growth leaders, far higher than even the official party accounts. Perhaps unsurprising as this campaign turns its focus to personality contests (as with all political campaigns in human history).

Percentage growth in Twitter followers over four weeks of campaigning

The disparity in follower growth between parties can be seen when looking at the percent change in followers over four weeks during the campaign. With Labor not having won an election since 2010, it appears their accounts might have had the most room to grow during this election cycle.

The results of the Twitter follower battle between parties is even starker when presented with the summarised view, displaying the mean and 95% confidence interval of follower growth for a broad selection of Twitter accounts for each party.

Change in Twitter follower count over four weeks of campaigning

Percentage growth in Twitter follower count over four weeks of campaigning

Even the lower end of Labor Twitter account growth competes with the fastest-growing Liberal accounts. Note that this is of party accounts identified by our scraping bot, so there may be differences in online presence and social media engagement between parties.

While all these graphs show a fast-rising Labor in the Twitter-sphere, we’ll see this Saturday if any of this translates at all to votes!

‘Fake News’ tweets

In the age of disinformation, it becomes increasingly easy for malevolent forces to create ‘fake news’. Whilst generative models such as DALL-E have applications that are positive for society, they can also be used to doctor images, or generate bot posts to influence public opinion on social media.

Here we use a Markov Chain model with Markovify in Python to generate some Scott Morrison and Anthony Albanese-styled tweets. The model is not as sophisticated as the GPT-3 model, which can articulate entire op-eds, however this leads to results that range from the ‘representative’ to the ‘ridiculous’:

So, who will win?

“The Australian Prime Minister vs the Federal Opposition Leader” – Another DALL-E mini creation, generated 6 May 2022. On the topic of algorithmic bias, it is interesting to see the generated politicians are all of a similar demographic…

At the time of writing, Labor appears to be polling ahead of the Coalition. There has been continued discussion around the reliability of polling following surprising wins by conservative factions previously including the last Federal Election.

For those pondering the confidence intervals, Chris Dolman’s earlier article on Nadal’s “impossible” Australian Open victory may be worth a read.

As we mentioned earlier, this article does not aim to predict the results – we will leave that to the pundits. No matter which party wins on 21 May, we hope you have a fun election night… party!

CPD: Actuaries Institute Members can claim two CPD points for every hour of reading articles on Actuaries Digital.