Wednesday, June 25, 2014

Is a Long, Smooth Commute Better Than a Short, Frustrating One?

When I lived in Virginia, I had a 6-mile, 30-minute commute down the two-lane Interstate 66, characterized by riding the brakes and inching along. Now in the Bay Area, when I'm not taking advantage of the techno-elite bus, my drive is 50 miles down Interstate 280. No matter when you leave, you can usually find enough space to go over the speed limit, so you're constantly making good progress. Still, since it's so far, it's about double my previous commute time. Yet I am finding myself less annoyed with the new one.

This recalls the peak-end rule discussed in Thinking, Fast and Slow. The intro from Wikipedia is spot on:

The Peak-End rule is a theory that describes how humans hedonically evaluate past experiences. This heuristic process leads people to judge an experience by its most intense point and its end, as opposed to the total sum or average of every moment of the experience. It occurs regardless of whether a ‘peak’ is pleasant or unpleasant, and regardless of the duration of the experience.

I know intellectually that an hour commuting is longer than half an hour, but the objective experience is much better. My new commute is not punctuated by any frustrating moments, unlike my life in congested Northern Virginia. If anything, it's kind of awesome to be driving 75-80 mph at 8 a.m. on a major freeway.

Tuesday, April 22, 2014

Tell Me Again How Biased We Are

I've just started reading The Information Diet, which compares how we consume information to how we eat. Just as people are growing more obese while loading up on cheap, calorie-filled snacks, we prefer to consume information that we deem more tasty: the type that conforms with our previously held beliefs. Fox News and MSNBC dominate the ratings by appealing to the respective right and left of the political spectrum, while the more unbiased CNN drags behind.

Of course, the thought occurred to me that I would like this book, given how much I think about how arbitrary decision making is and how terrible humans are at looking at things objectively. I don't often seek out books talking about how rational we are.

Friday, April 18, 2014

Coin Appears to Be Headed toward Failure

Remember Coin? They caused a stir last year with a video about how their device could replace all of your wallet's credit cards. You could bring the George Costanza wallet into the digital age.

Reading over the FAQ section, either the company is running out of money or has a fundamentally flawed understanding of how customers behave. Companies that can appease customers' risk aversion can go far; look at how reassuring Zappos's return policy is.

I've launched a pretend conversation below.

FAQ section: How much does a Coin cost? Each Coin costs $100. For you early adopters there is a very limited quantity that can be purchased for $50.

Risk-averse consumer: I have the choice of buying now and getting an as-yet unfinished product at an unknown time, or waiting and feeling a loss of paying nearly double.

FAQ: How many cards can a Coin hold? A. The Coin mobile app can store an unlimited number of cards, however, a Coin can hold up to 8 cards at a time.

RAC: I'm probably one of the 90+% of people who can get by with only eight cards, but this limit is freaking me out! I hate this just like how I hate cellphone companies limit my monthly data usage, and how I worried about my download limit with my cable provider until they caved.

FAQ: Why do I have to buy a new Coin when my battery runs out? A. Coin is the size of a typical credit card and we were not able to fit a replaceable battery nor recharging components into this form factor. Coin is an electronic device, not a plastic card. We must charge for each device to cover the costs of research and development, manufacturing, and support.

RAC: This is another thing for me to stress about. Why won't you let me charge it? How can I believe your claims about the typical battery life? What if it runs out at an inopportune time (after all, I will have left all of my other cards at home and have no way to settle my bill)? Can't this come with some sort of warranty? I would feel terrible about buying something that I already bought.

FAQ: How do I get help or support? A. Please email us at help@onlycoin.com. We currently only offer email support. Our support hours are 8 am-5 pm PT Monday-Friday.

RAC: That sounds vaguely uninspiring.

Thursday, April 17, 2014

Is It Worth Risking the Caltrain Fine Instead of Buying a Ticket?

I take the techno-elite bus to work (you know, those ones that are becoming increasingly popular with the locals). Since the bus only leaves / departs once per day, I occasionally take Caltrain for one leg of the journey.

Caltrain is a proof-of-payment system. You can simply waltz onto the train without paying, but the conductor issues stern warnings that Caltrain retains the right to check your ticket and issue fines.

