Glass Houses

When I was in middle or high school, I learnt about the greenhouse effect, and learnt from my textbook that “glass houses” are an example of greenhouses. These glass houses are used to control temperature inside, I read, and this helps to grow a specific kind of plants. While all this sounded good in theory, the problem was that it didn’t really fit the example I had seen in real life.

I’ve known glass houses from the time I was very young, thanks to the one in Lalbagh in Bangalore, which was erected in 1889 to commemorate the visit of Prince Albert Victor (Queen Victoria’s husband) to Bangalore. Lalbagh being located close to home,  I would go there every other weekend, and the routine consisted of walking through the glass house and sitting on one of the bull statues in front of it.

From memory (I’ve hardly gone to Lalbagh in adulthood), the glass house was always empty, except for exhibition times in August and January every year, when it would be full of flowering plants. And the glass house being largely open, the temperature and humidity insight wasn’t noticeably different from that outside. And that meant that I couldn’t particularly appreciate my science lesson that glass houses are greenhouses.

All that changed yesterday when we visited the Palm House in Kew Gardens in London. It was an unusually warm day for February in London, but even then the difference between the inside and outside of the glass house was rather noticeable. The Palm House houses tropical plants from Asia, Africa and the Americas, and consequently a tropical weather is maintained. And this is achieved by dint of it being a glass house (i.e. a grenhouse), and also frequent waterings to increase humidity in the house. And this meant that while it’s still winter in London, tropical plants were blooming and buzzing in the Palm House!

I don’t know what it will cost Lalbagh to maintain a permanent collection of plants in the glass house. Also Bangalore can get warm in summer and maintaining a different temperature inside may not be desirable. Nevertheless, thinking back, it would have immensely helped me in high school had the glass house in Bangalore actually functioned as a Glass House!

Vlogging!

The first seed was sown in my head by Harish “the Psycho” J, who told me a few months back that nobody reads blogs any more, and I should start making “analytics videos” to increase my reach and hopefully hit a new kind of audience with my work.

While the idea was great, I wasn’t sure for a long time what videos I could make. After all, I’m not the most technical guy around, and I had no patience for making videos on “how to use regression” and stuff like that. I needed a topic that would be both potentially catchy and something where I could add value. So the idea remained an idea.

For the last four or five years, my most common lunchtime activity has been to watch chess videos. I subscribe to the Youtube channels of Daniel King and Agadmator, and most days when I eat lunch alone at home are spent watching their analyses of games. Usually this routine gets disrupted on Fridays when the wife works from home (she positively hates these videos), but one Friday a couple of months back I decided to ignore her anyway and watch the videos (she was in her room working).

She had come out to serve herself to another serving of whatever she had made that day and saw me watching the videos. And suddenly asked me why I couldn’t make such videos as well. She has seen me work over the last seven years to build what I think is a fairly cool cricket visualisation, and said that I should use it to make little videos analysing cricket matches.

And since then my constant “background process” has been to prepare for these videos. Earlier, Stephen Rushe of Cricsheet used to unfailingly upload ball by ball data of all cricket matches as soon as they were done. However, two years back he went into “maintenance mode” and has stopped updating the data. And so I needed a method to get data as well.

Here, I must acknowledge the contributions of Joe Harris of White Ball Analytics, who not only showed me the APIs to get ball by ball data of cricket matches, but also gave very helpful inputs on how to make the visualisation more intuitive, and palatable to the normal cricket fan who hasn’t seen such a thing before. Joe has his own win probability model based on ball by ball data, which I think is possibly superior to mine in a lot of scenarios (my model does badly in high-scoring run chases), though I’ve continued to use my own model.

So finally the data is ready, and I have a much improved visualisation to what I had during the IPL last year, and I’ve created what I think is a nice app using the Shiny package that you can check out for yourself here. This covers all T20 international games, and you can use the app to see the “story of each game”.

And this is where the vlogging comes in – in order to explain how the model works and how to use it, I’ve created a short video. You can watch it here:

While I still have a long way to go in terms of my delivery, you can see that the video has come out rather well. There are no sync issues, and you see my face also in one corner. This was possible due to my school friend Sunil Kowlgi‘s Outklip app. It’s a pretty easy to use Chrome app, and the videos are immediately available on the platform. There is quick YouTube integration as well, for you to upload them.

And this is not a one time effort – going forward I’ll be making videos of limited overs games analysing them using my app, and posting them on my Youtube channel (or maybe I’ll make a new channel for these videos. I’ll keep you updated). I hope to become a regular Vlogger!

