Should I keep buying gift cards for the discount?

I work upstairs from a location  of Lee’s Deli, so I go there a lot for lunch. They have a deal where if you pay $50 for a gift card, they’ll load it with $55 of value. Sounds like a good idea, right? But on the other hand, I’m not going to stay at this job forever, so at some point I’m going to end up stuck with value on one of my cards. Should I make a habit of buying these cards?

On the one hand, for every card I buy I gain $5 in value.

On the other hand, I expect the card that I have when I will no longer need such cards will have half of its $55 value left when I leave, costing me $27.50.

So if I expect to stick around long enough that I’ll go through five and a half gift cards – spending $302.50 – then I should keep buying the cards.

Of course, in reality, I won’t use this analysis, because:
– when I do leave my job I won’t just walk out the door; I’ll give some notice, like you do. So I can decide to use up the card.
– if worse comes to worse, I can sell the card to someone else in the office, at least at face value – I’m not the only one who buys these cards.

(Bi-)weekly links for June 24

Nate Silver on domestic surveillance creating a divide in the 2016 primaries., and later on Lebron’s odds of catching Jordan and winning six NBA championships.

Kieran Healy uses metadata to find Paul Revere.

When not knowing math can cost you $15,000, from Who wants to be a millionaire.

Chelluri Sastri for Scientific American on Continuous and discrete as it applies to the less/fewer distinction.

Alex Krawchick of SAS talks with Nate Silver.

Roots of a base tiling.

Do plants do division to ration out starches during the night? (This is work of Alison Smith.)

Ultimate tic-tac-toe.

Nautilus is a new science magazine that is currently doing an issue on uncertainty; this article by Stephen Cass is on technologies that rely on randomness.

Richard Green has written on Google Plus about the Cookie Monster problem.

Amazon has yellow books on sale.

Kataklinger wrote a genetic algorithm for solving the knapsack problem. (via YC.)

Where does the 51st star go? See also this Slate article from a few years back.

yhat, a predictive modeling company, writes a beer recommendation system in R.

The documentation for R’s sample function says that it uses Walker’s alias method, which I had not heard of. In googling around I found Keith Schwarz’ exposition of methods for sampling from a discrete distribution.

What’s in your wallet?

Nate Silver’s poll aggregation model has been implemented in Python

Folding the future: from origami to engineering.

Are Amazon’s rankings Zipfian?

Will Oremus at Slate writes that “Sales of George Orwell’s 1984 Are Up 5,000 Percent on Amazon”.

And that’s certainly how it looks on his screenshot of’s movers and shaker’s page. Here’s my screenshot (which shows a different number, because it was taken later). This particular edition of Nineteen Eighty-Four has gone from rank 3,151 to rank 89:


But the Amazon Movers and Shakers page says that it displays “Our bigger gainers in sales rank overs the past 24 hours. Updated hourly.” That is, they’re looking at sales rank, not raw sales. Can we really conclude from that 3,440% number in the screenshot that sales have gone up by a factor of 35?

Perhaps we can, if the sales follow Zipf’s law – that is, if the sales of the kth-highest-ranking item are 1/k the sales of the highest-ranking item. So if the sales of the highest-ranking item are S, then sales have gone up from S/3151 to S/89 – a percentage rise of (3151-89)/89, or 3440%. This formula agrees with the percentage results that Amazon states for all the books on the Movers and Shakers page.

Of course this doesn’t mean that Amazon’s sales are actually Zipfian – it’s much more likely that they want a convenient formula that gives reasonable-looking rankings. But if they are, then these percentages are not too far form the truth.

(Why is Nineteen Eighty-Four suddenly so popular? The PRISM scandal. I’m not rehashing that.)

Weekly links for June 10

Why you shouldn’t use a toss for overtime (in American football).

Who Is the Best Player Ever? A Complex Network Analysis of the History of Professional Tennis

Data scientists working for good causes.

Bike sharing and quadratic vote buying.

Ten controversial math problems from Business Insider. (Not really, but it’s some old chestnuts.)

Julie Rehmeyer for Science News on how category theory is good for something; David Spivak has a book-length set of notes category theory for scientists.

Johnny Carson botches the birthday problem. (via Steve Strogatz.)

Quantifying movie magic with Google search.

How likely is the NSA PRISM program to catch a terrorist.

