Programming assignments and blind men and the elephant

Evaluating a tough programming elephant is like the story of the blind men and the elephant. Let me explain.

The assignments that I’ve handed out as part of my Spreadsheet Modelling for Business Decision Problems course at IIMB involve fairly complex spreadsheet modelling (as the name of the course suggests). Thus, while it is a lot of effort on behalf of the student to do the assignment, it is also a lot of effort on my behalf if I’ve to go through the code line by line (these guys code using VBA macros), understand it and evaluate them.

Instead, I have come up with a set of “tests” – specific inputs that I give to the program (I’ve specified what the “front sheet” should look like so this is easy), and then see if the program gives out the desired outputs. Either way, I dig a little deeper and see if they’ve done it right, and based on that I grade the assignment.

If the assignments that they’ve turned in are elephants, it’s too much of an effort for me to open my eyes and actually see that they are elephants. Hence, I feel around, and check for a few different components to make sure they’ve submitted elephants. So for this assignment I might check if the trunk is like a snake, and if so, they’ve passed. For another assignment, I might check if the legs are like trees, and if they are, pass them. And so forth.

Now, this is evidently not perfect. For example, if you know that I’ll only check for the trunk to be like a snake, you’ll just submit a trunk that’s like a snake rather than submitting a full assignment! But if you don’t know what I’m going to check for, then it might be possible that you’ve only submitted a snake, I look for treetrunks and not finding them, give you a failing grade! There is a little bit of luck involved on both sides, but that’s how things work!

Extending this analogy to software testing, you can think of that too as an exercise of blind men learning about an elephant. The testers are the blind men of Indostan, trying to find out if the piece of code they’ve been given is an elephant. Each tester pokes around at a different part of the beast, trying to confirm if it fits what they’re looking for. And if the beast has a knife, a snake, a fan, a wall, a tree and a rope as part of it, it is declared as an elephant!

Speaking of software testing, I came across this brilliant video of a class in Hyderabad where software testing is being taught. Enjoy (HT: V Vinay).

Uber’s new pricing structure

So Uber has changed its pricing structure in Bangalore. Earlier they nominally charged Rs. 50 fixed, Rs. 15 per kilometer and Rs. 1 per minute, and then slapped a 35% discount on the whole amount. From today onwards the new fare structure is Rs. 30 fixed, Rs. 8 per kilometer and Rs. 1 per minute, without any further discounts. They’re marketing it using the Rs. 8 per kilometre number.

I took a ride this afternoon under the new fare structure, and the bill was Rs. 152, about the same as it would have been under the old fare structure. In that sense, I guess this was an “average ride”, in terms of the distance by time covered. This was the kind of ride where their assumption on distance travelled per unit time (in coming up with their new formula) was exactly obeyed!

So how do we compare the old and new formulae? We can start by applying the discount on the nominal numbers of the old formula. That gives us a fixed cost of Rs. 32.5, a per kilometer cost of Rs. 9.75 and a per minute cost per 65 paise. We can neglect the difference in fixed cost. Comparing this to the new cost structure, we find that the passenger now gets charged a lesser amount per kilometre, but a higher amount per minute.

In face, taking the “slope” between the old and new rates, the per kilometre cost has come down by Rs. 1.75 while the per minute cost has risen by 35 paise. Taking slope, this implies that Uber has assumed a pace of a kilometre per five minutes, or twelve kilometre per hour.

So if your journey is going to go slower than twelve kilometres per hour, on average, you will end up paying more than you used to earlier. If your journey is faster than twelve kilometres per hour, then you pay less than you did under the previous regime.

A few implications of the new fare structure are:

1. Peak hour journeys are going to cost more, for they are definitely going to go slower than twelve kilometres an hour
2. Your trips back from the pub should now be cheaper, for late nights when the roads are empty you’ll travel significantly faster than twelve kilometres an hour
3. What does this imply for the surge pricing in the above two cases? I think the odds of a surge during peak office hours will come down (since the “base price” of such a trip goes up, which will push down demand), and  the odds of a surge late on a Friday or Saturday night might go up (since base fare has been pushed down for that).
4. The Rs. 30 fixed cost implies that if a driver travels at 12 km/hr when looking for a new ride, the gap between rides for a driver is 11.5 minutes (if the driver spends X minutes, he will travel X * 12/ 60 kilometres in that time. The compensation for this combination is X + X*12/60 * 8, which we can equate to 30. This gives us X = 11.54).
5. Trips to/from the airport will now be cheaper, for you can travel much faster than 12 km/hr on that route. So Uber will become even more competitive for airport runs. Again this might increase probability of a surge at peak flight times.

