Wednesday, February 12, 2014

Python vs Stata

Justin Wolfers a few minutes ago:
I'm a long time aficionado, but after only a couple of days coding in Python, I've learned that wow, Stata is clunky for programming.
Actually, this would still be true if you replaced either "Python" or "Stata" with just about any other programming language (just not at the same time).

If you are thinking of making this transition, I must send you to Python for Economists!

Sunday, January 26, 2014

The Pirate and the Joker

If you have any plans for a trip to Disney World in the next decade, you can expect to see your share of Captain Jack Sparrows.  I saw a Jack Sparrow who looked, sounded, acted, and possibly even smelled like the real thing.  (To the extent that a fictional character can be real, or have a smell).  I was impressed and surprised at just how Sparrow-like he was.

This raises a question: Does Pirates of the Caribbean really need Johnny Depp anymore?  I mean, Heaven forbid they should make another one of those movies.  And of course, Johnny Depp can bring in more fans than an identical replica of Johnny Depp.  But aside from all this, I get the sense that Depp's special, unique contribution was really his idea for the character, not his execution of that idea.

Of course Depp is technically gifted, too.  Depp's technical ability enabled him to execute and communicate his vision.  But now that it's been communicated, there are loads of technically gifted people who can execute the same vision.  As with many things, the hardest part is having the idea in the first place.


If you think this Johnny Depp discussion is too academic to matter, consider Heath Ledger instead.  He was incredible as the Joker, picking up an Academy Award for Best Supporting Actor.  Surely Ledger would have reprised his role, if not for his untimely death.  

Suddenly the question becomes highly relevant: Why can't we have a Ledger-Joker without Ledger?  What's stopping us?

Thursday, January 16, 2014

Thailand musings: Instagram?

Quick, what's the most tagged location in the world on Instagram?

The Eiffel Tower comes in at #8.  Times Square is #4.  Disneyland is #3...

You kinda sorta know what I'm about to say, given that I asked the question.  But let's not pretend it actually makes sense.  Bizarrely, first and second place go to Thailand!  Here is the complete list:

  1. Suvarnabhumi Airport (BKK) ท่าอากาศยานสุวรรณภูมิ in Bangkok, Thailand
  2. Siam Paragon (สยามพารากอน) shopping mall in Bangkok, Thailand
  3. Disneyland Park in Anaheim, California
  4. Times Square in New York City
  5. AT&T Park in San Francisco
  6. Los Angeles International Airport (LAX)
  7. Dodger Stadium in Los Angeles
  8. Eiffel Tower in Paris
  9. Staples Center in Los Angeles
  10. Santa Monica Pier in Los Angeles

I learned this shortly before my trip, but I have still been unable to come up with a satisfactory theory of why.

Any ideas?  Here are some observations:

  • I am told that Instagram is really super popular in Asia.  
  • I am also told that Chinese tourists have been arriving in Thailand en masse, and what they like to do is go shopping at the Thai shopping malls.  I even observed firsthand the swarms of Chinese tourists in parts of the Paragon.
  • Like everyone, I arrived in Bangkok at Suvarnabhumi Airport.  I even took a picture, although it did not end up on Instagram.

I actually spent many hours at the Siam Paragon, mostly because the second Hobbit movie is many hours long.  Imax!  With Thai subtitles!  I did not take any pictures during the movie though.

Perhaps a coherent story is coalescing in your mind.  However, I feel I must remind you that it still makes no sense.  I mean, look at that list!  The top doesn't belong with the bottom!

If Instagram is so popular in Asia, why isn't there anything else in all of Asia?  And if the massive population of Insta-crazy China is driving this, then shouldn't somewhere in China be on the list?  Shouldn't other noteworthy places in Asia be dominating? And if not at the top, couldn't they at least edge out Santa Monica Pier?  What are people taking pictures of, the bubble machine?  I don't even know if that's still there and it's the only thing I even remember!

For the love of God.  And Siam Paragon isn't even the biggest shopping mall in Thailand...or even in Bangkok...or even within a half-mile radius!  That honor goes to the CentralWorld down the street -- the sixth largest mall in the world -- which you could conceivably get lost in and never come out of.  (Of course you could still interact with the outside world through Instagram).

I just realized I have actually been to every place on that list that isn't a sports stadium.  Therefore I am highly qualified to say it makes no sense.  There is probably some stupid, uninteresting explanation for this data, but for now I am on the record as Highly Confused.

Saturday, January 11, 2014

Thailand musings: Taxi mismatch

