Comics #493 and #893 involve actuarial tables, which are tables for calculating the probability that someone of a given age will die within a given amount of time.

One evening, when I was feeling morbid, I wrote a Python script to calculate death probabilities for any collection of people: actuary.py (.txt). It takes a list of ages and genders and produces various statistics. Here’s the report for the nine living people who have walked on the moon:

~$ python actuary.py 81m 82m 80m 81m 80m 81m 76m 78m 77m
There is a 5% chance of someone dying within 0.08 years (by 2012).
There is a 50% chance of someone dying within 1.1 years (by 2013).
There is a 95% chance of someone dying within 4.08 years (by 2016).
There is a 5% chance of everyone dying within 10.78 years (by 2023).
There is a 50% chance of everyone dying within 16.12 years (by 2028).
There is a 95% chance of everyone dying within 22.57 years (by 2035).
Probability of all dying in 1.0 year: <0.001%
Probability of a death within 1.0 year: 46.32%

And here’s the table for four of the main stars of the original Star Wars (Harrison Ford, Carrie Fisher, Mark Hammill, James Earl Jones):

~$ python actuary.py 69m 55f 60m 81m 10
There is a 5% chance of someone dying within 0.42 years (by 2012).
There is a 50% chance of someone dying within 4.74 years (by 2017).
There is a 95% chance of someone dying within 12.83 years (by 2025).
There is a 5% chance of everyone dying within 18.17 years (by 2030).
There is a 50% chance of everyone dying within 31.28 years (by 2043).
There is a 95% chance of everyone dying within 42.62 years (by 2055).
Probability of all dying in 10.0 years: 0.272%
Probability of a death within 10.0 years: 85.94%

Of course, these are based on average death rates based only on age and gender. Adding more specific information about the people in question will refine the calculation. For example, I’d guess former astronauts are more likely to be in good health—and have longer life expectancies—than the rest of us.

### Like this:

Like Loading...

*Related*

I hate you right now, unless…. you show the entire comic from today non of this click and drag stuff, I’ve been through A LOT of it, but I feel like there’s just way more that I’m missing, please help me fill in those spots! (or I’ll never forgive you, but I’ll still read your comic, because that non-negotiable!)

I’m emailing you too just in case!

LikeLike

I can’t reach the forums at the moment. So let me use the comment function to say: I really like this one a lot.

For those who didnt bother to figure it out themselves:

1. There are at least 83 Tiles and each has a resolution of 2048×2048

I think there may be a lot more tiles.

2. If a tile is missing, the javascript code inserts black (for tiles below ground level) or white (for tiles above ground level) space.

3. There is a balloon right above the starting location (5-6 tiles up).

4. There is a system of caves 14 tiles below ground level at starting location.

5. There are some very pretty boats a few tiles to the west.

Randall, would you allow me to use an automated grabber to grab the whole picture?

LikeLike

I want to share with you a math riddle app that i found:

https://play.google.com/store/apps/details?id=carmon.apps.four4s.puzzle

The task is to create a given number

by up to 4 digits of 4.

LikeLike

Click and drag is just fantastic. It so much more than a comic. I’m just stunned and speechless how something so “simple” can create such a powerful effect and impact. I guess that is the definition of art.

Thank you. Really.

LikeLike

Love the latest comic ‘click & drag’. It reminds me of Terraria, which is a sort of 2D side scrolling Minecraft. I can’t wait to get it open on my desktop with a bigger display and a mouse instead of this tiny netbook trackpad, and do some exploring. Thanks as always for sharing your musings with us :)

LikeLike

my head…

randall, you are a mad genius and i should make a bow if anytime see you in the streets =)

please please please make a poster of click and drag, or at least give us the tiles, i promise to print all of them and hang on my wall (trees of the world, forgiveme in advance)

there is a term for “fear of if didn’t obsessivelycheck all the spaces i might end up missing something cool” ? i think this comic needs that term =)

cheers!

LikeLike

