Pages

Saturday, November 5, 2016

The post election count favours the Coalition

For the first time at the 2016 election, the Australian Electoral Commission has provided a two party preferred (TPP) count for each seat by vote type. This affords another window on the contention that the final count is more favourable to the Coalition when compared with the count of ordinary votes, which is completed on election night.

You can see the earlier analysis here and here, which came to the same conclusion over the past five Federal elections, based on the two candidate preferred (TCP) counts for each seat by vote type.

If we look at the Coalition's TPP percentages (summed across all seats, for each vote type) it received:

    Ordinary Votes:             49.952 %
    Absent Votes:               46.090 %
    Provisional Votes:          40.739 %
    Declaration Pre-Poll Votes: 51.580 %
    Postal Votes:               56.251 %
    Total Votes:                50.356 %

In the 2016 election, the Coalition lost the TPP count on election night (ordinary votes in the above list). But by the final count it had improved its position by 0.404 percentage points to win the final TPP count. The distribution of the Coalition's bias (compared with ordinary votes) across seats can be seen in the following charts.






The python code for the above analysis follows.

import pandas as pd
import numpy as np
from pandas import Series, DataFrame
import matplotlib.pyplot as plt
plt.style.use('../bin/markgraph.mplstyle')

# --- get data
e2016 = pd.read_csv('./Data/HouseTppByDivisionByVoteTypeDownload-20499.csv', 
    header=1, index_col=None, quotechar='"',sep=',', na_values = ['na', '-', '.', ''])

# --- some useful frames
vote_types = ['OrdinaryVotes', 'AbsentVotes', 'ProvisionalVotes', 
    'DeclarationPrePollVotes', 'PostalVotes','TotalVotes']
vote_names = ['Ordinary Votes', 'Absent Votes', 'Provisional Votes', 
    'Pre-poll Declaration Votes', 'Postal Votes','Total Votes']

Coalition = 'Liberal/National Coalition'
Labor = 'Australian Labor Party'
Percent = 'Percentage'

# --- now let's calculate and plot the comparisons
votes = e2016.copy()
year = 2016
print(year)
    
# check vote sums
Laborlist = (Labor + ' ' + pd.Series(vote_types[:-1])).tolist()
Coalitionlist = (Coalition + ' ' + pd.Series(vote_types[:-1])).tolist()
assert((votes[Laborlist + Coalitionlist].sum(axis=1) == votes['TotalVotes']).all())

# let's focus on Coalition TPP only (and we will recalculate)
votes[Coalition + ' TotalVotes'] = votes[Coalitionlist].sum(axis=1)
for x in vote_types[:-1]:
    total = votes[Coalition + ' ' + x] + votes[Labor + ' ' + x]
    votes[Coalition + ' ' + x + Percent] = votes[Coalition + ' '+ x] / total * 100.0
    print(x + ': ', votes[Coalition + ' '+ x].sum() / total.sum() * 100.0, '%')
votes[Coalition + ' TotalVotes' + Percent] = (votes[Coalition + ' TotalVotes'] /
    votes['TotalVotes'] * 100.0)
print('Total Votes: ', 
    votes[Coalition + ' TotalVotes'].sum() / votes['TotalVotes'].sum() * 100.0, '%')
    
# and plot ...
types = (Coalition + ' ' + pd.Series(vote_types) + Percent).tolist()
ordinary = votes[Coalition + ' ' + 'OrdinaryVotes' + Percent]
for type, name in zip(types[1:],vote_names[1:]):
    votes[type+'-Ordinary'] = votes[type] - ordinary
    ax = votes[type+'-Ordinary'].hist(bins=25)
    ax.set_title(str(year)+' Coalition TPP Bias in '+name+' cf Ordinary Votes')
    ax.set_xlabel('Coalition bias in TPP percentage points') 
    ax.set_ylabel('Number of Seats')
    ax.axvline(0, color='#999999', linewidth=0.5)
        
    fig = ax.figure
    fig.tight_layout(pad=1)
    fig.text(0.99, 0.01, 'marktheballot.blogspot.com.au', ha='right', va='bottom',
        fontsize='x-small', fontstyle='italic', color='#999999')

    fig.savefig("./graphs/TCP3_Coalition_"+str(year)+'_hist_'+name+'-ordinary.png', 
        dpi=125)
    plt.close()

No comments:

Post a Comment