I continue to maintain that Uber has the most rational price structure among all on-demand taxi companies, since the fare structure fairly accurately mirrors drivers’ opportunity costs. Ola doesn’t charge for the easily measurable time, and instead charges for “waiting time”, which is not well defined. Ola also has a very high minimum fare (Rs. 150). I wonder how they’ll play it if their planned acquisition of TaxiForSure goes through, since TaxiForSure was playing on the short trip model (with minimum fares going as low as Rs. 49). Given the driver approval before a ride, though, I doubt if anyone actually manages to get a Rs. 49 ride from TaxiForSure.

Times continue to be interesting in the on-demand taxi market. We need to see how Ola responds to this pricing challenge by Uber!

Cancellation charges in the airline industry

So seat 2B in flight number I5 1322, Air Asia flight from Bangalore to Goa this morning, went unfilled. I wasn’t on this flight, but perhaps for that precise reason I can assure you that the above statement is true. For that seat belonged to me, as I had booked my tickets to go to the Goa Project.

So I initially decided to go to the Goa Project, and booked my tickets for it (on AirAsia). And then work and other things meant that I decided against going, but when I went to the AirAsia website to cancel my ticket, I realised that I wasn’t able to do it! Essentially AirAsia has no concept of cancelling a flight!

This is option pricing taken to one extreme, where the entire price is taken in the form of an option premium! The airline industry was at the other extreme not so long ago – where options weren’t priced at all. In other words, until a decade or a bit more back, you could change or cancel your bookings at little extra cost, though this optionality (and other things such as regulation) meant that the ticket was  quite expensive!

Now it seems like some of the “extreme low cost carrier” (such as AirAsia or RyanAir) have moved to the other extreme – where there is no concept of cancellation. And I’m not sure of the wisdom of this strategy. For I believe that this strategy does not maximise either the social utility or the airline’s profits.

The social utility bit is easy to see – I ended up paying full price for a ticket that I didn’t travel on, so I’m hurt. The marginal passenger who wanted to travel on today’s flight to Goa but didn’t find a ticket was hurt (this person could’ve flown had I cancelled my ticket). And the airline missed an opportunity to resell my ticket to someone else (potentially at a much higher price) and make money on it! So it’s a lose-lose situation all round.

The commercial aspect follows from the above – in case demand for this flight was low, then it perhaps made sense to not refund any of my money, for now the airline would not be able to sell the ticket to another passenger. However, if demand were higher (a very probable event), the airline missed an opportunity to make much higher revenue on this seat than what they did by making me not cancel it. I wave my hand here a bit, but it is easy to see that the airline is letting go of potential profits by not letting me cancel my ticket!

I’m not saying that the airline refund my full amount, or anything close to that – that doesn’t make sense for them since they’ve sold me an option. All I’m saying is that the price of zero (between total cost and option cost) doesn’t make sense. Even if the airline were to refund a thousand rupees (I paid around 6000 for the two-way fare) if I cancelled it, and the cancellation procedure were smooth, I would have cancelled it. And the expected revenues on this one seat would definitely exceed this kind of refund, you would expect?

Possibly it’s time for airlines to indulge in dynamic pricing for cancellations also. If the flight is near full, the airline can resell my cancelled ticket for a fairly high amount, so they can induce me to cancel by offering me a decent refund. If at the time I want to cancel, however, demand is low, then they need not offer me much. These things are not at all hard to price!

So by going extreme on the cancellation charges Air Asia and its ilk are leaving money on the table! If only someone were to tell them to pick it up!

How my IIMB Class explains the 2008 financial crisis

I have a policy of not enforcing attendance in my IIMB class. My view is that it’s better to have a small class of dedicated students rather than a large class of students who don’t want to be there. One of the upsides of this policy is that there has been no in-class sleeping. Almost. I caught one guy sleeping last week, in what was session 16 (out of 20). Considering that my classes are between 8 and 9:30 am on Mondays and Tuesdays, I like to take credit for it.