Oh my goodness! 1110 is your masterpiece, maybe. Gulp. I think I have wandered through most of it, veRy carefuLLy backing up through the paths underground, but who knows without piecing it aLL together. I did see the giant jellyfish floating in mid-air, and I made it to the submarine at what I think is the lowest depth. I love the triple Lemonade? I told my wife that I would have added a fourth lemonade ahead of the group of three. She was azamed and amazed like me. It was a little more tedious on my iPad versus the PC. Carpel tunneling ….

LikeLike

Hey! I don’t write comments usually, but this one time I just had to drop by and tell you what an unbelievable, stunning, wonderfull piece of art you made there!

Keep up the great work, it’s highly apreciated :).

Greetings

Joerg

LikeLike

THE WALLS WORN SMOOTH BY BILLIONS OF TUMBLING MARIO CORPSES!

And my broken mouse, a quaint friend who after a good 30 minutes of clicking and dragging expired. Alas to Walmart I go for an affordable poor quality mouse. :(

Thank you. <3

LikeLike

“Carpel Diem!”

And so but no, seriously, a truly wonderful adventure to savor and repeat, although the poster – please please please say there’s going to be a poster – would be way cool as well. As good as anything Kara Walker does, and she is amazing. Seriously, this should be hung in its entirety in MOMA.

LikeLike

Please, please, please, please make #1100 available to view in full and as a poster!! I’ve looked at quite a lot of it, but I KNOW I’ll have missed something. Please??

LikeLike

Why are 1111 combinations all black or all white? There will be comic 1111, right?

LikeLike

what a bunch of tards

LikeLike

Click and Drag blew my mind. Amazing.

LikeLike

Oh, I’d like #1100 as a wallpaper, perhaps with even more details! I doubt I’d get my girlfriend to approve, though…

LikeLike

I am amazingly peeping your world since a couple of years. I used to thought you ROCK. But dude, you SHOCK. Seriously man.

PS: English is not my native language :)

LikeLike

Ok, right now I hate myself. I had been writing a comment for about 20 minutes and then I accidentally refreshed the page. Great! Ok, I’ll just start again:

Hi Randall. I’ve been reading your ‘comic’ (I really don’t know how to call it…) for about a year now. I remember the day I discovered XKCD. I was looking for ‘existentialist online/flash games’ on the Internet (that’s what I do sometimes when I feel weird and have plenty of time; there are some great games out there) when I came across a blog that showed ‘A Bunch of Rocks’. That’s the day I became addicted to the things you write, draw and think.

I think I’ve read all of the ‘comics’ in your webpage. And I’ve really liked them. Well, the thing is that this last ‘Click and Drag’ post has left me amazed. And in my amazement I decided to come here, as others have, and tell you. And thank you for sharing your work. I don’t know why I haven’t done it before, though. Anyway, one of the daily visits you get from Western Europe is mine.

Yesterday I spent about 45 minutes wandering in ‘Click and Drag’. I don’t know if I have seen a big or a small part of it, I just know I’ve seen some of the parts.

I was thinking last night about how much time you might have spent in this comic.

But I’ve realised of one thing. Right now I see you as God. Ok, this sounded strange. Let me explain. You’ve created one huge thing. Like a world. Ok. And for some reason, all of us want to understand it, and to watch all its contents. We can’t help ourselves and we desperately click and drag looking for something that we don’t find. Because, what are we looking for in Click and Drag? No one promised us anything. But we keep on searching. And then some of us realise that it was created by someone, so we go and ask for his help. Some beg for the ‘full version’, some others try to rationalize it, or even automatize it. Some insult. Some admire. But you’ve got control over them, kind of. You can decide because only you know WHAT IS exactly in Click and Drag. This makes me laugh a little. So you’ve become God. You have created a world and have now a bunch of humans of all kinds. Strange…

Perhaps Click and Drag is life. Perhaps you’ve invested so much time on it that it’d take years to watch it completely. And all we want to do is to ‘complete’ it as soon as possible and we aren’t paying attention to the beautiful things it has. That’s how some of us, humans, see life. I don’t know.