Should you actually buy a ticket? To the economically trained, this becomes an intriguing empirical question, solved by the expected-value equation.

Using my Clipper stored-valued card, I ride three zones, which costs $6.75 (see full fare chart). Getting an estimate on the fine is a little tougher. A Yelp post from 2007 says the fine is $300, while another blogger who asked himself this same question in 2012 cites $250. Let's go with the $250 number, since it's more recent, and it can bias my answer toward "you should not pay" (the outcome that all economists are secretly rooting for).

The equation would be as follows: 250x = 6.75, where x is the percentage chance that they'll check my ticket. Turns out that if tickets are checked any more frequently than 2.7% of the time,  you should buy a ticket. Things actually are a bit worse than that, as this equation doesn't factor in the shame you may feel if the conductor yells at you, the anxiety you may feel worrying about whether tickets are checked, or the hassle of physically paying the fine. On the flip side, maybe you could contest the assumption that you'll have to pay 100% of the time when they find you without a ticket, depending upon how good you at sweet-talking or claiming to be a clueless tourist. My wife's cousin also suggests that the "the machine wasn't working for me" excuse might work better if you actually have a Clipper card in your pocket instead of arguing that you were trying to buy a paper ticket but failed.

How often does Caltrain check tickets? Estimates vary widely: I have ridden Caltrain from Millbrae to San Jose or vice versa 10 times and have yet to be checked. My wife's cousin estimates that tickets are checked 1 in 6 times. The aforementioned blogger experienced checks on 45% of his rides in 2012.

Even though I've yet to see a Caltrain ticket check myself, I have to put my Bayesian reasoning to work here and assume the true rate is at least 2.7%. So while I can't squeeze any gains out of a government agency this time, at least I had fun trying.

Tuesday, April 15, 2014

Forgetting the Details

On rare occasions, I get so engrossed in good articles from Grantland and the like during my hour-long bus ride to or from work that I don't want the ride to end.

I felt this a few days ago. But I realize that if you asked me now what any of the articles were about, I'd have no clue. Part of me wants to think that I've somehow internalized the information (like how people say "I think I read that somewhere"). But let's assume I didn't; I've heard (somewhere) that we remember 10% of what we read. Did that defeat the purpose of reading? My answer is no. It gave me satisfaction in the moment, and I remember that satisfaction later. I think the concept could apply to any other fleeting activity I could have been doing with my phone during that bus ride, or a conversation I could have been having.

I have a pretty solid email correspondence with one of my buddies back in D.C. How many of our conversations or emails do I remember in any detail? It's almost certainly less than half. But just remembering the highlights and knowing "I've had lots of great conversations and emails with this friend" is enough for me.

Saturday, February 15, 2014

From Vegan to Hunter

I'm a fan of Siddhartha-esque journeys. In Siddhartha's case, he explored the entire spectrum of religion, from starving as an ascetic to engaging in high-stakes gambling, only to settle down on the river, in the literal and figurative middle.

The Mindful Carnivore: A Vegetarian's Hunt for Sustenance is same for food, as we watch the author, Tovar Cerulli, embrace veganism and then become a hunter over the course of many years.

For me, eating meat was always a cognitive dissonance. I like meat, eat if often, but am only occasionally reminded of its gruesome origins. We dote on our cat, Apollo, buying him endless toys, making sure to mentally stimulate him, paying someone to come check on him daily when we're out of town, and feeling guilty if we are out for dinner or drinks and miss his feeding schedule by a few hours. Imagine the horror that would occur in my household if I took out our sharpest knife from the kitchen, grabbed Apollo, and slit his throat. Sharon would instantly divorce me, and I might even end up in jail. Yet week after week, we bring home meat from the grocery store, dissociated from its former animal, "a gaping chasm between field and table," as Cerulli writes. Why are some animals endeared and others mindlessly eaten? This is a topic also covered in depth in the book Some We Love, Some We Hate, Some We Eat.

As an economist, I've never much bought into the categorical imperative: "Act only on that maxim through which you can at the same time will that it should become a universal law." Sure, maybe I could adopt a lifestyle that involves veganism or diligent recycling, but even if I do, the aggregate impact on the world is squat. In fact, I might be more easily persuaded to vote a citywide ban on plastic grocery bags than I would be to use reusable bags on my own, as the latter has so little impact. Thinking through the supply chain for food -- from farmer to wholesaler to stores and restaurants -- it's hard to prove that a lifetime of veganism would save even a single animal.