I was flying from Chiang Mai to Bangkok on New Years Eve.  Thanks to some flight delays, I found myself in Don Mueang airport in Bangkok less than 2 hours before the ball dropped.  This is not a good time to be in an airport.  The line for taxis was unbelievably long, with only one taxi arriving every couple minutes or so.

These were the official cabs with standardized metering.  Under normal circumstances, you'd want to be sure to take one.  But New Years Eve is not normal circumstances.  Drivers had no way of adjusting their prices, and evidently didn't want to work the holiday for normal prices.  But however much they didn't want to work, I guarantee you that Western tourists were willing to pay a lot more to not spend 6 hours of New Years Eve/Day in an airport.

There is just no comparison here.  $30 for an airport cab ride is nothing to a Westerner even under normal circumstances, but a lot to a Thai driver even under special circumstances.  $30 goes a long way in a country where you can get a solid meal for $1-2.

Fortunately for me, there was another option: I just hopped in an unofficial cab and was home for $30 in time for the fireworks.  By comparison, a metered cab probably would have cost me $5.

That's great for me, but it doesn't resolve the widespread inefficiency described above.  For whatever reason, there were hundreds of people standing in an unmoving line for cabs that wouldn't come because their prices couldn't adjust.

Why didn't other travelers just do what I did?  I suspect they were just unaware of the option.  Possibly this is an example of herding behavior gone terribly wrong.  Maybe the longer the line becomes, the more you think that what you're supposed to do is stand in line too, instead of looking around for an alternative.

What a terrible recipe.  The more people do it, the worse idea it becomes, and the better idea it seems.

Thursday, January 9, 2014

Thailand musings: escalators, escalators, down, down, down...

Traveling to another country always stimulates interesting econ thoughts.  I was in Thailand visiting family over the holidays, so over the next week I will share some of my observations.


In the Thai airport, I waited through a very long security line that included, among other things, an escalator.

This is basically the worst idea in the world.  You cannot have a line that includes an escalator, because people might do something stupid like go down the escalator before they have anywhere to go at the bottom.  Think about what happens when you get to the bottom of an escalator and have nowhere to step off.  It's not "a little uncomfortable," like squeezing into a crowded elevator.  You have nowhere to go and the floor beneath you is constantly trying to push you forward. You could walk slowly backwards as it goes down, except there are people above you too, and who knows what they're doing.  This can lead to a fairly horrific scene as soon as just one person has fallen down.

Fortunately, the scene at the airport was not that horrific.  Instead, the airport staff threw inefficiency at the problem.  An escalator in a line requires not one but two full-time crowd control employees.  One at the top to safely portion people onto the escalator, and one at the bottom to make sure a space is cleared for those people when they get to the bottom.

I guess that's not such a bad solution.  Labor is cheap in Thailand.  But at times like this, it's good to remember a bit of wisdom from Mitch Hedburg: An escalator can never break, it can only become stairs.

Why didn't they just turn the escalator off?

