Loot Boxes, Sparse Markov, and Decimal Networks

Once again we are back with Markov Chains inspired by a reddit thread! We’ll answer the question: “When’s the best time to switch loot box opening strategies?”

In this post we’ll go over:

  1. Setting up a large, sparse Markov Chain
  2. The perils of analyzing it with python’s built-in floating point capabilities
  3. Comparing simulation to Markov Chains
  4. Using NetworkX and decimal.Decimal to run a Markov Chain with very very very small probabilities

Let’s get to it!

Continue reading →

Advertisements

Estimating the Cost of Education

I saw a post circulating Facebook that sardonically addressed some ‘real’ comments from Facebook about teacher salaries. That post, “Are you sick of highly-paid teachers?“, comes to the conclusion:

$1.42 per hour per student — a very inexpensive baby-sitter and they even EDUCATE your kids!

This doesn’t seem realistic at first glance, nor does it account for all the other factors that go into employing a person. Let’s be a bit more rigorous and understand the problem from the numbers side.

Continue reading →

Falling Through the Earth (and Mars)

Recently, on Reddit (of course), someone posted a video talking about how long it would take to fall straight through the center of the earth to the other side. One of the nice parts of the video is that it shows you what the time would be when we account for the actual, non-uniform density of the earth. The video just showed an Excel sheet, though.

I recommend you watch the linked video so you have a good visual of the problem. Once you’ve done that, come on back! In this post I’m going to show you how to solve the problem using Python and a numerical integrator from SciPy.

Continue reading →

Powerball Nears Best EV (Updated)

This is a quick post that is the exact same as the Mega Millions post I did. I break down the Powerball odds, use some sales data, and look at the EV over various jackpots.

The quick takeaway, as the Powerball is up to $450 million for Wednesday, is that either this drawing (or the next if no one wins) is as near to the possible expected value for this lottery. The other takeaway? Don’t buy lottery tickets!

UPDATE: Going back I found an error in my code. I’ll update it at some point, but for now, take it with a grain of salt (except the historical data part, that part was fine).

Continue reading →

Mega Millions, Multiple Winners, and Expectations

The Mega Millions lottery is a popular number-picking lottery game in the US. It exists in 45 states (including D.C.), and is played by millions of people every week. Lotteries are well known for having negative expected values, meaning that players lose (on average) more than they win. This should be expected, given that lotteries (and gambling in general) are profit-seeking enterprises.

The potentially large jackpots of Mega Millions (the jackpot is pari-mutuel) can push the game into a region of positive EV, though. This is counter-balanced by the fact that duplicate tickets will result in splitting the winnings equally among the winners, driving down the available EV. This post explores what kind of impact that has on the game. Continue reading →

Non-Uniform Coupon Collector’s Problem

The Coupon Collector’s Problem is a neat little problem in probability, and I first heard about it recently on the statistics subreddit. You, like me, might be familiar with it if you’ve ever tried to solve the expected number of boxes of cereal to buy to get all the toys. Not that I have that problem right now, but it shows up on probability quizzes and the like.

The problem’s solution hinges on two things. One, there is replacement (sampling from a seemingly infinite population of items that are in some proportion). Two, all items are equally likely. What happens when they aren’t equally likely? We turn back to Absorbing Markov Chains (AMC), because apparently that has to be 50% of what I talk about on here!

Continue reading →