New Zealand · R

Stuff Pākehā like: Flag referendums

Silver-fern-black-white-and-blue-flat

(Image from New Zealand Government)

The previous post looked at the referendum result and found that it had an extraordinarily good match to National Party support. This post looks at the turnout. Once again, seeing what comparisons between electorates can tell us about the nation.

One theory is that increasing turnout is associated with increasing support for change- after all, if you graph the two it seems to show that general pattern.

g1

However, that assumes that the electorates are similar enough that turnout moves along a spectrum, and that the increase in turnout is associated with desire for change. If we instead graph the 2014 election turnout (before the idea of a flag referendum) against the desire for change, we get essentially the same graph.

g2

So it is not turnout for the flag referendum specifically, it is general political engagement (unless we do something fancy, he said foreshadowing). As well as comparing the respective turnouts with the support for change, we can compare the respective turnouts with each other

g4

We could construct a line of best fit, that shows the way the two turnouts relate together and posits movement along the line, with electorates less interested in the flag referendum (compared to other electorates and in relation to interest in the general election) below the line, and interested electorates above the line. However, as alluded to before, this posits that the line is along a single scale of electorates, and we see something interesting if we pick out groups based on our actual knowledge of electorates “domain knowledge”.

g5

The Māori electorates are in the lower left, and only in the lower right and have distinctive membership requirements to the general roll. The three electorates in the lower mid section also form a distinctive group of Māngere, Manukau East, and Manurewa (that I am going to refer to in shorthand in this as “South Auckland” on the graphs, for the strongly Pasifica geographic adjacent Southern Auckland electorates which form a distinctive tight group in the data). We could have some pretty endless arguments about if they should be considered separate groups with their own characteristics or as a continuum of one group, but I will lean on the separate groups because:

  • the groups are all far apart
  • the groups are all self-contained (don’t have members of other groups in their area)

We can collapse the distinction between the flag turnout and the election turnout, by taking the turnout for the flag referendum relative to the election turnout. This gives an effective figure of “interest in the flag referendum relative to the general interest in politics”- a single value which can be expressed by subtracting the general election turnout from the flag referendum turnout (let’s call it Flag engagement)

g6

We could also present it as the flag referendum turnout as a proportion of the general election- either way gives essentially the same graph

g7

For simplicity I am going to use the subtraction figure in the following, though you get the same results either way. But as an aside- I will draw special attention to Coromandel, Kaikōura, and Rangitata. All of whom were, effectively,  almost as engaged with the flag referendum as they were with the general election (they were not overly keen on changing to the contender BTW).

Taking the Flag Engagement figure, we can return to where we began this post, and look at Flag engagement vs. support for change.

g8

Seeing it as different set of communities we could say:

  • Most the the general electorates were interested in the flag referendum at a level nearish to the interest taken in the 2014 general election, and among those that voted support for change was in the 40 percent range.
  • The Māori electorates were engaged with the flag question (relative to the general election) as much as the general electorates, but were strongly against change in the 20 percent range. While I don’t have the mana to say why, I can paraphrase a comment of dinner from someone with more mana than I saying that the contender flag had no symbolism for Māori representing their own native land.
  • The South Auckland electorates were strongly disengaged with the Flag question, and those that voted were in between the other two groups in degree of support for change (the low 30 percent range).

I think these groups can be legitimately interpreted as the following stories:

  • People of European descent are getting tired of a colonial flag, but the will is not quite there yet to change to any old thing.
  • Māori do not want to shift from one flag that does not represent them to another flag that does not represent them.
  • South Auckland has a bunch of people in it who do not see the flag they happen to be under as something that has much connection to them.

And coming back to the initial theory, that increased turnout is associated with a greater desire for change. Yeah, Nah. Yes for the association between voting in the glass referendum and voting in the general election (so civic engagement generally), but when you focus on the effect of interest in the flag alone…

