Quantcast
Channel: r software hub
Viewing all articles
Browse latest Browse all 1015

Election analysis contest entry part 1 – introducing the nzelect R package

$
0
0

By Peter’s stats stuff – R

The contest

Inspired by Ari Lamstein’s R Election Analysis Contest, I’ve fast-tracked a project that’s been at the back of my mind for a while, to make available in a friendly, tidy R package a range of data about New Zealand elections. My entry for the contest will involve 3 or 4 posts over the next week or so:

  1. Today’s post, introducing the {nzelect} package from a user angle and demonstrating some basic use
  2. A post to come on how {nzelect} was put together
  3. A post on this Shiny app which provides an interactive map to explore the detail (down to individual voting location) of the New Zealand 2014 general election
  4. (if I get around to it) a more formal piece of statistical modelling of some of the spatial aspects of the 2014 general election

The first three posts are really about setting up infrastructure – tidying up the data for convenience, and exploring it in an interactive tool – so the four posts need to be seen as a unified whole. Hopefully I’ll get round to that last one!

The need for an R package

Election results data in New Zealand is in pretty good shape. The Electoral Commission publishes results in a nice nearly-there machine-readable format. However, there’s still a bit of work required to make it analysis-ready, particularly for anything that gets seriously into the spatial aspects or matching to demographic or economic data.

For example, consider this blog post by kiwipollguy. He identifies that it would be useful to do a regression of voting behaviour on economic characterstics of the meshblocks (lowest geographical unit in the New Zealand census) in which they’re located, but it’s clearly a job of work to organise the data to do that.

Statistics New Zealand publish census data at an electorate level, which is potentially useful, …read more

Source:: r-bloggers.com


Viewing all articles
Browse latest Browse all 1015

Trending Articles