FiveThirtyEight in conjunction with Facebook recently released a map of Facebook likes for presidential candidates by county.   It’s interesting data, and gives a relatively high resolution map of where candidate loyalties lie.  Although it’s clearly not a random sample of likely voters it can be used to fill in some of the gaps of traditional polling.

Here I attempt to use this data to get an idea of what the electoral college could look like under different candidate matchups.  The assumption I use is that the election will be a close race, with essentially 50% popular vote for each candidate.  Facebook likes are going to be a biased sample of the voting population, but we can adjust for some of that bias by looking only at the candidates performance in a state relative to their national average.  I assume each candidate remains popular in states they are already popular in, then assign each state to the candidate that has the strongest relative support in that state.

There is some danger of reading too much into this data. I’m under no pretenses that this will be a full prediction of how the states will vote on November 8th. The number of likes at this stage in the primary will not match fully with the number of votes in a general election eight months from now.   I expect the effect of partisan voters lining up behind their party’s nominee will make the final electoral map appear like an average of these maps and historical swing state maps.   So solidly Republican states like Alaska will likely ultimately remain red, even if Trump is unpopular there.  Additionally there are likely large biases still remaining in the data – for instance, if Hispanic voters are less likely to use Facebook, are these maps accurate for those states with large Hispanic populations?  Still I do believe there is a value in this data, in showing states and regions where a candidate will be surprisingly competitive. This can be seen as a rough prediction of tipping point states, which can be seen to vary dependent on the candidate matchup. I expect the political campaigns are looking at their own versions of similar maps as they chose where best to spend their resources.  Enjoy!

Sanders vs Trump


Click the map to create your own at 270toWin.com

Advantage Trump. This means Trump would win the electoral college if the popular vote were tied (which it may not be).  In a more lopsided election, the candidate with the higher popular vote would win.

This map is the most interesting because it shows a matchup between two very unconventional candidates. Trump is a political outsider and not consistantly a Republican, while Bernie spent his Senate career as an Independent. Both candidates appeal to voters outside of their traditional party bases. Trump’s main advantage geographically is his strong support in Democratic mid-Atlantic states. Trump is very weak in the West overall, allowing him to lose the traditional Republican strongholds of Alaska and Utah in this model. Unfortunately for Sanders many of these Western states he performs well in are not worth that many points. Bernie’s current weakness with black voters means he is not able to penetrate into the South to bring states like North Carolina and Virginia into play. Bernie performs well in states near Vermont, but loses some key high value states.  It may not be a coincidence that Trump does well in the casino and resort states of Nevada, New Jersey and Florida.

Sanders vs Cruz


Click the map to create your own at 270toWin.com

Advantage Cruz.

Cruz generally performs very well in traditional Republican states and the south, leaving the battle to be fought primarily in standard swing states. In all of the matchups I look at Republicans have the advantage in Florida, a key high-value swing state. Bernie’s lack of competitiveness in North Carolina and Virginia means he starts at a disadvantage in swing states.  Sanders holds the Northeast but is unable to pry away states in the midwest and loses some crucial swing states.

You’ll notice Montana is colored a lighter shade of blue. Since I’m relying not on the raw Facebook data, but on rounded data from the fivethirtyeight website, for some states it’s difficult to tell which candidate has the advantage. For that reason I don’t attempt to predict the margin of victory for each candidate. Montana is a state that appears to lean towards Bernie, but is within my margin of error so is colored a lighter shade. Candidates which have lower overall numbers of Facebook likes have a larger margin of error. Since Bernie and Trump are the most popular on Facebook, their map is the most accurate. I also generated a Clinton- Bush map, but the accuracy was too poor to predict states accurately due to Bush’s relative unpopularity on Facebook.

Sanders vs Rubio


Click the map to create your own at 270toWin.com

Advantage Sanders.

