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) !

The Old Shoe Theory of Relationships

When our daughter was young, some friends saw uncanny resemblances between her and me, and remarked that “Karthik could have married an old shoe and still produced a child that looks like this”, essentially remarking that at least as far as looks were concerned, the wife hadn’t contributed much (Bambi eyes apart).

Over time, the daughter has shown certain other traits that make her seem rather similar to me. For example, she has the practice of sticking her tongue out when performing tasks that require some degree of concentration. She laughs like me. Screeches like me. And makes a “burl-burl” noise with her fingers and lips like I do (admittedly the last one is taught). I’ve already written a fuller list of ways in which the daughter is similar to me.

If you are single and looking to get into a long-term gene propagating relationship, you inevitably ask yourself the question of whether someone is “the one” for you. We have discussed this topic multiple times on this blog.

For example, we have discussed that as far as men are concerned, one thing they look for in potential partners is “consistent fuckability“. We have also discussed that whether someone is “the one” is not a symmetric question, and when you ask yourself the question, you either get “no” or “maybe” as an answer, implying that you need to use Monte Carlo algorithms. Being married to the Marriage Broker Auntie, I’m pretty sure I’ve discussed this topic on this blog several other times.

This is a tubelight post – at least two years too late (the “old shoe” comment came that long ago), but this is yet another framework you can use to determine if you want someone as your long-term gene-propagating partner. Basically you replace yourself by an old shoe.

In other words, assume that the genes that you will propagate along with this person will result in kids who look like them, talk like them, act like them, and rather than a “next best thing”, might just be a superior version of them. Ask yourself if you are okay with having a child who is like this, and who you will be proud of.

This is another Monte Carlo type question, but if the answer in this case is no (you may not be particularly proud of a progeny who is exactly like the person under consideration – for whatever reason), you don’t want to risk propagating genes with this person. In case the answer is yes – that you are willing to parent a child who is exactly like this counterparty, then you can seriously consider this long term relationship.

Again, this applies if and only if you’re looking for a gene propagating relationship. If that isn’t an issue (no pun intended), then you don’t need to worry about old shoes of any kind.

Ticking all the boxes

Last month my Kindle gave up. It refused to take charge, only heating up the  charging cable (and possibly destroying an Android charger) in the process. This wasn’t the first time this was happening.

In 2012, my first Kindle had given up a few months after I started using it, with its home button refusing to work. Amazon had sent me a new one then (I’d been amazed at the no-questions-asked customer-centric replacement process). My second Kindle (the replacement) developed problems in 2016, which I made worse by trying to pry it open with a knife. After I had sufficiently damaged it, there was no way I could ask Amazon to do anything about it.

Over the last year, I’ve discovered that I read much faster on my Kindle than in print – possibly because it allows me to read in the dark, it’s easy to hold, I can read without distractions (unlike phone/iPad) and it’s easy on the eye. I possibly take half the time to read on a Kindle what I take to read in print. Moreover, I find the note-taking and highlighting feature invaluable (I never made a habit of taking notes on physical books).

So when the kindle stopped working I started wondering if I might have to go back to print books (there was no way I would invest in a new Kindle). Customer care confirmed that my Kindle was out of warranty, and after putting me on hold for a long time, gave me two options. I could either take a voucher that would give me 15% off on a new Kindle, or the customer care executive could “talk to the software engineers” to see if they could send me a replacement (but there was no guarantee).

Since I had no plans of buying a new Kindle, I decided to take a chance. The customer care executive told me he would get back to me “within 24 hours”. It took barely an hour for him to call me back, and a replacement was in my hands in 2 days.

It got me wondering what “software engineers” had to do with the decision to give me a replacement (refurbished) Kindle. Shortly I realised that Amazon possibly has an algorithm to determine whether to give a replacement Kindle for those that have gone kaput out of warranty. I started  trying to guess what such an algorithm might look like.

The interesting thing is that among all the factors that I could list out based on which Amazon might make a decision to send me a new Kindle, there was not one that would suggest that I shouldn’t be given a replacement. In no particular order:

  • I have been an Amazon Prime customer for three years now
  • I buy a lot of books on the Kindle store. I suspect I’ve purchased books worth more than the cost of the Kindle in the last year.
  • I read heavily on the Kindle
  • I don’t read Kindle books on other apps (phone / iPad / computer)
  • I haven’t bought too many print books from Amazon. Most of the print books I’ve bought have been gifts (I’ve got them wrapped)
  • My Goodreads activity suggests that I don’t read much outside of what I’ve bought from the Kindle store

In hindsight, I guess I made the correct decision of letting the “software engineers” determine whether I qualify for a new Kindle. I guess Amazon figured that had they not sent me a new Kindle, there was a significant amount of low-marginal-cost sales that they were going to lose!

I duly rewarded them with two book purchases on the Kindle store in the course of the following week!

The Cow-Postman Paradigm

I thought I had written about this already sometime ago, but I can’t seem to find it. Anyways.