If you treat it as three distinct groups with their own reasons, Maori is no with an outlier from the rest, South Auckland goes down then back up so with three points who can say, and the general electorates trend up but  then go back down. For this last, drawing a straight line of best fit has a (poor) R squared value of 0.23, and while a curved line looks more ethically pleasing (which is a lot like many of the flag arguments) it does not produce a better result- there are too many entries far from the line to be able to say much about it with confidence. So for general electorates lets say maybe a little, but not enough to be confident about given the variation between electorates.

g9

 

In an entitled to my opinions but not my facts kind of way, here is the R code that made the above

library("rvest")
 url <- "http://www.electionresults.govt.nz/2016_flag_referendum2/result-by-electorate.html"
 url %>%
 read_html() %>%
 html_nodes(xpath='//html/body/div/table') %>%
 html_table(fill=TRUE) -> flegs
 flegs <- flegs[[1]]
 #flegs <- flegs[2:72,c(1,7)]
 f1 <- flegs[2:72,c(1,7,4)]
 names(f1)[2:3] <- c("fvotes", "fturnout")
 f1$fvotes <- as.numeric(gsub("%","",f1$fvotes))
 f1$fturnout <- as.numeric(gsub("%","",f1$fturnout))
 f1$Electorate <- gsub(".*- ", "", f1$Electorate )
election <- read.csv("http://www.electionresults.govt.nz/electionresults_2014/e9/csv/e9_part5.csv", skip=3, header=FALSE, stringsAsFactors = FALSE)
 eh1 <- read.csv("http://www.electionresults.govt.nz/electionresults_2014/e9/csv/e9_part5.csv", skip=1, header=FALSE, nrows=1, stringsAsFactors = FALSE)
 eh2 <- read.csv("http://www.electionresults.govt.nz/electionresults_2014/e9/csv/e9_part5.csv", skip=2, header=FALSE, nrows=1, stringsAsFactors = FALSE)
 h1 <- unlist(eh1)
 h1[is.na(h1)] <- ""
 h2 <- unlist(eh2)
 newheads <- make.names(paste(h1,c("",h1[2:length(h1)-1]),h2, sep=""))
 names(election) <- newheads
 e1 <- election[-1*c(65,73,74),]
 e1$Electoral.District[e1$Electoral.District == "Rangitīkei"] <- "Rangitῑkei"
turnout <- read.csv("http://www.electionresults.govt.nz/electionresults_2014/e9/csv/e9_part9_1.csv", skip=5, header=FALSE, stringsAsFactors = FALSE)
 t1 <- turnout[-1*c(65,73,74),c(1,13)]
 names(t1) <- c("Electoral.District", "turnout2014")
t1$Electoral.District[t1$Electoral.District == "Rangitīkei"] <- "Rangitῑkei"
refdata <- merge(e1,f1, by.x="Electoral.District", by.y="Electorate")
 r1 <- merge(refdata,t1)
r1 <- r1[,c("Electoral.District", "MĀORI.PARTYPercentage", "NATIONAL.PARTYPercentage", "turnout2014", "fturnout", "fvotes")]
plot(r1$turnout2014, r1$fturnout)
 r1$motivation <- r1$fturnout - r1$turnout2014
 plot(r1$motivation, r1$fvotes)
#Initial turnout graph
 png("g1.png")
 plot(r1$fturnout, r1$fvotes, main="Electorate referendum turnout\ncompared to support for change", ylim=c(0,60), pch=19, cex=0.8, col="#33333366", frame.plot=FALSE, xlab="Flag turnout %", ylab="Support for Change %")
 dev.off()
#2014 turnout graph
 png("g2.png")
 plot(r1$turnout2014, r1$fvotes, main="Electorate 2014 turnout\ncompared to support for change", ylim=c(0,60), pch=19, cex=0.8, col="#33333366", frame.plot=FALSE, xlab="2014 turnout %", ylab="Support for Change %")
 dev.off()