Cerulli also comes to the realization that being a vegan and growing his own food aren't harmless. This is a man who buys Christmas trees near power lines, figuring that they will be cut down anyway, and who has an ethical dilemma over killing an insect. Yet as he tried to grow his own food, he kept having his crops ravaged by gophers and deer. After failed attempts to quell the problem by capturing and relocating the gophers and building more elaborate fencing, he came to the realization that he needed to start shooting them with his BB gun. He then learned from others farmers about how many deer need to be killed to protect their crops. The growth of non-meat foods still involves plenty of indirect death. So he starts thinking about the cycle of life and death more deeply, a journey that progresses until he himself becomes a hunter in order to come face to face with the act of killing an animal for meat.

The resolution may come for one innovations that I'm most hoping for in the coming years: synethic meat. Hopefully someday, we can get the same taste, pleasure, and nutrition without the death.

One other loose end from the book that I found interesting: The campaigns for eating vegetables and curbing animal cruelty were initially totally separate. There were ads in the early 1900s about how vegetarian diets helped the University of Chicago football team play so well and be so manly.

Friday, February 14, 2014

Looping with SAS Macros

SAS macros can be used to loop through any list stored in a string of text and do a repetitive process on each element of the list. You can also create a list dynamically from an existing SAS dataset.

Step 1: Read in a list of states of abbreviations from an existing dataset

First, you need to create your list of elements. It can be as simple as listing them in a macro variable:

%let list = apple banana grape;

Or you can read them from an existing SAS dataset using "separated by." In this example, I am reading two lists: states and state abbreviations. Notice that I'm separating my state list by slashes, so that "Rhode" and "Island" won't look like two different elements when it comes time to loop. 

proc sql noprint;
select state, abbr into : full_list separated by "/", : abbr_list separated by " " from greg.states;
quit;

Step 2: Count the elements in the list

Now, I'm going to invoke a macro to count the number of elements in the list. Because both of my lists are the same number of elements, I only need to do this once. I start at 0, then increment by 1 each time I scan through the list and see another string of text separated by my delimiter (here, a slash).

%macro varcount;
%global var_num;
%let var_num=0;
%do %while(%qscan(&full_LIST,&var_num.+1,"/") ne %str());
%let var_num = %eval(&var_num+1);
%end;
%mend varcount;
%varcount

Step 3: Assign each element in to a numbered macro variable

Now, I am going to use the count I got above and loop through s times, from 1 to the maximum value. Each time I go through the loop, I'm going to define a numbered macro variable. The first full name will be "Alabama", stored in a macro variable called "full1". The first abbreviation will be "AL", stored in a macro variable called "abbr1". The repeats all the way through "full51" and "abbr51".

%macro numvars;
%do s =1 %to &var_num;
%global full&s. abbr&s.;
%let full&s. = %qscan(&full_LIST.,&s,"/");
%let abbr&s. = %qscan(&abbr_LIST.,&s," ");
%end;
%mend numvars;
%numvars

Step 4: Loop through each element

Here is where the magic starts to happen. I am again looping through s, from 1 to the number of elements that I have. Each time I'm in the loop and want to refer to a state, I should use &&full&s..

As SAS revolves macros, it turns two &'s into one, and turns single & into the macro variable name it finds up until a period.

Original: &&full&s..
First pass (when s = 1): &full1
Second pass (look for value of &full1): Alabama

Within the loop, you can put ANY TEXT, and it will be repeated for each element in the list. Here, I will get a case statement with 51 when clauses, one for each state. Notice that the macro is invoked below, in the proc sql step. You can do pieces of a step like I've done here, or you can have a full step, or 50 full steps. I could start with a step where I am making a data set using only the Alabama rows, and then I can do a ton of transformations on it, then repeat for each new step. The possibilities are endless!

%macro states;
%do s = 1 % to &var_num;
when "&&full&s.." then "&&abbr&s.."
%end;
%mend states;

Proc sql;
select case %states end as state_abbr from full_states;
Quit;