Republicans seem to be losing their grip on certain Western states, and Sanders is well positioned to take advantage of this.  Sanders comes out ahead due to strength along Rocky Mountain states and the NorthEast.  Marco Rubio’s support falls mainly in traditional Republican states in the South, with potential to secure states with large Hispanic populations like Arizona and Florida.  Rubio captures the south but doesn’t expand the map to put any traditional Democratic states on the table.

Clinton vs Trump


Click the map to create your own at 270toWin.com

Advantage Clinton.

This is a very close map.  Trump is actually more popular then Clinton in Bernie territory of New Hampshire and Maine. He also tends to do very strongly in mid-Atlantic states. Clinton served as senator in New York, and it appears this gives her the advantage necessary to keep Trump from stealing New Jersey. Clinton pulls out ahead in this scenario only by managing to win Texas.  For years there has been talk of Texas potentially becoming a swing state. This scenario shows Clinton actually contesting this large prize due to the difference in support between her and Trump in towns along the border.

Clinton vs Cruz


Click the map to create your own at 270toWin.com

Advantage Clinton.

This is the most conventional map. Each candidate represents the core of their party, with Clinton as the establishment Democratic candidate and Cruz as the self-appointed king of the Tea Party (the new Republican establishment). It is not surprising that the map follows traditional swing state boundaries, which I see as a vindication of this method. The only slight surprise here is Ted Cruz winning New Mexico. However there’s some possibility that New Mexico, with Hispanics making up 40% of the voting population, may not be modeled as well as other states by the Facebook data. While Ted Cruz solidly holds on to all areas of Republican territory, including the Western states that Trump and Rubio are weaker in, he fails to show much appeal outside these regions.  Cruz appears to have zero appeal in the Northeast and is generally outperformed by Clinton in most swing states.  Clinton wins by sticking to traditional Obama Democrat and swing states, staying competitive in Virginia.

Clinton vs Rubio


Click the map to create your own at 270toWin.com

Advantage Rubio.

This map is also fairly traditional, as an election between the two establishment party picks. Rubio does well in all traditional Republican states, and is able to deliver the South, while remaining competitive in traditional swing states. He is seen as winning New Mexico and keeping Clinton from making inroads into Virginia.  This is consistant with the perception that Rubio nullifies some of Clinton’s advantage among minority voters. Likewise, Clinton is able to hold the Northeast but not expand heavily into new territory in the West or win key swing states.  A slight bump is seen in Arkansas, home of the Clintons, but she is not anticipated to win the state.

General Conclusions

It would appear that Republicans have the electoral college advantage in North Carolina, Florida and Ohio this year, making a collection of smaller states crucial to determining the outcome of a close election.   For Clinton the path to victory is very similar to Obama’s 2012 path.   However if either Trump or Sanders are in the general election, the map changes considerably.  Trump’s areas of strength seem to be locations were his businesses have a presence.  The states where he received the most google searches between 2004 and 2014 match closely with the states he is shown as leading.

Neat things my Amiibo can do

Posted: January 12, 2015 in Uncategorized

I recently bought a Yoshi Amiibo for Super Smash Bros for Wii U. It’s a figurine with a chip inside of it that can be used to store a somewhat customizable computer character. I didn’t really expect much but it looked like a fun little toy. A Nintendo PR person had claimed that the toys would learn based on your play style, such that if you never played with items your Amiibo wouldn’t either. I suspected that it was mostly PR speak, and that the Yoshi would simply upgrade from a preset level 1 AI to a preset level 50 AI. It turns out there is some truth to it.

By the time my Yoshi reached level 50 it was winning most party matches. It particularly favored the egg throw technique. I used to play as Yoshi on the N64 so I decided to go one on one against it, Final Destination, no items. I narrowly beat it, but on subsequent matches I was unable to repeat the trick. It appeared my Yoshi was learning.