Anyway. Thank you. Yes, you make really great ‘comics’ or whatever you want to call them. But you make people think. At least you made me think. It’s not only the comic but the consequences that made me think. This is really interesting, I don’t know if you had planned it or something… maybe you did.

To finish, I’ll say that I put this God thing, but it has nothing to do with my beliefs, of which I’m not too sure. I think that Christians, Atheists, Buddhists, and people of all religions and beliefs can understand what I meant. I wasn’t making an apologia of any religion or anything, it’s just the first example that came to my mind. If any reader doesn’t like it, he/she can mentally replace it with a different example that is more suitable, from his or her point of view (what I mean is, let’s not argue on this, please).

Peace to you all. And thank you, Randall. Thank you and congratulations.

LikeLike

I just read some of the other (older) comments here. The #404 is genius. I hadn’t seen it (when you’re in #403 and hit ‘Next’, it jumps to #405).

LikeLike

Ok, the X-wing blew my mind. Serious nerdgasm!

LikeLike

I read the wikipedia article about the North Dakota tower, and examined the guy wires of your drawing. I was proud of your realism to put sag in the wires – I checked the slope of the line gradually decreasing as it goes towards the ground level. Yea!

LikeLike

I too, wonder where he’ll go next. I still havn’t found the submarine or the other boats so I’ll be back when my wrist heals up.

Nice work, bud….’bout yer best so far.

LikeLike

Excellent calculations.

Can you please provide a dailily (yes, dailily) updated calculation of the probability of my entire family dying within 1 year? Round up, please.

LikeLike

Mr. Randall – the “Click & Drag” comic is truly wonderful.

I hope that after a while you’ll post the whole picture :)

Thank you very much.

LikeLike

Hi,

I discovered your comic a couple of years ago and have been a big admirerer ever since. Just want to say I really like your work and the insight you show into all the math and computer science I am currently trying to master, this comic is both amusing and relaxing and on top of that makes me feel kind of good when I recognice nerdy stuff I’ve been learning.

Thank you.

LikeLike

Excellent calculations, but never tell me the odds!

LikeLike

You really should, at some point, be posting a link to the zoomable version:

http://xkcd-map.rent-a-geek.de/#5/21.433/13.359

LikeLike

besides thanking you for “click and drag” (also Phoenix above for a zooming), I just would like to point out that the what-if-laser-pointed to the moon question was actually attempted a few times, wit radar first, most notably by Mr. Bay (not Michael but Zoltan) So it is not a purely speculative issue.

http://en.wikipedia.org/wiki/Zolt%C3%A1n_Lajos_Bay

LikeLike

You predicted Neil Armstrong’s death?! How… horribly awesome.

LikeLike

“Click-and-Drag” wallpaper!

‘Nuf said.

LikeLike

So.. Funny moment.. My wife says, “So this is what happens if you’re bitten by a python?”…

LikeLike

OvernightAir Cargo to Panama. This service usually goes by weight and is used for documents, or any time sensitive materials you want in Panama overnight.

LikeLike

This service usually goes by weight and is used for documents

LikeLike

good

LikeLike

you were able to predict lance armstrongs death.

woah mind blown..

its because you made this script predicting a death, that a death had to follow based on this script.

Schrödinger’s idea put into play.

LikeLike

You could also think the astronauts have been exposed to more radiation and super g-forces that messed up their bodies, lowering the life expectancy. And I don’t know how fit they stay after they retire. And so on. I guess that script works best with only taking into account the statistical life expectancies. Anyways, nice code and math!

And RIP Neil (Not Lance yet)

LikeLike

So it’s not a Monty Python script then. OK. That reads differently in the UK.

LikeLike

I did something similar a while back. The input to this script is simply your age. It tells you how many dice you should roll and how many coins you should flip in order to approximate the probability of your death this year.

note: probabilities are based on a curve fit to actuarial data.

#!/usr/bin/python

import math

import sys

def P(age):

return 1-math.exp(-0.003*math.exp((age-25.0)/10.0))

