Publications by Peter's stats stuff - R

Impact of omitted variables on estimating causal effects – simulations

14.04.2017

The story so far Last week I looked at a few related methods of investigating causality with observational data, where the treatment is expected to be received by observational units (people or firms)… in a way that is structurally related to variables of importance (ie not a random controlled trial)… which also impact on the response of int...

8624 sym R (10006 sym/2 pcs) 8 img

Cartograms of New Zealand census data

22.04.2017

I’ve been trying to catch up with mapping functionality in R and its extended ecoverse, so might do a few posts on this in the next month or so. First up (more or less by accident) is cartograms – maps where some other numeric variable is substituted for land area, while still trying to preserve regions’ basic shapes and relative location...

5907 sym R (2790 sym/2 pcs) 8 img

More cartograms of New Zealand census data (district and city level)!

24.04.2017

Just a short note to say that I’ve finished creating an experimental map of New Zealand by the 66 Territorial Authorities (districts and cities), with area expanded or shrunk to be proportional to population at the 2013 census. This is in addition to the 16 Regional Council divisions I blogged about a couple of days ago. It’s available in t...

935 sym R (1102 sym/1 pcs) 4 img

Luke-warm about micromaps

29.04.2017

Continuing my exploring methods for spatial visualisation of data in R, today I’m looking at linked micromaps. Micromaps are a way of showing statistical graphics for a small subset of regions at a time, with a small map indicating which regions are being looked at in each of the small multiples. Alberto Cairo has some nice discussion in this...

5839 sym R (9807 sym/6 pcs) 12 img

Modelling individual party vote from the 2014 New Zealand election study

05.05.2017

Someone asked on Twitter about the characteristics of New Zealand First voters. While some crude conclusions can be drawn from examining votes by location cast and then comparing that with census data, we really need individual level data to answer the question properly. I set myself this task as a motivation for exploring the New Zealand Electi...

17156 sym R (20016 sym/11 pcs) 16 img

Web app for individual party vote from the 2014 New Zealand election study

13.05.2017

Last week I posted some analysis of individual voting behaviour in New Zealand’s 2014 general election. In that post, I used logistic regression in four different models to predict the probability of an individual giving party vote to each of the four largest parties – National, Labour, Green and New Zealand First. That let the user compare t...

2935 sym 2 img

Sankey charts for swinging voters

20.05.2017

Continuing my examination of the individual level voting behaviour from the New Zealand Election Study, I wanted to look at the way individuals swap between parties, and between “did not vote” and a party, from one election to another. How much and how this happens is obviously an important question for both political scientists and for poli...

5246 sym R (10468 sym/1 pcs) 4 img

Global choropleth maps of military expenditure

03.06.2017

Global choropleth maps Today I’m writing about using country-level choropleth maps at a global level, using example data showing nations’ military spending as a percentage of GDP. There are a few specific issues to work through as a result of the global coverage. I’m going to start with my two preferred end results. First, here’s a Twit...

11997 sym R (10573 sym/6 pcs) 16 img

Stats NZ encouraging active sharing for microdata access projects

16.06.2017

The Integrated Data Infrastructure (IDI) is an amazing research tool One of New Zealand’s most important data assets is the integrated data infrastructure: “The Integrated Data Infrastructure (IDI) is a large research database containing microdata about people and households. Data is from a range of government agencies, Statistics NZ surveys...

8207 sym 2 img

State-space modelling of the Australian 2007 federal election

23.06.2017

Pooling the polls with Bayesian statistics In an important 2005 article in the Australian Journal of Political Science, Simon Jackman set out a statistically-based approach to pooling polls in an election campaign. He describes the sensible intuitive approach of modelling a latent, unobserved voting intention (unobserved except on the day of the...

8907 sym R (9983 sym/8 pcs) 8 img