When we were in class 6, we were taught to write essays in Hindi. “Taught to write” is a loose phrase there, for we were just given two essays and asked to mug them up. One was on “gaay” (cow) and the other was on “daakiya” (postman). The teacher had reliably informed us that while the exam would have a question requiring us to write an essay, the topic would be either “gaay” or “daakiya”. And it was a given that mugging up the given essay and spitting it out would get full credit.

To my credit (I used to be topper types, you remember?), I mugged up both. This girl who was at my van stop didn’t. She only mugged up “gaay” since that seemed to be the more likely to appear in the exam. Another girl, two years our senior, who had been through this routine, consoled her saying that if the question is for “daakiya”, she can still write about “gaay”, and she would get at least 2 out of 5 marks.

As it happened, the exam required us to write a question on daakiya. The girl in my van stop wrote an essay on gaay. And got 0 for it.

This brings me to a fairly common practice, at least in India, of coming up with a set of answers and spouting them out irrespective of what the question is. And I call this the “cow-postman paradigm” based on the above anecdote.

A popular example of the cow-postman paradigm can be seen at beauty contests, where the beauty queens spout inanities in order to show off their “nobility” and show themselves as being “worthy ambassadors” of the Miss Whatever project. The most famous example of this probably is Priyanka Chopra, who answered “Mother Teresa” when asked who is the “living woman she most admires” (Mother Teresa had died two years before Priyanka Chopra became Miss World).

Politicians and PR agents are also masters of the Cow-Postman paradigm. Irrespective of what interviewers ask, they simply spout their prepared lines  in the hope that it will sometimes answer the question. In case the interviewer decides to be snarky, this can be made fun of. In most cases, the “leaders” get away with it.

It is possibly these instances of “getting away with it” (or even “benefitting from it”) that results in propagating the Cow-Postman paradigm. Maybe it is a worthy effort of journalists, possibly at listicle-based publications, to make note of and make a list of such famous cow-postman instances. That’s the only way we can cure it!

 

When Jayalalithaa Ruined My Birthday

As the Babri Masjid was being brought down, I celebrated.

I had come up with this line a few years ago, and said that whenever I write my autobiography, I’m going to begin it this way. And while I’m not as certain nowadays that I’ll write an autobiography, in case I write one I’ll still use this line to open it.

This line could also be used in a logic class, the kind of lectures I delivered fairly frequently between 2012 and 2016, illustrating logical fallacies. For this one might induce the correlation-is-causation fallacy in your head, and you might think that if I celebrated while the Babri Masjid was being brought down, I must be a Muslim-hating bigot. So here is what will be the second line in my autobiography, whenever I write it:

It was my tenth birthday, and there was a party at home.

There is something special about your birthday falling on Sundays. The first time that happened, in 1987, was also the first time that my parents organised a birthday party for me. I’m too young to know how many people came, but there were a lot of people filling our house that evening. We had professional catering and I got so many gifts that I got to using some of them (such as Enid Blyton story books) several years later.

Maybe I read some of the books around the time my birthday fell on a Sunday once again, which happened in 1992. That also happened to be the next time I had a party at home, and this one was different, with less than ten guests, with all of them being my classmates in school.

My mother had done the cooking that day. We played cricket and hide-and-seek, and some other party games (which I don’t remember now). And then later that evening, news on television told us that the Babri Masjid had been brought down that day and riots had started.

 

The only thing that registered in my head then was that there would be no school the next day, and I didn’t know when I would distribute the chocolates I had bought for the customary school distribution.

The long term impact, though, was that my birthday got inextricably linked to the Babri Masjid demolition.

So over the years, when people have searched for an anchor to remember my birthday, they’ve inevitably used news of the anniversary of the Babri Masjid demolition. This morning, for example, I got a message that said “Happy birthday. Babri Masjid article came up somewhere 🙂 “. Another friend messaged me to remind me of what I’ve written to being this post.

A couple of years back, a friend messaged me later in December apologising for missing my birthday, adding that he had missed it because there wasn’t much news about the Babri Masjid anniversary. This must have been in 2016, which was among my worst birthdays because beyond close family, hardly anyone wished me that day.

And I blame former Tamil Nadu chief minister Jayalalithaa for that, for after a rather prolonged illness, she had passed away the previous night. And that meant that the news waves in India on the 6th of December 2016 were filled with news of Jayalalithaa’s demise, with any Babri Masjid anniversary stuff being pushed to the backburner.

The situation got rectified last year with it being the 25th anniversary of the Babri Masjid demolition, so the number of people who wished me went back to “normal levels”. And perhaps with elections being round the corner again, and without an important death to distract the news, I’m guessing that Babri Masjid has made enough news today for enough people to remember my birthday!

I must also take this opportunity to thank certain entities who unfailingly wish me on every birthday.

Oh, and I discovered this morning that today is 6/12/18. And my wife helpfully added that I turned 36 today.

Now I feel really old!