The latest polls just released tonight are suggesting a numerical tie between Dilma Rousseff (PT) and Aecio Neves (PSDB) considering the limit of the margin of error. Actually, these polls fired up a possible game-changing for the opposition over the government as some of the polls did capture any impact stimulated by the televised debate on Friday night.

There is still a lot of uncertainty around; roughly 5% of the electorate were reported to be undecided still. Nonetheless, by the time I run my model today, it turned Aecio ahead of Dilma for a little margin (< 1%). These numbers also account for Wasting votes, so it will typically diverge from the official results.







House Effects

Although the machinery behind the model I'm running allows for drawing several elections from data, it's too risky to call one side or the other given the pollster's credibility, which was certainly aggravated by the poor performance 3 weeks ago. Meanwhile, I've been trying to learn the pollsters' random walk in the Brazilian campaigns, but given the small range of observations this will take a while to produce robust measures.

The following chart shows the house effects considering those polls released over the runoff campaign. Ideally, a poster would have its effect equally distributed between positive and negative bands. Like a drunkard's walk a pollster could stagger left and right near each party or candidate. Not surprisingly, however, the picture shows two blocks of bias. While the first 4 pollsters typically fielded more positive numbers of the Government, the last 3 did so for the opposition. In addition, the house effects found for Datafolha, Veritá, and Sensus are statistically different than zero.


Taking a less systematic approach on the house effects, adjusting only for the sample size of the polls, regardless the methodology employed (probability with quotas or simply quotas), Dilma appears ahead with an interval of [2.5% to 5.7%] as represented in the following distribution. This happen because polling firms with a house house effects toward the government happen to sample much more people than otherwise, though the methodology they use to sample a large quantity of voters is poorer. This election is so mercurial that wrong decision on the precision parameter can sway the outcome from one side to the other.


Although polling data are the most common source in an electoral campaign, there are also models that use prediction markets data (trade contracts flow) as the source of information about who is going to win the election. What is the best way of predicting an election is up to debate, but models based on the wisdom of crowds have been used extensively on the web for all-purpose forecasting, including prices, sales, and disasters. Actually, the range of events a bet can be trade has increased over the years; for elections, it is an obvious step to take.

The debate can be placed as such: Berg et al (2001) compared opinion polls and market based predictions from 19 national elections, finding evidence that market predictions provide a serious alternative to opinion polls. Not surprisingly, this argument is contested. For instance, Erikson and Wleizen (2008) argue that opinion polls reflect opinion on the day they were collected, and therefore should not be naively interpreted as forecasts. It's pretty much a consensus in the literature, but further they suggest that, if opinion poll data are appropriately adjusted, they will outperform market predictions.

Evidence for the Brazilian Election

This suggests that market-based prediction provides a serious alternative to opinion polls in predicting political contests. So what does the market say about the outcome of the Brazilian election so far?

The evidence used in this under constructing study has been retrieved from the history of the odds offered on “Dilma” and “Aécio” votes from 23 bookmakers between Sep 2013 and May 2014.
The bookmaker Ipredict had launched some contracts addressing Brazilian election outcome, one of them says: "This contract pays $1 if the President of Brazil following the next General Election is a member of the Brazilian Workers' Party. Otherwise, this contract will close at $0." In other words, the purpose of this contract is to forecast the probability that the President of Brazil is a member of the Brazilian Workers' Party. A similar contract were in the place for a member of the Social Democracy Party (PSDB).


Figure 1: Market-based probability of “Dilma” victory in the 2014 election

It can be seen that over the last days, the market is betting high on Dilma. By today, the probability of seen her as the next president was about 80% compared to 20% of Aecio Neves.

Opinion Polls

The obvious standard comparator to market-based predictions are the regular opinion polls that are continuously measuring the vote intentions for the candidates. In the following box, I show some predictions based on a Bayesian model I've been developing this year. It aggregates many polls and filter them out based on sample size and time elapsed between one poll to the next. These prediction also includes Wasting votes, so it will typically diverge from the official results. However, the important point is that, considering the mean of the prediction, Dilma has a probability of 75% of winning this race, pretty close of the prediction market, isn't it?

Probability Intervals (95%):
               2.5%          50%      97.5%
PT       0.40575221  0.471395889 0.53077824
PSDB     0.38681539  0.450461758 0.49911252
WASTING  0.06448501  0.088751737 0.11329596

I’ve been looking at the polls since last year, I never doubt the Workers’ Party would make it again, thought not-so-fast because of the economic downturn.

I just scraped some data about the Uruguayan general election, which will be held in the same day as the Brazilian runoff version. It's too early to say anything about pollsters performance, but I found they seem to do a decent job in fielding vote intentions among our neighbors. Actually, much better than their Brazilian counterparts. Most of them use probability samples and interview people using face-to-face and CATI modes, but even those conducted online with Facebook users, for instance, are statistically sound once them are typically corrected through post-stratification models.

Despite high levels of popularity, Jose Mujica won't make the ruling coalition to pass before November 30th. The results bellow support the view of a runoff between the incumbent ticket of the former president Tabare Vazques (Frente Amplio) and Raul Sendic (Partido Nacional), though there are some swingable voters to dispute.

Crystal-Ball Somebody said me that it'd be really nice to see a posting with simple simulations for the runoff this weekend. Answering such a call, this is the best I could come up with. The following is a highly simplified simulation that does not account for time trends nor for house effects. But it's still theoretically sound as it takes a vector of polls, instead of single polls individually.

# collect some of the latest polls 
dilma <- c(53,54, 52,46.7,52, 50.5, 43.6)

# Set the estimated percent for Dilma
# based on the average of several national polls
propDilma = mean(dilma)

# Set the standard deviation
# this measures the variability between the different polls.
sdDilma = sd(dilma)

# Function to simulate a single election
simElection <- function(prop,sd){

# Simulate the percent Dilma in 1000 elections
simPropDilma = replicate(1000, simElection(propDilma,sdDilma))

# Calculate the percent of times Dilma wins
perDilmaWin = mean(simPropDilma > 50)
[1] 0.517 

hist(simPropDilma, freq=FALSE, xlab="Popular Vote", 
     main="Distribution of Dilma's Popular Vote",
     col="red", xlim=c(30,70),  ylim=c(0, .15) )

curve(dnorm(x, mean=mean(simPropDilma), sd=sd(simPropDilma)), add=TRUE, col="blue", lwd=2) 


Lefting 10 days to the runoff election, pollsters are saying the Social Democrat candidate, Aécio Neves (PSDB), is leading for a tiny margin, though his advantage is within the typically 2% sampling error. That is, pollsters are careful to call anything. If this context holds over the next week, it will be the first time in modern Brazilian democracy that a runner-up candidate in the first round get more votes than the winner, the Workers' Party's incumbent Dilma Rousseff.

The following charts combine the latest polls using the vote intention declared for of the eventual runoff between these two candidates collected over the first round election as priors, the dots at the end is where I believe the candidates will fall. The computation uses the total votes, therefore it includes the Wasting votes as the third category and a residual category of Swing voters. Because I'm using total votes, the winner may have less than 50% of the votes.