# turnout comparisons
 png("g3.png")
 plot(r1$turnout2014, r1$fturnout, main="Electorate 2014 turnout\ncompared to flag turnout", pch=19, cex=0.8, col="#33333366", frame.plot=FALSE, xlab="2014 turnout %", ylab="Flag Turnout %")
 dev.off()
#line of best fit
 xpoints <- seq(from=min(r1$turnout2014), to=max(r1$turnout2014), length.out=100)
 lob <- lm(fturnout ~ turnout2014, data=r1)
 predata <- data.frame(turnout2014 = xpoints)
 ypoints <- as.data.frame(predict(lob, newdata=predata, interval="confidence"))
png("g4.png")
 plot(r1$turnout2014, r1$fturnout, main="Electorate 2014 turnout\ncompared to flag turnout", frame.plot=FALSE, xlab="2014 turnout %", ylab="Flag Turnout %", type="n", ylim=c(30,80))
 polX <- c(xpoints, rev(xpoints))
 polY <- c(ypoints$lwr, rev(ypoints$upr))
 polygon(polX, polY, border=NA, col = "#beaed455")
 points(r1$turnout2014, r1$fturnout, pch=19, cex=0.8, col="#33333366")
 lines(xpoints, ypoints$fit, col = "#beaed4")
 legend("topleft", legend= c("electorates", "line of best fit", "95% CI of line"), col=c("#33333366", "#beaed4", "#beaed455"), pch= c(19,45,15), bty="n", cex=0.8, y.intersp=1.5)
 dev.off()
### Different Communities
 mel <- c("Hauraki-Waikato", "Ikaroa-Rāwhiti", "Tāmaki Makaurau", "Te Tai Hauāuru", "Te Tai Tokerau","Te Tai Tonga", "Waiariki")
 melc <- r1$Electoral.District %in% mel
 pel <- c("Māngere", "Manukau East", "Manurewa")
 pelc <- r1$Electoral.District %in% pel
 gelc <- !(melc | pelc)
# community comparisons
 png("g5.png")
 plot(r1$turnout2014[gelc], r1$fturnout[gelc], main="Electorate 2014 turnout\ncompared to flag turnout", pch=19, cex=0.8, col="#33333366", frame.plot=FALSE, xlab="2014 turnout %", ylab="Flag Turnout %", ylim=c(40,80), xlim=c(60,90))
 points(r1$turnout2014[melc], r1$fturnout[melc], pch=18, cex=1, col="#FF333366")
 points(r1$turnout2014[pelc], r1$fturnout[pelc], pch=17, cex=0.8, col="#AA00AA66")
 legend("topleft", legend= c("Māori Electorates", "South Auckland", "General Electorates"), col=c("#FF333366", "#AA00AA66", "#33333366"), pch= c(18,17,19), bty="n", pt.cex=c(1,0.8,0.8), y.intersp=1.5, cex=0.8)
 dev.off()
#change in turnout with subtraction
 r1$deltaturnout <- r1$fturnout - r1$turnout2014
png("g6.png", height=320)
 stripchart(round(r1$deltaturnout[!(pelc)], digits=0), method="stack", offset=0.9, at=0, col="#888888", pch=19, xlim=c(-30,0), frame.plot=FALSE, main="Flag Turnout minus Election Turnout")
 stripchart(round(r1$deltaturnout, digits=0)[melc], method="stack", offset=0.9, at=0, pch=19, col="#FF3333", add=TRUE)
 stripchart(round(r1$deltaturnout, digits=0)[pelc], method="stack", offset=0.9, at=0, pch=19, col="#AA00AA", add=TRUE)
 legend("topleft", legend= c("Māori Electorates", "South Auckland", "General Electorates"), col=c("#FF3333", "#AA00AA", "#888888"), pch=19, bty="n", y.intersp=1.5, cex=0.8)
 dev.off()
#change in turnout with proportion
 r1$propturnout <- r1$fturnout / r1$turnout2014
png("g7.png", height=320)
 stripchart(round(r1$propturnout[!(pelc)], digits=2), method="stack", offset=0.9, at=0, col="#888888", pch=19, xlim=c(0.5,1), frame.plot=FALSE, main="Flag Turnout as proportion\nof Election Turnout")
 stripchart(round(r1$propturnout, digits=2)[melc], method="stack", offset=0.9, at=0, pch=19, col="#FF3333", add=TRUE)
 stripchart(round(r1$propturnout, digits=2)[pelc], method="stack", offset=0.9, at=0, pch=19, col="#AA00AA", add=TRUE)
 legend("topleft", legend= c("Māori Electorates", "South Auckland", "General Electorates"), col=c("#FF3333", "#AA00AA", "#888888"), pch=19, bty="n", y.intersp=1.5, cex=0.8)
 dev.off()
#Initial turnout graph with groups
 png("g8.png")
 plot(r1$deltaturnout[gelc], r1$fvotes[gelc], main="Flag turnout minus 2014 turnout\ncompared to vote for change", pch=19, cex=0.8, col="#33333366", frame.plot=FALSE, xlab="Flag engagement", ylab="Support for Change %", ylim=c(0,60), xlim=c(-30,0))
 points(r1$deltaturnout[melc], r1$fvotes[melc], pch=18, cex=1, col="#FF333366")
 points(r1$deltaturnout[pelc], r1$fvotes[pelc], pch=17, cex=0.8, col="#AA00AA66")
 legend("topleft", legend= c("Māori Electorates", "South Auckland", "General Electorates"), col=c("#FF333366", "#AA00AA66", "#33333366"), pch= c(18,17,19), bty="n", pt.cex=c(1,0.8,0.8), y.intersp=1.5, cex=0.8)
 dev.off()
#Initial turnout graph with groups and best fit
genxpoints <- seq(from=min(r1$deltaturnout[gelc]), to=max(r1$deltaturnout[gelc]), length.out=100)
 r1$d2 <- r1$deltaturnout * r1$deltaturnout
 r1$d3 <- r1$deltaturnout * r1$deltaturnout * r1$deltaturnout
 summary(lm(fvotes ~ deltaturnout, data=r1[gelc,]))
 genlob <- lm(fvotes ~ deltaturnout + d2 + d3, data=r1[gelc,])
 summary(genlob)
 predata <- data.frame(deltaturnout = genxpoints, d2 = genxpoints * genxpoints, d3 = genxpoints * genxpoints * genxpoints)
 genypoints <- as.data.frame(predict(genlob, newdata=predata, interval="confidence"))
 polX <- c(genxpoints, rev(genxpoints))
 polY <- c(genypoints$lwr, rev(genypoints$upr))
png("g9.png")
 plot(r1$deltaturnout, r1$fvotes, type="n", main="Flag turnout minus 2014 turnout\ncompared to vote for change", xlab="Flag engagement", ylab="Support for Change %", ylim=c(0,60), xlim=c(-30,0))
 polygon(polX, polY, border=NA, col = "#22222222")
 points(r1$deltaturnout[gelc], r1$fvotes[gelc], pch=19, cex=0.8, col="#33333366")
 points(r1$deltaturnout[melc], r1$fvotes[melc], pch=18, cex=1, col="#FF333366")
 points(r1$deltaturnout[pelc], r1$fvotes[pelc], pch=17, cex=0.8, col="#AA00AA66")
 lines(genxpoints, genypoints$fit)
 legend("topleft", legend= c("Māori Electorates", "South Auckland", "General Electorates", "Line of best fit", "95% CI"), col=c("#FF333366", "#AA00AA66", "#33333366", "#000000", "#22222222"), pch= c(18,17,19,45,15), bty="n", pt.cex=c(1,0.8,0.81,0.8), y.intersp=1.5, cex=0.8)
 dev.off()
 
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s