My personal play style involves a lot of aerial attacks. I noticed the Yoshi had become very skilled at throwing eggs, and was effectively countering my ability to approach him from the sky (especially since I was lousy at doing aerial dodges on the Wii U controller). I was only really able to get many hits in by remaining on the ground.

By switching to Jigglypuff and luring him off the edge of the stage I was able to teach him how to edge guard. At first he was hesitant to jump off the stage, but eventually he began chasing me and using his down A or down spike moves. He didn’t connect too often, but he learned to perform the attack and make it back to the stage with decent consistency. At any rate he was better at spiking off stage than I was. He also seemed to have perfected the art of protecting his landings by throwing eggs at the edge of the stage.

Since I was playing Jigglypuff anyways I tried training on some of her moves. Yoshi was definitely able to learn character-specific moves. When I used the lullaby he would flash his shield on and off to protect himself while minimizing the drain of the shield’s charge. He quickly learned to dodge when I activated Jigglypuff’s over-B punch, although this would sometimes leave him vulnerable to her Rest attack. Although I believe he was adapting I was still able to connect these two attacks with enough effort. Amusingly he never seemed to realize I was completely vulnerable while sleeping.

Next I tried training him with mines only. He almost immediately realized that he should jump over instead of walking on mines, but had difficulty avoiding them altogether. Extensive mine training left him still unable to avoid rolling, dodging or jumping into mines.    He was easily lured into mines and it appeared that this training was useful only for making myself feel better about my inability to beat him in a fair fight.

All of this time spent on Final Destination seemed to have confused him when he arrived at Hyrule Temple. His egg throws were not nearly as effective with impenetrable walls, and he kept erratically leaving the fight to seek out some seemingly arbitrary location on the battlefield. The level 9 computers sought each other out, but he was content wandering about the stage, resulting in a victory with around 30 out of 99 lives left.

It seemed to me that Yoshi’s technique in close quarters combat was rather weak so I started pitching him against heavy hitters on small stages.   Eventually he wound up on Final Destination in a 99 stock against Ganondorf.  He clearly learned to read Ganondorf’s moves and could duck or dodge out of range with ease.  He won, but didn’t dominate.

After the match I rechallenged him as Yoshi.   It was clear that such a long time fighting only Ganondorf had affected his ability to combat other opponents, and he’d probably gotten a little too familiar with the idiosyncrasies of the opposing AI.   It wasn’t clear what he was trying to do, but it wasn’t very effective.   Fighting Ganondorf had probably forced him into a more counter-based technique, and he wasn’t able to read my moves as easily.    I beat him with 2 of 5 lives remaining – unheard of.

After putting him in a quick melee against other computers, I tried fighting him again.  He seemed back to his old egg-throwing self.  He was even able to snatch me out of the air with his tongue while I was mid ground-pound.  Unfortunately he seemed to have largely forgotten his Jigglypuff training.  It seems the AI is quite adept at learning to master a specific combat niche but has limited memory and will gradually overwrite older training as it enters a new environment.

The solar industry has been booming in recent years, but solar energy still represents only a tiny fraction of the United State’s energy supply. As a new way of visualizing the installed capacity of solar and other renewable energies in the United States I decided to compare our total energy production by source with the total energy consumption of various countries.    Note that this is different from the electricity consumption by each country, but instead attempts to account for the total energy consumed from all sources.

One surprising finding was that we have enough wind turbine capacity to provide for all of the energy needs of a country the size of Portugal.    We also have enough total renewable energy production to bring the United Kingdom fully green.  Check below for the full results.

The data I used is from the US Energy Information Administration. The US production data is for the latest year 2011, while for consumption I had to rely on slightly older 2009 data, but the numbers should still be fairly accurate.

Total Energy Consumption by Country: International Energy Statistics – Total Energy

US Energy Production by Source: Monthly Energy Report (Table 1.2)

I thought one way to see what values and concepts are most important to each of the presidential candidates is to see what they talk about the most.
I’ve seen this done with individual speeches before, but I wanted to accumulate a collection of speeches across the course of the candidates’ campaigns to see which ideas keep coming up.

