Thursday, May 21, 2015

The Unbearable Memorylessness of Being

Life is hard for pigeons. In ideal conditions, they can live about 35 years. But in the wild, pigeons die all the dang time. Between being eaten by hawks (or tortoises or pelicans or people or freaking catfish), hit by carsgetting sealed up in air ducts, and other grizzly fates that are likely to make the entire pigeon population turn on us in Hitchcockian retribution in short order, the average lifespan of a pigeon in the wild is about 6 years.

 
I think they're planning something.

Come, friend. Take a walk with me. Look at that random pigeon over there. How long do you expect it to live?

You know nothing of the pigeon's current age or lifestyle or the fact that he engages in maddening debauchery and pizza-eating binges on the regular. You are also not a fortune telling witch. Having nothing else to go on, you assume this is just an average pigeon, and you guess 6 years.

Quite right, my chum. I applaud your reasonable guesswork. But lo!---upon closer inspection, I realize that I do know this pigeon. His name is David Hasselhoff, no relation, and he's 4 years old. I tell you this, and ask you again. How long do you expect this bird to live? The Knight Rider cocks his head, eager to hear what you have to say.

Should this new information influence your response? On the one hand, if The Hoff was expected to live for 6 years and has already wasted 4 of them on pizza and hookers, it's reasonable to guess he's only got 2 years of wanton revelry left in him. So if you were to give that as your answer, I would not disparage you. But on the other hand---and it's always the other hand that holds the correct answer---is the correct answer. Which is 6. And here's why, amiga.

Let's assume that in any given month, a pigeon dies with probability 1/72 (where a probability of 0 means "definitely not happening" and a probability of 1 means "definitely happening"). We're choosing this number because there's a handy fact from probability theory that if an experiment has some probability p>0 of success and 1-p of failure each time (independently of previous experiments) and you repeat this experiment until your first success, it will take 1/p repetitions on average. In our case, our convenient choice of 1/72 tells us that if a pigeon will die with this independent probability of 1/72 each month, it should take 72 months (6 years) on average for the bird to die. By the way, this means that the time until the bird's death is something called a geometric random variable (more on random variables later).

We're making some simplifications here where we assume David Hasselhoff isn't learning anything from his hard times on the streets* (which could make him less likely to die in a future month) and he's not getting any more decrepit (which could make him more likely to die in a future month), but these are pretty reasonable: the first assumption probably makes a negligible change (though pigeons are pretty smart, so I dunno), and the second is consistent with the fact that the time until natural death is so much longer. We're also only interested in the month in which he dies, not the exact moment. If we were willing to consider time as a continuous thing, the situation would work the same way, but stuff would be harder to compute. More on this later, too.

Okay, so in our case the experiment is seeing whether the bird is alive or dead after a given month, the "success" is death, and the "failure" is life because that's the kind of people we are. The situation is that 48 months (4 years) have passed without a success. So here we are, asking how long it should take from now to see a success in this ghoulish bird experiment. We know that the next month will result in death with probability 1/72, and the month after that, and the month after that, and so on. So we're once again in the situation of looking at a geometric random variable ("time until Hoff-death") with probability of success equal to 1/72 at each month, which our handy fact tells us translates to having to wait 72 (more) months on average until the Hoff is successfully dead. The stuff that's already happened is irrelevant. That's because time-until-pigeon-demise is memoryless.



The Memoryless Property 

This is a pretty cool property for a thing to have, in an X-Men Origins Wolverine II: Memorylessness kind of way. In the pigeon context, the property says:

The probability that the pigeon lives for at least 6 more years given that he's already lived for 4 years is exactly the same as the probability that the pigeon lives for at least 6 years.

Here's how this looks in math terms. Let's let X be the age, in years, at which a pigeon dies. X is a random variable: i.e. a variable which takes on a value to be determined by some experiment. In your case, the experiment consists of you watching a pigeon and noting down its age when it dies, you grim bastard. The notation P(X ≥ 10) is going to stand for the quantity "the probability that X is at least 10." Expanding on this a little, we have the notation P(X ≥ 10 | X ≥ 4), which is "the probability that X is at least 10 given that X is known to be at least 4." Therefore the statement above, in this notation, looks like

P(X ≥ 10 | X ≥ 4) = P(X ≥ 6).

Stating this in a pigeonless context, a random variable X that takes on nonnegative values (i.e. only values that are at least zero) has the memoryless property precisely if no matter what nonnegative numbers s and t we pick, we have that the probability that X will be bigger than s+t---given that it's known to be bigger than t---is the same as the probability that X is bigger than s (given no prior information). In our new notation: 

P(X > s+t | X > t) = P(X > s) for any choice of s and t. 

It's kind of important to note that in order to talk about things without too much complicated stuff, we didn't treat our random variables as continuous (by just looking at the discrete years or months as options for when The Hoff could die instead of considering the full spectrum of time). In the discrete case we were considering, all random variables that are memoryless are geometric random variables. In the continuous setting, they're called exponential random variables, and computing this stuff requires a bit of calculus.

The Memorylessness of Things

There are lots of memoryless things, besides drunk David Hasselhoff. The time until a person who plays the lottery every month finally hits the jackpot, the distance between consecutive roadkill schmears on a highway, the time until your phone rings, the barometric formula (which measures change in air pressure with different altitude changes), how many randomly chosen people you have to interview until you find one that would make an adequate sacrifice to the pigeon horde, or how many Game of Thrones episodes we have to wait until we see one where Melisandre doesn't try to seduce anyone are all examples.




Let's look at home runs in baseball. David Ortiz's home run percentage is around 5.2% =13/250. Making the (not entirely unreasonable) assumption that each time he hits the ball, he's got an independent probability of 13/250 of hitting a home run, this tells us that on average he hits a home run every 250/13 ≈ 19 times he's at bat. So if Big Papi has gone 18 at bats without a home run, it's natural to feel that he's "due." But if he's really got a 13/250 chance of hitting a home run every time, his recent lack of homers doesn't make him any more likely to get one now.

A more intuitive example is coin flips. With a fair coin, you'll flip heads with probability 1/2 and tails with probability 1/2, every time, regardless of the past. The average number of flips until you see a head for the first time is therefore 2. That is, if you've gone 1, 2, 10, or 100,000 flips without ever having seen a head, you still have to wait on average 2 more flips before you see one. Of course, if you've actually gotten 100,000 tails in a row, there's a pretty good chance that someone's screwing with you, because the probability of this with a fair coin is around 10-30103. (Fun fact: for a frame of reference on how minuscule that is, there are about 1080 atoms in the known, observable universe, so the probability of flipping 100,000 tails in a row is about 1030023 times less likely than picking a particular one of the universe's atoms out at random. I don't know what the name for the number 1030023 is, but I did just learn that 103003 is called a millillion and 103000003 is a milli-millillion, and that seems like a good thing to know.) Then again, you just flipped a coin 100,000 times in a row, so you're probably beyond caring about atoms and millillions.




* But would a bird that's learned nothing go on to reboot its own bizarre public image to make a preemptively successful self-parodying reality show about himself or this pretty much fully perfect music video? Unlikely.