def dice_and_coins(p):

def pdc(d,c):

return 1/(math.pow(6,d)*math.pow(2,c))

# find how many dice is too many

D = int(math.ceil( -math.log(p) / math.log(6) )) + 1

# find how many coins is too many

C = int(math.ceil( -math.log(p) / math.log(2) )) + 1

# search the space from D to C to see which value is closest to P

closest_d = -1;

closest_c = -1;

closest_p = -10000;

for d in range(D):

for c in range(C):

this_p = pdc(d,c)

print “testing %d dice, %d coins” % (d,c)

if abs(this_p – p) < abs(closest_p – p):

closest_d = d

closest_c = c

closest_p = this_p

return (closest_d,closest_c,closest_p,p)

a = dice_and_coins( P( int(sys.argv[1]) ) )

print "%d dice and %d coins" % (a[0],a[1])

print "dice and coins probability %f, actual probability %f" % (a[2],a[3])

LikeLike

I ran the script for my shared house. Nobody was happy when I presented them with these figures. I think it brought the mood down:

python actuarial.py 22m 27m 30m 33m 22m

There is a 5% chance of someone dying within 6.73 years (by 2019).

There is a 50% chance of someone dying within 32.4 years (by 2045).

There is a 95% chance of someone dying within 49.74 years (by 2062).

There is a 5% chance of everyone dying within 54.11 years (by 2066).

There is a 50% chance of everyone dying within 64.97 years (by 2077).

There is a 95% chance of everyone dying within 74.51 years (by 2087).

Probability of all dying in 1.0 year: <0.001%

Probability of a death within 1.0 year: 0.726%

LikeLike

Supreme Court?

LikeLike

steven@linux-csh5:~/Documents> ./actuary.py 77m 76m 64m 79f 74m 58m 62m 58f 52f

There is a 5% chance of someone dying within 0.21 years (by 2013).

There is a 50% chance of someone dying within 2.69 years (by 2015).

There is a 95% chance of someone dying within 8.53 years (by 2021).

There is a 5% chance of everyone dying within 25.65 years (by 2038).

There is a 50% chance of everyone dying within 35.72 years (by 2048).

There is a 95% chance of everyone dying within 45.79 years (by 2058).

Probability of all dying in 1.0 year: <0.001%

Probability of a death within 1.0 year: 21.01%

I rounded ages to the nearest year since I didn't want to do the conversion to decimals. Close enough for my amusement.

LikeLike

I wouldn’t say that this is a calculation of Star Wars cast or 9 people who have walked on the moon mortality probabilities since the rates you obtained from the SSA are based on the total US population in 2012, with only sex as the aggregating variable (not even race/ethnicity, education, income level, etc.) whereas we know that numerous studies have found vast differences in mortality rates by those variables. So technically what you’ve presented here are period probabilities for *any* group of 9 or 4 people in the US in 2012, with ages matching the 9 people who have walked on the moon, or the 4 stars from Star Wars.

LikeLike

hyHey! I don’t write comments usually, but this one time I just had to drop by and tell you what an unbelievable, stunning, wonderfull piece of art you made there!

Keep up the great work, it’s highly apreciatedfh

LikeLike

Darn. I came here looking for a script that calculates the future incidence of walking pneumonia among original Star Trek dolly grips. When I saw “morbid Python script” and Star Trek in the same post, I was sure I was in luck. Imagine my disappointment when this script calculated mortality rather than morbidity. And it apparently doesn’t account for the dolly grips at all. Back to the drawing board I guess.

LikeLike

sed s/Trek/Wars

LikeLike

super code :) tnx

su tesisatçısı

LikeLike

Supreme Court?

kurabiye tarifleri

LikeLike

Pingback: One-upping Charles Babbage | Calvin Li

Just fantastic, more then a comic, wonderful creation.

LikeLike

Very interesting, how did anyone even think of that?

LikeLike

My physics teacher elektrikçi used your comic 435 “physicist character” in a slide today in class; Awesome!

LikeLike