For President Obama, whitehouse.gov has a collection of every public statement he’s made during his years in office. It’s a massive amount of data, but I’d like to compile it all into a single word cloud. So far I’m through about 1 year’s worth.
Other candidates don’t have as complete of a record, so I’m focusing on simply collecting their full speeches off of various websites. Since most candidates have 10 or fewer full speeches available online, I’m avoiding interviews and Q&A for the Republican candidates to avoid biasing the results too much with the opinions of the reporters.

What you see for the Republican candidates then is an illustration of their political platform as shaped by themselves through their major campaign speeches. There are clear differences in the emphasis of the different candidates.

Obama’s word cloud, by contrast is not nearly as controlled, since it amasses every statement he’s made over the vast array of issues a president must deal with. This includes major speeches, welcoming of award winners, meetings with foreign heads of state, townhalls and press briefings. As a result, Obama’s cloud becomes more broad and vague. Individual issues such as Iran are drowned out by the core repeating values and principles of his presidency as well as certain speech mannerisms. It’s interesting to study, and the overall shape of the cloud is something much less easily manipulated than that seen by the other candidates. A cloud of his campaign speeches or state of the union addresses would probably be more similar to those of the Republican candidates, but this shows more where his true core focus lies.

Rick Santorum
Wordle: Rick Santorum Speeches
Newt Gingrich
Wordle: Newt Gingrich Speeches
Mitt Romney
Wordle: Mitt Romney's Speeches
Rick Perry
Wordle: Rick Perry Speeches
Ron Paul
Wordle: Ron Paul Speeches
John Huntsman
Wordle: John Huntsman Speeches
Herman Cain
Wordle: Herman Cain Speeches
Michelle Bachmann
Wordle: Michelle Bachmann Speeches
Obama
Wordle: Obama 2011 statements

English: veggies

Image via Wikipedia

Some inventions are truly great, yet rarely find their ways into the history books.   Sliced bread awards are one way of giving tribute to these often under-appreciated inventions.

One such commonplace invention is the thunder noise commonly found in grocery produce departments.

Grocery stores typically spray vegetables in their produce department with water to keep them looking fresh and moist.   Originally employees would do this manually with hoses, but most large chains have switched to automatic sprinkler or mister systems.   Over-spraying vegetables can result in soggy vegetables and sometimes even rot, but many stores have refined the system to apply the appropriate amount of moisture to each category of produce.   Another problem with these automatic mister systems was that they could sometimes catch the shopper unawares, resulting in a wet consumer.    Some grocery stores employed warning systems, such as a simple bell noise to alert the shopper.    A few would play the song “Singing in the Rain”.    The best system however uses the sound of distant thunder to warn the shopper of the oncoming rainstorm.    It’s simple, elegant and gets the point across.    Many modern Safeways implement this warning system quite nicely and have tweaked the sound effect to be soothing rather than frightening.    It’s difficult to find the origins of this invention, since most historians haven’t payed it much attention, but the Kroger chain seems to have been an early adopter, using the thunder effects since at least the early 90’s.

Not everyone’s supermarket may yet have these systems, but I find them thoroughly enjoyable.   Kudos to the inventor!

The Greatest Thing

Posted: December 12, 2011 in Sliced Bread
Sliced bread

Image via Wikipedia

Sliced bread is the standard by which all other inventions are based. The phrase “the greatest thing since sliced bread” was referred to by the Kansas City Star as the “ultimate depiction of innovative achievement and American know-how”.    How did such a wonderful invention come to be?  I refer you to their article for the full history, but here’s a short overview.    The machine was invented and sold by Otto Frederick Rohwedder in 1928.    It was initially used by local bakeries, which touted it as “The Greatest Forward Step in the Baking Industry Since Bread was Wrapped”.    In the 1930’s a sliced version of “Wonder Bread” was sold nationally for the first time.   The same Continental Baking company was responsible for the Twinkie and eventually became Hostess Brands.