I also like to take credit for the fact that despite not enforcing attendance, attendance has been healthy. There have usually been between 40 and 50 students in each class (yes, I count, when I’ve bamboozled them with a question and the class has gone all quiet), skewed towards the latter number. Considering that there are 60 students registered for the course, this translates to a pretty healthy percentage. So perhaps I’ve been doing something right.

The interesting thing to note is that where there are about 45 people in each class, it’s never the same set of 45. I don’t think there’s a single student who’s attended all of my classes. However, people appear and disappear in a kind of random uncoordinated fashion, and the class attendance has remained in the forties, until last week that is. This had conditioned me into expecting a rather large class each time I climbed up that long flight of stairs to get into class.

While there were many causes of the 2008 financial crisis, one of the prime reasons shit hit the fan then was that CDOs (collateralised debt obligations) blew up. CDOs were an (at one point in time) innovative way of repackaging receivables (home loans or auto loans or credit card bills) so as to create a set of instruments of varying credit ratings.

To explain it in the simplest way, let’s say I’ve lent money to a 100 people and each owes me a rupee each month. So I expect to get a hundred rupees each month. Now I carve it up into tranches and let’s say I promise Alice the “first 60 rupees” I receive each month. In return she pays me a fee. Bob will get the “next 20 rupees”, again for a fee. Note that if fewer than 60 people pay me this month, Bob gets nothing. Let’s say Eve gets the next 10 rupees, so in case less than 80 people pay up, Eve gets nothing. So this is very risky, and Eve pays much less for her tranche than Bob pays for his which is in turn much less than what Alice pays for hers. The last 10 rupees is so risky that no one will buy it and so I hold it.

Let’s assume that about 85 to 90 people have been paying on their loans each month. Not the same people, but different, like in my class. Both Alice and Bob are getting paid in full each month, and the return is pretty impressive considering the high ratings of the instruments they hold (yes these tranches got rated, and the best tranche (Alice’s) would typically get AAA, or as good as government bonds). So Alice and Bob make a fortune. Until the shit hits the fan that is.

The factor that led to healthy attendance in my IIMB class and what kept Alice and Bob getting supernormal returns was the same – “correlation”. The basic assumption in CDO markets was that home loans were uncorrelated – my default had nothing to do with your default. So both of us defaulting together is unlikely. When between 10 and 15 people are defaulting each month, that 40 (or even 20) people will default together in a given month has very low probability. Which is what kept Alice and Bob happy. It was similar in my IIMB class – the reason I bunk is uncorrelated to the reason you bunk, so lack of correlation in bunking means there is a healthy attendance in my class each day.

The problem in both cases, as you might have guessed, is that correlations started moving from zero to one. On Sunday and Monday night this week, they had “club selections” on IIMB campus. Basically IIMB has this fraud concept called clubs (which do nothing), which recruiters value for reasons I don’t know, and so students take them seriously. And each year’s officebearers are appointed by the previous year’s officebearers, and thus you have interviews. And so these interviews went on till late on Monday morning. People were tired, and some decided to bunk due to that. Suddenly, there was correlation in bunking! And attendance plummeted. Yesterday there were 10 people in class. Today perhaps 12. Having got used to a class of 45, I got a bit psyched out! Not much damage was done, though.

The damage was much greater in the other case. In 2008, the Federal Reserve raised rates, thanks to which banks increased rates on home loans. The worst borrowers defaulted, because of which home prices fell, which is when shit truly hit the fan. The fall in home prices meant that many homes were now worth less than the debt outstanding on them, so it became rational for homeowners to default on their loans. This meant that defaults were now getting correlated! And so rather than 85 people paying in a month, maybe 45 people paid. Bob got wiped out. Alice lost heavily, too.

This was not all. Other people had bet on how much Alice would get paid. And when she didn’t get paid in full, these people lost a lot of money. And then they defaulted. And it set off a cascade. No one was willing to trade with anyone any more. Lehman brothers couldn’t even put a value on the so-called “toxic assets” they held. The whole system collapsed.

It is uncanny how two disparate events such as people bunking my class and the 2008 financial crisis are correlated. And there – correlation rears its ugly head once again!

 

On tea being served before a talk

Later this evening I’m planning to go for this talk on Temples of the Badami Chalukyas, being held at the Max Mueller Bhavan in Indiranagar.