So in the meantime, watch the above video. And give my app a spin. Soon I’ll be releasing versions covering One Day Internationals and franchise T20s as well.

 

Volatility and price differentiation

In a rather surreal interview to the rather fantastically named Aurangzeb Naqshbandi and Hindustan Times editor Sukumar Ranganathan, Congress president Rahul Gandhi has made a stunning statement in the context of agricultural markets:

Markets are far more volatile in terms of rapid price differentiation, than they were before.

I find this sentence rather surreal, in that I don’t really know what Gandhi is talking about. As a markets guy and a quant, there is only one way in which I interpret this statement.

It is about how market volatility is calculated. While it might be standard to use standard deviation as a measure of market volatility, quants prefer to use a method called “quadratic variation” (when the market price movement follows a random walk, quadratic variation equals the variance).

To calculate quadratic variation, you take market returns at a succession of very small intervals, square these returns and then sum them up. And thinking about it mathematically, calculating returns at short time intervals is similar to taking the derivative of the price, and you can call it “price differentiation”.

So when Gandhi says “markets are far more volatile in terms of rapid price differentiation”, he is basically quoting the formula for quadratic variation – when the derivative of the price time series goes up, the market volatility increases by definition.

This is what you have, ladies and gentlemen – the president of the principal opposition party in India has quoted the formula that quants use for market volatility in an interview with a popular newspaper! Yet, some people continue to call him “pappu”.

Tigers and Bullwhips

Over three years ago, well before our daughter was born, my wife’s cousin had told us that she likes to watch her daughter’s TV shows because they contained “morals”, which were often useful to her at work. While we never took to the “moral” TV show she mentioned (Daniel Tiger – it is bloody boring), I have begun to notice that there are important management lessons in other popular children’s stories.

So I hereby begin this blog series on what I call the “Kiddie MBA” – basically business lessons from kids’s stories. And we will start with that all-time classic, The Tiger Who Came To Tea, by Judith Kerr. 

The basic premise of this story that remains a classic fifty years after being published is what operations managers call the “bullwhip effect“. Sometimes a business, possibly in trading, can be subject to a sudden demand, which the business will not be able to fulfil given its current inventories.

As a result of this sudden one-time spurt in demand, the business increases its future forecasts of demand, and starts keeping more inventory. This business’s supplier sees this increased demand and increases its own forecasts upward, and increases its own inventory. Thus, this one-time demand “shock” percolates up the supply chain, giving the illusion of higher demand and with each layer in the chain keeping higher and higher inventory.

And then one day the retailer will realise that this demand shock is not replicable and moves forecasts downwards, and this triggers a downward edge in the forecasts up the value chain, and demand at the source comes crashing down.

Being a children’s book, The Tiger Who Came To Tea eschews the complexity of the supply chain and instead keeps the story at one level – at the level of the household of the protagonist Sophie (not to be confused with Sophie the Giraffe).

The premise of the story is the demand shock for supplies in Sophie’s home – a tiger comes home for tea and eats up everything that’s at home, drinks up all that’s there to be drunk (including “all the water in the tap”) and leaves, leaving nothing for Sophie and her family.

Assuming that the tiger will return the next day, Sophie’s family stocks up heavily, including “lots of tiger food”. And the tiger never arrives.

My guess is that the rest of the supply chain is left as an exercise to the reader – how the retailer who sold Sophie the tiger food will react to the suddenly higher demand for food (and for tiger food), how this retailer’s supplier will react, whether the tiger visits some other household for tea the next day (making this demand “regular” at the retailer’s level), and so forth.

Perhaps this is what makes this such as great book, and an all-time classic!

Government and markets

It’s been a while since I wrote a post like this one – I remember a decade ago, I used to flood my blog with such stuff.

In any case, last week, in response to the “10yearchallenge” meme, Nitin Pai of Takshashila wrote an Op-Ed in the Print on how India has changed in 10 years. While he admits that the country has grown and the lives of people has improved in some ways, the article leads with the headline that India should be be ashamed of what has happened in the last 10 years. This paragraph is possibly representative of the article:

While individual Indians seem to have done well over the past decade, India is more or less where it was. Worse, politics and policy priorities seem to have regressed to 1989.

Reading through the article (I encourage you to read it, it’s good – never mind the headline), I found a clear and distinct pattern in the kind of things where things have gotten better in India and where things have gotten worse.

