Site icon R-bloggers

More things with the New Zealand Election Study by @ellis2013nz

[This article was first published on Peter's stats stuff - R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

A new cross tab tool

I recently put up a simple web app, built with R Shiny, to let users explore the relationship between party vote in the 2014 New Zealand general election and a range of demographic and attitudinal questions in the New Zealand Election Study. The image below is a link to the web app:

The original motivation was to answer a question on Twitter for a breakdown of National party vote by gender. I was surprised how interesting I found the resulting tool though. Without a fancy graphic, just a table of numbers, there’s a lot to play around with here. I deliberately kept the functionality narrow, because I wanted to avoid a bewildering array of choices and confusing user interface, so it tries to do only one thing and does it well. The thing it does is show cross tabs of party vote with other variables from the study.

The source code of the Shiny app is available as is the preparation script but they’re quite unremarkable so I won’t reproduce them here; follow the links and read them on GitHub in their natural habitat.

A few interesting statistical points to note:

More stuff using the New Zealand Election Study

So I now have two web apps with this data:

… and six blog posts. To recap, here’s all the blog posts I’ve done so far with this data:

1. Attitudes to the “Dirty Politics” book

In my first post on the data, I did quick demo analysis of what the attitudes were of voters for various parties to Nicky Hagar’s book “Dirty Politics”

2. Modelling individual level party vote

I did some reasonably comprehensive modelling of who votes for whom. The main work here was deciding how many degrees of freedom could be spared for the various demographic variables, and clumping/tidying them up into analysis-ready form. This was also a good opportunity for some thinking about modelling strategy, the role of the bootstrap, and multiple imputation which is essential with this sort of problem.

3. Web app for individual vote

This led to my first web app with the New Zealand Election Study data, which lets you explore the predicted probability of different types of people voting for different parties.

4. Sankey chart of ‘transitions’ from 2011 vote to 2014

This was an interesting experiment in looking at what one survey can tell us about people swapping from party to party:

5. Modelling voter turnout

I adapted my approach of modelling party vote to the perhaps even more important question of who turns out to vote at all.

6. Cross tab tool

The sixth blog post is today’s.

For New Zealand readers, have a good final five weeks up to the 2017 election!

To leave a comment for the author, please follow the link and comment on their blog: Peter's stats stuff - R.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.