Consumers were initially skeptical of the advantages of buying pre-sliced bread due to concerns over the ability of the bread to remain fresh.   Advertising campaigns, small amounts of convenience and probably eventually preservatives seemed to overcome these fears.   The bread was sliced much more perfectly than anyone could manage by hand.     Interestingly enough, the invention of the pop-up toaster actually predated that of pre-sliced bread.    It seems anyone could understand the appeal of the toaster even if they didn’t have perfectly sliced bread.

Otto Rohwedder doesn’t appear in a lot of history books, but small smart inventions like his do impact a lot of peoples’ lives.    I plan to give tribute to some of these inventions and their inventors through a series of “Sliced Bread” posts.

Names

Posted: December 6, 2011 in Uncategorized

The current #1 baby names are Isabella and Jacob.  Surprise!  Although the name Isabella had been gaining in popularity for the past decade, it spiked in 2005 with the release of the first Twilight book, and again in 2008 with the movie adaptation.   Jacob, which had already peaked in popularity in 1998 saw a similar uptick in popularity.    Edward, which has traditionally been a more common name, was not greatly affected by the release of the popular vampire franchise.

Patterns in baby name trends are interesting to watch.   Most parents don’t choose to invent their own name, but chose an existing name which suites their modern taste.   At the same time, many seem to want a more unique name for their child, so pick a slightly exotic name that is not in too widespread of usage.   This results in interesting naming fads where a name which is perceived as rare will suddenly burst into popularity only to quickly fade out once it becomes too mainstream.    These names will probably not die out completely however, since people tend to borrow names for their children from respected others, either from history, pop culture, or people that they know personally.    The bible is always a good place to go digging for names, and fuels recent popular names like Noah, Elijah and Jonah.

Pop culture names are relatively easy to track, and popular characters with relatively unusual names can make a big impact on the baby naming consciousness.   The name Trinity appeared out of nowhere after the release of the 1999 film The Matrix.  Harry Potter star Emma Watson may have helped boost her name’s popularity in recent years.  Other characters may have helped extinguish certain decent names by being too strongly associated.  Kermit was essentially dead as a name for humans by 1980, and Zelda is too strongly associated with video games for anyone other than Robin Williams’ daughter.    Ursula lost all hope of a comeback with the release of “The Little Mermaid”, but the same film boosted the name Ariel and may have helped Sebastian into legitimacy.    Some names, like Stella, are able to get their groove back by building from an established aging population.   Others, like most names containing the letter “U” are simply out of tune with modern taste.   Since character names are chosen similarly to baby names, they sometimes serve merely to accelerate names that were already gaining in popularity.   The name Luke exploded at the time of the 1977 release of Star Wars.  It’s unclear which movie was responsible, but the name Angelina skyrocketed concurrently with Angelina Jolie’s Hollywood debut.   Actress Reese Witherspoon singlehandedly brought her name out of obscurity in 1999.  Mariah Carey did similarly with a strong debut album in 1990.  The frequency of the name Elvis spiked following the singer’s debut around 1955, and again with his death in 1977.  Kierah saw a bounce after Knightley’s roles in Bend it Like Bekham and Pirates of the Caribbean.   The name Miley was essentially created in 2006 by the popularity of the Hannah Montanna star.   Likewise Xander appeared due to Buffy the vampire slayer in 1997, but neither name became too widespread.  Some names aren’t so lucky.  The name Katrina probably isn’t coming back for a while, after it was finished off by the 2005 Hurricane.

What names may the future hold?   I’d guess Justin Bieber might give an uptick to the declining Justin, although male names seem less clearly affected by pop culture and his target audience may still be a little young to bear children.    Here’s a long shot: Isaiah, as in Isaiah “Old Spice Man” Mustafa.