I’ve just finished updating and deploying a webtool that helps explore data from the New Zealand Election Study. I first built a version of this a few years back with just the 2014 wave of the study; today I’ve added the data from the time of the 2017 election and made a number of small improvements (eg getting the macrons back in to the ‘Māori Party’; and making the drop-down list of variables searchable).
Choice of cell values in a crosstab gives different understandings of what is important
The basic functionality remains the same as when I wrote about the earlier version in August 2017. The motivation is to facilitate one of the simplest yet still powerful types of analysis from this sort of data - a simple crosstab of party vote by one attitudinal or demographic variable. For example, here are the estimated absolute numbers of voters for each party by level of education:
These numbers have been weighted by the NZES team to the population of registered electors, and I have further recalibrated them to match the key party vote totals, useful for this particular line of analysis I’m pursuing here. The NZES’ teams original weights can still be used if needed.
In themselves, these estimated population numbers provide an interesting perspective, but get more useful if we convert into percentages. Here we see it with row-wise percentages, highlighting (for example) that 50% of Greens voters had a university degree but only 12% of New Zealand First voters. Some simple automated colouring serves well to highlight the more important cells.
An obvious thing to do is to swap the percentages from row-wise to column-wise:
Now we see, in contrast to half of Greens voters having university degrees (from the previous plot), only 10% of university-educated electors vote for Greens (with a third voting for each of National and Labour). In contrast, 40% of electors with a school qualification are estimated to have voted National and only 4% Green.
We can also highlight a more thorough statistical measure of which cells stand out by showing the Pearson residuals:
These are the estimates of deviance of each cell in the two-by-two crosstab from an implied null hypothesis of no relationship between the two variables. So we see highlighted in blue the large value for university-educated Greens voters, or for New Zealand First voters with no qualifications.
There’s lots of valuable information here
These are large and valuable surveys with a big variety of questions about demographics, attitudes and experience. It’s not possible do justice to the range of information available in anything less than a book. But here are some more tasters.
Here we see Green and Labour voters in 2017 much more likely to have used social media to promote their views than National voters:
Here we see Labour gathering 51% of Māori party votes (compared to 15% for the Māori Party)
And here we see who is angry about social and economic inequality (not many people, but a bit more than a third of Greens voters):
Most people agree reducing carbon emissions is needed to combat climate change (although some hundreds of thousands of people across the political spectrum still disagree):
And here is the ‘single most important issue’ in the election for each party’s voters:
Environment for Greens voters, housing for Labour and Māori Party voters (more obviously so for the latter), the economy for National voters, immigration for New Zealand First and inequality for The Opportunity Party (“TOP”).
Go out and have a play. Now that the variable list is searcheable it’s easy and even fun to explore.
As is the case for nearly all of my Shiny apps, the source code for this is divided into two parts: