10
$\begingroup$

Will we be able to see the results by vote after the elections are over? Or will we just have an announcement of who the winners are? I would be interested in knowing the exact numbers, as in:

Candidate 1: x # of votes

Candidate 2: x # of votes

etc.

$\endgroup$
  • $\begingroup$ It's almost over! Who will win? When will winners be notified? $\endgroup$ – Peter Flom Oct 1 '13 at 19:55
10
$\begingroup$

Yes. You can even practice now on the results of our first election held in 2011: find them at https://stats.stackexchange.com/election/1. (For some inspiration, check out what another site has done with their election results.)


As an example, here is R code to read and process an election file from a sister site's election (GIS in 2013). (I chose this because my familiarity with the details enabled me to verify the code is processing the data correctly.) It also tabulates the votes as shown in this barplot:

Barplot

(Candidates are ordered by a heuristic likely to correspond to the outcome of the election.)

source <- "http://gis.stackexchange.com/election/download-result/2"
#
# Read and process the election descriptor record
v <- unlist(read.table(source, nrows=1))
n.candidates <- v[1]
n.positions <- v[2]
#
# Read the rest of the file
x <- read.table(source, skip=1, fill=TRUE)
#
# Process the candidate descriptor record
candidates <- x[j <- is.na(x[,2]), 1]
na.candidate <- candidates[1]
candidates <- candidates[c(-1,-length(candidates))]
#
# Process the voting record
votes <- x[!j, 2:4]
d <- unlist(apply(votes, 1, function(z) 
  sapply(z, function(i) ifelse(i==0, NA, candidates[i]))))
rownames(d) <- c("First", "Second", "Third")
#
# Tabulate the raw results found in array `d`
results <- apply(d, 1, table, useNA="always")
rownames(results) <- c(levels(candidates)[sort(candidates)], "NA")
i <- order(results %*% c(5,3,1), decreasing=TRUE)
results[i, ] # Prints the two-way table of candidate by position
#
# Plot the tabulated results
barplot(t(results[i,]), legend.text=colnames(results), main=source)
$\endgroup$
  • 1
    $\begingroup$ The plot of the evolution of the votes over time was super cool :) $\endgroup$ – user25658 Sep 24 '13 at 5:34
  • 1
    $\begingroup$ I have just learned this code doesn't process the missing votes in the way intended by the STV software. The code here takes them as-is; for instance, if someone voted for a second and third place, that's what it uses. Apparently the official method first promotes those votes into votes for a first and second place before it proceeds. I'm not going to bother fixing this because the point was to document the raw results, never to reproduce the Meek STV calculation: but just be aware that there will likely be minor discrepancies in tallies compared to other vote summaries. $\endgroup$ – whuber Oct 1 '13 at 20:38

You must log in to answer this question.