The text of the invite (not present in the picture above) says that “tea will be served before the talk”. Now you might think that it’s no big deal – but in my opinion that’s one marker that sets apart what can be a high-quality fulfilling event for the audience member than one that is merely good.

There are two reasons that people go to talks like this one – one is for the talk itself. For example, the topic of today’s talk looks extremely promising and exciting, and inherent interest in the topic itself is likely to spur audience participation. The other reason people like to go for such talks is that they are good places to meet with other like-minded people, and that is where the tea before the talk comes into the picture.

At the Pratap Bhanu Mehta lecture at IISc two weekends back, there was no tea being served prior to the talk. As a consequence, everyone who arrived walked straight into the hall and took their seats. When I arrived there there seemed to be no conversation whatsoever taking place, and so I went and quietly took my seat. Looking around, however, I noticed a number of acquaintances, and people I wanted to get to connect to (people who could connect me to these people were also in the audience). However, there was no chance of going up and talking to them and indulging in what some people uncharitably call as “networking”. And after the event was over everyone was in a hurry to get home and there was no chance to talk!

This is where tea before the talk comes into the picture. When tea is being served, people usually stand around the service area (not to be confused with Cervezaria) and mill around talking. It’s a great occasion to catch up with old acquaintances who happen to be there, make new acquaintances (that both of you have come for the same (usually esoteric) lecture indicates that you have some common interests) and generally talk to people. And meeting interesting people (new or old) at an event is always a good thing and attendees go home much more satisfied than they would had they only consumed the lecture!

Hence it is of paramount importance that tea (or coffee or milk or water or beer) be served before the talk, for it gives an opportunity for people to talk to each other, to network and to get more out of other attendees than they would from the talk itself. And if you are the antisocial type who doesn’t want to meet other attendees, you can quietly go take your seat while others are having tea – they won’t even notice you!

Market-making in on-demand markets

I’ve written a post on LinkedIn about the need for market-making in on-demand markets. I argue that for a market to be on-demand for one side, you require the other side to be able to provide liquidity. This liquidity comes at a cost and the side needs to get compensated for it. Driver incentive schemes at Ola/Uber and two-part electricity tariffs are examples of such incentives.

An excerpt:

In a platform business (or “two sided market”, or a market where the owner of the marketplace is not a participant), however, the owner of the market cannot provide liquidity himself since he is not a participant. Thus, in order to maintain it “on demand”, he should be able to incentivise a set of participants who are willing to provide liquidity in the market. And in return for such liquidity provided, these providers need to be paid a fee in exchange for the liquidity thus provided.

Read the whole thing! :)

Airline delays in India

So DNA put out a news report proclaiming “Air India, IndiGo flyers worst hit by flight delays in January: DGCA“. The way the headline has been written, it appears as if Air India and Indigo are equally bad in terms of delayed flights. And an innumerate reader or journalist would actually believe that number, since the article states that 96,000 people were inconvenienced by Air India’s delays, and 75,000 odd by Indigo’s delays – both are of the same order of magnitude.

However, by comparing raw numbers thus, an important point that this news report misses out is that Indigo flies twice as many passengers as Air India. For the same period as the above data (January 2015), DGCA data (it’s all in this one big clunky PDF) shows that while about 11.65 lakh passengers flew Air India, about 22.76 lakh passengers flew Indigo – almost twice the number. So on a percentage basis, Indigo is only half as bad as Air India.

airlinedelays

The graph above shows the number of passengers delayed as a proportion of the number of passengers flown, and this indicates that Indigo is in clear second place as an offender (joined by tiny AirAsia). Yet, to bracket it with Air India (by not taking proportions) indicates sheer innumeracy on the part of the journalist (unnamed in the article)!

I’m not surprised by the numbers, though. The thing with Indigo (and AirAsia) is that the business model depends upon quick turnaround of planes, and thus there is little slack between flights. In winters, morning flights (especially from North India) get delayed because of fog and the lack of slack means the delays cascade leading to massive delays. Hence there is good reason to not fly Indigo in winter (and for Indigo to build slack into its winter schedules). Interestingly, the passenger load factor (number of passengers carried as a function of capacity) for Indigo is 85%, which is interestingly lower than Jet Airways (a so-called “full service carrier”)’ s 87%. And newly launched full service Vistara operated at only 45% in January!

We are in for interesting times in the Indian aviation industry.