Everything where markets function, or where the government doesn’t have much of a role, things have changed significantly for the better. Everything where the government has an outsized role, either because it is the government’s job or the sector is overregulated, things have gotten worse. So our cities have gotten more crowded. Infrastructure has gotten worse. Law and order has regressed. And this has had little to do with the party in power – whatever the government touched has regressed.

Looking at it in another way, Indians seem to be highly capable of making their lives better by coordinating using the invisible hand of the market. However, we seem incapable of making our lives better by coordinating using the government process.

From this perspective, there is one easy way to progress – basically reduce the government. Get rid of the overregulations. Get the government out of things where it shouldn’t be. Give a freer hand to the market.

Unfortunately, ahead of general elections this year, we see most parties taking a highly statist line. This is a real tragedy.

High command and higher command

Last week a friend messaged me early in the evening and asked if we could meet for drinks later in the evening. I almost replied to him saying that I’ll get back to him once I’d “checked with High Command”, but then realised that I now have not one but two high commands.

Just the previous day, I had watched Liverpool FC play at Manchester City. This was the first time I was watching live football this season, primarily because we don’t have cable at home. Since I didn’t want to “jinx Liverpool“, I waited for a game where they were not the favourites to make my watching debut, and Manchester City away seemed like the best bet for that.

When I told the senior high command that I wanted to go watch this game, and if she could take care of the junior high command during the duration of it, she had no objections. Just as I was about to leave for the game, though, the junior high command (or maybe I should call her the higher command) decided to throw a tantrum. Some distractions and the promise to watch endless episodes of Bing and Pablo were required to allow me to step out.

The next day, I was pretty sure that the high command would be cool with me going out for evening drinks. We had discussed our lives at the turn of the year, and had agreed that we should meet more people, and I had specifically made it a point that I’d go out more on evenings and weekends. Still being early in the year, I knew the high command would be okay with me going out. I wasn’t sure if the higher command would be okay though.

The story played out the same way as the previous day. I picked up higher command from the nursery. High command then returned from office, and it was time for me to step out. And higher command wasn’t pleased at all. Once again it took distractions to allow me to step out. And it turned out that the price of the bribe was rather high that evening. When I returned, the higher command was watching Bing, and didn’t even turn around to look at me (normally she’s all over me when I come home from anywhere).

Another friend just asked me if we can meet on Wednesday evening. Again I was about to type “let me check with the high command”, and then decided it is prudent to make that plural. Once again I know the high command will be okay with this but the higher command may not be.

Kader Khan and Slippery Fish

Until I read his obituaries, I didn’t know that the just-deceased actor Kader Khan was also a dialogue writer, having written the dialogues for several iconic Amitabh Bachchan movies such as Laawaris, Muqaddar Ka Sikander and Agneepath (I highly recommend his obituaries by GreatBong and by The Economist. Both are brilliantly written and highly informative).

When I found that Kader Khan wrote the dialogues for Agneepath, I was reminded of this old piece written by Nitin Pai, Director of the Takshashila Institution, that referenced a particular dialogue from Agneepath. In that, he talks about international relations and the “law of the jungle” that operates there. In fact, I recommend you see that dialogue from Agneepath. It’s on youtube:

Major level up in terms of my respect for Kader Khan after having re-watched this. I only knew him as a masterful comedian and actor as I mentioned. Now I want to go back and watch more of the movies for which he wrote dialogues.

In any case, if you watched the above video from Agneepath, you see that Amitabh Bachchan talks about the law of the jungle in the form of a food chain. I don’t know the Hindi names of animals precisely, but he talks about a frog being eaten by a snake, and a wolf being killed by lions, etc.

The talk of the food chain reminded me of another song which is my daughter’s favourite nowadays.  This talks about the marine food chain. Watch the song here:

I had no idea about this song until the daughter started singing it. In fact, since she liked the third stanza of the song best (“tuna fish, tuna fish”), it had also caused us a bit of a problem one weekend when she kept requesting for it but we couldn’t find it on any streaming service (you should ask for “slippery fish”).

I’m pleasantly surprised that they teach about the food chain to children as young as two years old, since it introduces to them the concept of death, and the fact that animals eat other animals to survive. Somehow I had thought that kids are told that all animals co-exist like they do in Peppa Pig (as an aside, I wonder what will happen to Peppa Pig and friends when it’s time for them to grow up and start dating), and that the concept of death is also taboo in some circles.

Anyway I’m glad my daughter likes the song. Maybe it’s time to let her graduate to the Amitabh Bachchan dialogue? But that would involve her learning Hindi, which is my wife and my “secret language” (when we’ve to say something we don’t want the daughter to understand) !