So the OurCampaigns site (perhaps the worst-designed site on earth, but with lots and lots of cool data) has a feature on their maps called "Deviation". I'd imagine this is some sort of standard deviation calculation, but I have no idea how they apply std. dev. for multiple candidates.
These maps are cool because they help show where third-party (or candidates that didn't win any counties) candidates did relatively well.
Does anyone know how one might calculate this so that we could make our own deviation maps?
Indiana US Senate 2012: http://www.ourcampaigns.com/RaceDetail.html?RaceID=507745
Maine US Senate 2012: http://www.ourcampaigns.com/RaceDetail.html?RaceID=490756
If you look at the Indiana map the Yellow counties are where the the Libertarian candidate Horning did particularly well and where the Republican and Democratic candidates did about as well as they did statewide (semi-narrow victory for the Democrat Donnelly).
But if move around, there are counties where Horning did pretty well, but are not yellow. In those Mourdouck also did well. I think these may actually be orangeish (red + yellow). If you click on +candidates, you can select and de-select candidates. I had better luck deselecting all but the Top 3, and then picking pairs.
For example, if you look at Maine, and have King(I), Summers(R), and Dill(D) selected, it shows King did relatively well in the center band of the state. If you add Woods(G) back in, Oxford and Franklin become Green. So that is really showing where Woods had strength. Because Woods only had 1.47% statewide it must be showing relative strength. When he gets 1.96% in Franklin, that is 33% better than average. It would be pretty hard for a candidate who got 50% statewide to get 33% better (67%) in any county.
Now switch to just the R, D, and I candidates in Maine. Switch off either King or Summers, and Aroostook suddenly goes blue. King was weakest in Aroostook (the further you got from Portland, the more conventional partisanship prevailed). In a D vs. R race, Aroostook is more Democratic than the state. In a R vs I, or D. vs I, it is less King-favorable. In a D-R-I race the R strength hides the D strength.
So it must generating a color scale for each candidate based on the relative strength in a county vs statewide strength.
color = function(county%/state%)
And then adding the colors together.
Scaling is tricky here.