FiveThirtyEight

The social contract of Halloween is simple: Provide adequate treats to costumed masses, or be prepared for late-night tricks from those dissatisfied with your offer. To help you avoid that type of vengeance, and to help you make good decisions at the supermarket this weekend, we wanted to figure out what Halloween candy people most prefer. So we devised an experiment: Pit dozens of fun-sized candy varietals against one another, and let the wisdom of the crowd decide which one was best.

While we don’t know who exactly voted, we do know this: 8,371 different IP addresses voted on about 269,000 randomly generated matchups. So, not a scientific survey or anything, but a good sample of what candy people like. And here’s what they said:

How often did a fun-sized candy of a given type win its matchups against the rest of the field?

Reese’s Peanut Butter Cups and their spinoffs come out huge here, taking four of the top 10 spots and appearing pretty synonymous with the platonic ideal of Halloween candy. The brand was the best-selling candy in the U.S. as of 2013, and market research showed it was the top snack-sized candy in Halloween times.

But what made some candies more desirable than others? Was it price? Maybe it was just sugar content? Nah, neither really. I pulled fun-sized portion sugar content from a series of dieting websites (FatSecret, MyFitnessPal), and in cases of particularly hard-to-find candies, I just went to the nearby drugstore. I pulled bulk prices from Candy Warehouse. After a spooooky regression with a truly hellish r-squared, there’s no evident link here between price, sugar and perceived quality.

So if it’s not price or sugar, there must be something about what’s in the candies that make some better and some worse. With the fervency of a stay-at-home dad who recently learned of a child’s mild peanut allergy, I scoured the internet for descriptive ingredient data about all the candies in our data set. Were they chocolate? Did they contain peanuts or almonds? How about crisped rice or other biscuit-esque component, like a Kit Kat or malted milk ball? Was it fruit flavored? Was it made of hard candy, like a lollipop or a strawberry bon bon? Was there nougat? What even is nougat? I know I like nougat, but I still have remotely no clue what the damn thing is.

With a full typology in hand and access to some of the most powerful statistical software available on the market, my questions were answered.

That’s a lot to take in! In general, here’s what this information says. According to the regression, about half the variance observed in the quality can be explained by these nine properties of candy, which isn’t great but also isn’t awful — and is thus enough for us to work with.

A Halloween candy that has none of those ingredient components would be expected, as a baseline, to win a matchup about 35 percent of the time. Sure enough, this bears out in our data: For giggles we also put in “one dime” and “one quarter” to see how desirable they were, and the dime — which is neither chocolaty, nor fruity, nor full of caramel, peanuts, wafers, et cetera — beat 32 percent of competitors, and the quarter beat 46 percent.

The table adjacent to this paragraph simplifies that “coef.” column. If a hypothetical candy had chocolate in it, we’d expect its win percentage to rise by about 20 points. If it’s fruity, we’d expect it to rise by 10. If it had nuts, we’d also expect its win percentage to rise by 10, with wafers or crisped rice rising by 9. And nougat and caramel don’t bring a ton to the table. A candy being hard — like a lollipop or jawbreaker — actually knocks about 5 points off its win percentage. Whether it’s in bar form or a bunch of little candies makes no major difference.

Note that a candy can be one or two or all of these things: A Snickers is a chocolate (+20), peanut (+10), caramel (+3), nougat (+2) candy that we’d expect to have in the ballpark of a 70 percent win rate, and it does in fact have a 77 percent win rate.

Which brings up an obvious question: Can we build the perfect Frankencandy based on this information?

On one hand, no, that’s a ridiculous oversimplification of a somewhat scientific process and is likely to result only in an abomination.

On the other hand, that exact ethical dilemma did not stop Dr. Frankenstein, and ’tis the season!

We’ve got to have chocolate — the win percentage of contenders containing chocolate was about 11 points higher than the average contender and 19 points higher than contenders that did not have chocolate. The same goes for both crispiness and nuttiness: Entrants with peanuts or almonds had win percentages about 13 points higher than the average contender, and ones with crispy wafers or puffed rice were nearly 16 points higher than average. Nougat and caramel are net positives for sure, so throw them in.

Now we get to some major qualitative components. Candies in bar form generally had a higher overall win rate than those in pieces, so we’ll want a bar. Yes, fruitiness can be fine, but things that had a fruity taste had a win percentage 11 points lower than those that did not. This is due to the near mutual exclusivity of fruity flavors and chocolate, with Tootsie Pops being the sole exception.

So, in the end, the best Frankencandy has the chocolate of a Hershey bar, the nougat of a Baby Ruth, the caramel of a Milky Way, the peanut butter of a Reese’s Cup and the wafer of a Twix, and it’s assembled in a castle looming over an Eastern European village. Or if you’re trying to make this at home: Maybe take a Twix bar and smush it on a PayDay, or roll a Snickers around in rice crispies.

Call me what you will — the modern Prometheus, a contemporary, pre-diabetic Frankenstein — but I think I have the next big idea in Halloween candy. So what I’m trying to say is, yes, Mr. Wonka, I am available to consult if you’re interested in entering the abomination business.