(Because it's Thailand, of course).

Sunday, November 24, 2013

Benford is not kind to strippers

Over at MR, Tyler discusses inflation and strippers:
"Nobody dislikes currency inflation more than strippers." 
But is that claim true?  It depends on the margin.  Let’s say the standard tip is a dollar, and price inflation lowers the real value of that dollar.  A lot of customers won’t substitute into stuffing $1.43 into the stripper’s garments.  They might do two or three singles, but strippers will be shortchanged at various points going up the price pole.  There is something about handing out a single bill that is easier and more transparent, or so it seems.
I was a bit disappointed to see no mention of Benford's law!  I love Benford's law and cannot pass up an opportunity like this...

Benford's law says that if you go to the supermarket (say) and look at the prices, the leading digits will not be distributed uniformly like you might expect; rather, lower digits are much more common, with almost a third of the prices starting with 1!

The underlying reason for this surprising fact is that prices keep pace with inflation and thus exhibit exponential growth.  Think about simply doubling your money every year (a 100% growth rate):

1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 10242048, 4096, 8192, ...

As you can see, over 2/3rds of the numbers begin with a digit less than 5!  As soon as you get to a leading 5 or above, doubling is sure to boost you into the next order of magnitude, leading with a 1 again!

What does this have to do with strippers and indivisible tips? To find out, let's assume that:
  1. The inflation rate is constant at, say,  5% per year.
  2. The "correct" real tip for a stripper's services is $1 in 1980 dollars.
  3. Customers know the correct tip, but insist on paying only in a single bill, limiting them to payments of $1, $5, $10, $20 and so forth.
  4. In any given year, customers compensate by straightforwardly rounding their payment up or down to the bill with value closest to the correct tip for that year.
In 1980, the customer simply tips $1, and everyone is happy.  As inflation kicks in, though, the dollar loses value.  In 1981, a stripper must be paid $1.05 to be equally well off as before.  The customer realizes $1 is underpaying by $0.05, but that's better than paying $5, which overpays by $5 - $1.05 = $3.95.

So the customer underpays.  In 1982, the stripper should be paid $1.10.  Again, $1 underpays, but surely a 10 cent underpayment is better than a $3.90 overpayment with a $5 bill.

We continue in this fashion, year after year.  It is not until 2003 that the customer starts paying with a $5.  In 2003, the correct tip is $3.07, which is closer to $5 than $1.

Now the customer is overpaying.  In 2004, he overpays again.  In 2005, he overpays again.  That's good, since he's been underpaying for the last 22 years.  It will balance out, right?


Sadly, no, it won't balance out.  By 2013, the stripper's correct tip is $5.00, meaning a $5 bill in 2013 is worth the same as a $1 bill in 1980.  (By the way, the true inflation rate in the last 33 years has been much lower than 5%; a 1980 dollar is actually equivalent to about $2.83 today.  But whatever).

The stripper is paid exactly correctly in 1980 and 2013.  But in between, we have 22 years of underpaying versus only 10 years of overpaying. In fact, the sum total of the underpayments in 1980 dollars is $8.84, versus $3.20 in overpayments, for a net loss of $5.64.

What happened?  The customer followed the seemingly innocuous rule of considering the correct payment, and then rounding to the nearest acceptable unit of currency.  It seems like roughly half the time you'd be rounding up and half the time rounding down, balancing out in the long run.  But that misses a fundamental fact about exponential growth, namely that the bigger you are, the faster you grow.

Here is the complete beginning of the sequence of the stripper's "correct" tips:

1.00, 1.05, 1.10, 1.16, 1.21, 1.28, 1.34, 1.4, 1.48, 1.55, 1.63, 1.71, 1.80, 1.98, 2.08, 2.18, 2.29, 2.40, 2.53, 2.65, 2.79, 2.93, 3.07, 3.23, 3.39, 3.56, 3.73, 3.92, 4.11, 4.32, 4.53, 4.76, 5.00, 5.25, 5.52, 5.79, 6.08, 6.39, 6.70, 7.04, 7.39, 7.76, 8.15, 8.55, 8.99, 9.43, 9.91, 10.40, ...

You can observe Benford's law in full effect here. See how many prices begin with 1?

Was there anything special about picking $1 and $5 as our denominations?  Not really.  No matter what, growth accelerates.  That means that you will always traverse the first half of the distance more slowly, which means any policy of rounding to the nearest of two denominations will tend to round down more than up.


Aside: Mind you, I never said how the "correct" tip is determined.  This discussion makes it seem like strippers will systematically be shortchanged, but why should the customers be the ones who determine the "correct" wage, and decide the fair way to round?  Presumably there is some sense in which strippers set their own prices (say, by giving dirty looks to underpaying customers), and thus can correct for Benford's law.  And if strippers are being shortchanged anyway, supply should adjust accordingly.  Also, even if any individual payment is restricted to $1 or $5, there's no reason an individual or group cannot randomize their payments to achieve a correct intermediate payment on average.  But I hope these caveats will not diminish your respect for Benford's law!

Monday, November 11, 2013

Rules, rules, rules

Ryan is currently summarizing Kahneman's Thinking, Fast and Slow. I resist the urge to do a series of summaries of his summaries, but I do still want to encourage this public service, so I will instead offer some comments.

In the second post, we learn that rules can serve not only to make us do things, but also to do them at lower cost, by eliminating the need to make a costly decision.

This is one of the many reasons a well-functioning society or community or company has a system of rules in place, whether they take the form of social norms or laws or something more informal.

Say what you will about the agony of getting yourself out of bed for work in the morning; the fact remains that by having a regular structure imposed on you, it is probably easier to get up in a timely manner.  You don't have to decide whether it's worth it.  You just get up, because you have to.

Maybe that is not the best example, because there is some wiggle room about when exactly you have to get up.  But to the extent that it's a struggle, isn't that exactly the reason?  The existence of wiggle room?  People buy alarm clocks that roll off their nightstands, or even fly away, just to save themselves from dealing with the wiggle room.

There are so many decisions to be made in life.  In order to get a lot done in a limited time, it helps to trivialize as many of those decisions as possible. One way to do that is through rules.

(Of course, in a post like this, there should be at least one sentence acknowledging that rules can go terribly, terribly wrong.)