Joseph Blitzstein has a short talk on the soul of statistics (spoiler: it’s conditioning.) (15 minutes on YouTube.) Relatedly at You Are Not So Smart, David McRaney wrote an essay on survivorship bias.

How many friends of friends do you have on facebook?

Customers who viewed this item also viewed…

My PhD advisor, Robin Pemantle, has published a book. It’s Analytic Combinatorics in Several Variables, co-authored with Mark Wilson.

As of right now customers who have viewed this item have also viewed, according to Amazon:

  • Analytic Combinatorics, by Philippe Flajolet. As Flajolet’s book is to univariate analytic combinatorics what Pemantle-Wilson promises to be to multivariate analytic combinatorics, no surprise there.
  • Inferno by Dan Brown. Not the computer scientist dan brown, the author.

I can infer from this:

  • the probable existence of an (aspiring?) analytic combinatorialist out there who reads Dan Brown.
  • that Amazon’s “customers who have viewed this item have also viewed” is pretty close to being what it says it is. In particular, there isn’t some prior in there that assumes that people who buy Pemantle-Wilson are likely to buy other math books and steers them in that direction.

Weekly links for June 3

Global flight paths in pictures by Michael Markieta.

How crackers crack passwords, via metafilter.

Why do cicadas breed in prime year intervals?

From John Geer, better estimation when perfection is unlikely – a derivation of the Laplace succession rule. This underpins Geer’s Deciding Data, an aggregator of data science news; here’s how it works.

From Quora, how do you explain Bayes’ theorem in simple words?

Upstart is a company that allows people to invest money in young people in exchange for a share of future income. Say what you will about their business model, they have an interesting blog.

From the New York Times “Wordplay” blog, is it better to walk or run in the rain?

From Marginal Revolution, do Lacanians understand the third derivative?

American Heritage did an article a few years ago on girl computers (who were instrumental in the World War II effort); the documentary “Top Secret Rosies” on the same subject is available on Netflix streaming.

Jordan Ellenberg estimates that he has a quarter million friends of friends on Facebook. Edward Frenkel writes on credit card security and cryptography for Slate. (What’s this doing in the same paragraph? Well, Jordan Ellenberg is Slate’s usual math contributor.)

Barry Mazur on the nature of evidence in mathematics, perhaps best accompanied by these notes by Mazur on plausibility.

Gerhard Woeginger has a collection of 98 papers which attempt to settle P vs. NP, if you’re into that sort of thing.

Khan Academy has lots of data on learning, something I wished I had back when I was teaching. Via Y Combinator.

The Guardian asks which times tables are hardest and easiest for children; results are surprisingly noncommutative.

Nate Silver asks why can’t Canada win the Stanley Cup?

Burr Settles text-mines the difference between “geek” and “nerd”.

Andrew Gelman asks about the statistical properties of referral chains.

Ben Frederickson examines the distribution of user ratings.

Ian Stewart, writing for the New Statesman, puts forward the idea that mathematics is a third intellectual culture bridging the gap between the arts and the sciences.

Science &ecute;tonnante explique pourquoi 1 + 2 + 3 + … + = -1/12. (In French.)

Prices in virtual economies are as hard to manage as real life ones, says Zach Seward at Quartz, in reference to the game Dots a few weeks ago he put out a the ultimate Dots strategy guide.

That Prudential commercial

Prudential, the insurance company, has a commercial in which they ask people to place stickers at the age of the oldest person they know, thereby creating a histogram with its peak in the early 90s. Patrick Honner has commented that this seems like a way to fool the quantitatively unsophisticated into thinking they will live into their early 90s and therefore saving more – and giving more money to Prudential.

I don’t think this is true. Rather, people shouldn’t be planning to live only to the average lifespan – or even to the average lifespan conditioned on the fact that they’re still alive – when they do their retirement planning. Then anybody who has the good fortune to live longer than their life expectancy will be broke! It would make more sense to plan as if you will live longer than, say, 95% of people – then you only have a 5% chance of outliving your money.

And this seems like a good way of intuitively getting at “name a high percentile of the distribution of people’s lifespans”, which is necessary since people aren’t good at thinking distributionally. If you think of someone you know who lived to 90, you’re going to think “that could be me. I might live to 90. I’d like to have the money for that.”