Friday, November 13, 2015

Recent Reading

In breaking this blog's tradition of not delivering on promised posts, I will now write down my thoughts on the books, as some would recall, I had mentioned to be on my near term reading list a couple or so months ago.

(1) "On Thinking For Oneself" (Schopenhauer)

This essay is one I found very, very perceptive. And it's not even that long, so I'd highly recommend reading the essay itself rather than some random blogger's review of it. But in any case, let me restate the gist of the essay: The mind needs alone time. This insight is probably a lot more relevant today than in those presumably simpler times when Schopenhauer wrote the essay. For those who have read Schopenhauer otherwise, it is hard not to notice the patterns in this essay, too, that borrow ideas from Upanishads and Vedic philosophy (or Vedanta, if you prefer that term). He contends that making your mind work too hard and too often can be counter-productive: if you keep studying one thing after another, when do you think in peace about what you've read? The mind needs time to assimilate and mull over what it has consumed; it is only by this process that you internalize concepts to such level of comfort that you can think in an original way about them without distorting the fundamentals, and that is when you really 'own' or 'know' the concept; without it you merely 'borrow' it, or 'believe' it. Upanishads say something very similar when they state that the way to truly 'know' is by going through the stages of 'shravan', 'manan' and 'dhyaan' (in English: reading/listening, mulling it over in your head, and then meditating upon it). Anyway, I'll leave you with that. If you're interested: here's the full essay: http://insomnia.ac/essays/on_thinking_for_oneself/

(2) "Expected Returns" (Ilmanen)

If you're interested in Empirical Finance, this book is what I would call "most value per unit time", and it's no small feat given there are more than 500 pages here. To 'review' it would be rather preposterous of me, for I have studied finance not nearly as deeply as Antti Ilmanen, so all I can say is: I learned a lot reading this book. If you really want to understand at a fundamental level why prices of securities are what they are, and why they move in ways that they do, this I think is the best 'big picture' book for that I've ever read. It's not an introductory text, so if you're very, very new to this stuff, the CFA Level 1 material would be an appropriate pre-requisite for you before you start on this book, although I will say that you'll be surprised how much this book can magnify your understanding with even that little prior background. I would like to think that I have a much more rigorous education in Empirical Finance than what CFA affords, but even for me (and possibly those much more seasoned than me) this book is a treasure trove. There are pearls of wisdom on every other page. The book is probably not as mathematically rigorous as a text-book, but that is because it doesn't aim to be. It aims to develop intuition and understanding, and does an amazing job of it. Mathematical rigor is often more useful later on, once you have the necessary understanding to think of ideas, and are working on "testing" the ideas out. When what you seek is that level of mathematical rigour, a canonical book would be Cochrane's "Asset Pricing". But there's another caveat: To really be rigorous, you will have to get your hands dirty and collect, clean, organize data, write code, and run statistical tests on your own: merely reading Cochrane's book will not cut it for you. And that's nothing against his book: it is just that you can only learn by doing.

* * *

This is all I'm willing to say for now. I've also read 'Efficiently Inefficient', 'Fault Lines' and "Vivekachoodmani' so far, but haven't thought through them enough in leisure that I would feel sure I know something about their contents well enough to comment about them (refer back to review 1 of this post - now you know why I covered that first). I will write something on those books next. I'll most likely add stuff to the two books I already covered above as I 'mull over them' more as time passes. 

Wednesday, November 11, 2015

Diwali wishes to those who read this blog

Happy Diwali everyone.

No, really. This is not a post. This is just to wish you guys.

Hope you have a lovely Diwali, and hope you eat lots of peanuts in the winter sun in the coming days. Of course, this only goes for those of you who are in India.

If you're in the US, on the other hand, although I don't think you are, I hope you find a parking spot under some shade so you don't have to shovel everyday to uncover your car from under the snow.

If you're neither in India, nor in the US, who are you and why do you care about Diwali? Let me know. For you, I don't know what to wish, except recount the famous words of the great modern day philosopher and sage Salman Khan: "do whatever you want to do man".

Sunday, November 1, 2015

Important news that the popular media omitted - 1

In the past couple of weeks, there have been developments that IMHO are rather important but that, not all that surprisingly, aren't anywhere to be found on the news channels, even though they do have some modest print and digital representation. I'm thinking since this happens on a regular basis, I'll make this a regular feature on the blog.

So the 2 things I find most under-represented this week are:

(1) India started accepting gold deposits as if it were money, that is, you can earn interest on it. Gold had lost much of its legitimacy as money globally after the abandonment of the gold standard, but it looks like it is making a comeback, and India is at the helm! Now Warren Buffett can no longer say that there is no way to value it (the interest payments take away the abstraction by a great deal), or that 'civilized people don't buy gold'. Well, he still might say that. In any case, it is a very interesting experiment and deserves to be watched closely.

(2) India's states can now issue debt in the capital markets accessible to foreign investors. I believe it opens many doors, though prudence will be needed on the part of the state governments as not every open door should be walked through. I'll be watching closely.

Thankfully, TV channels did report the move away from China's well-known one child policy.

Sort of tangential, but since I'm vaguely criticizing news channels, here's an astute piece on why news can be harmful. Though, unlike me, it isn't quite concerned about errors of omission. 

Saturday, October 31, 2015

Aha!

Read this today:

'Tis an old maxim in the schools,
That flattery's the food of fools;
Yet now and then your men of wit
Will condescend to take a bit.

- Swift, "Cadenus and Vanessa"

Saturday, October 24, 2015

Postlude

Some truths can only be said in jest and some necessarily in verse;
and then there are some nutcases that must come out in a curse.
Which one of these I'll use today should be evident to you by now:
it's only fair that the mode I choose be one that really was hers.

There are those who always want back what to them is dear;
to champion them is not in me, despite how it might appear.
It's rather late, anyway, to want, but there's scope, still, to fear:
what if unlike so much else, love would not disappear?

[February 23, 2015 | Princeton]

Thursday, September 17, 2015

A sweet memory

It was the summer of 1993, I was 7. I used to study in class 2 B in The Air Force School. We lived 10 kms away from school, which, by New Delhi standards, was a school very far from your home, at least in the early 90s.  So we had a school bus fetch me from a stop close to my house, and a school bus would drop me back there in the afternoon. My dad, who served as an officer in United Bank of India in those days, would come home at around 6:30 PM everyday, and that is when I would see him after 7 AM in the morning, when I boarded the school bus. Most other kids in my class were children of Air Force Personnel who worked in the vicinity of the school, and therefore, came to the school to get their kids at 2 PM when the get-outta-here bells rang. Since I had a bus to fetch and drop me, my dad never came to school. It was nothing too bad, for it was the same for everyone who stayed far away. But for some reason, on this particular day in the second term of standard two, while sitting in the classroom for the last period of the day, I really really really wanted for my dad to come too. It was stupid, of course, and it was out of the blue. This day was just like every other day of the last one and a half years since I had joined this school, except for my sudden, silent, inexplicable urge to have him come pick me up. When the bells rang, and the class teacher organized all of us in a queue to show us out to the main gate of the school, my urge intesified. I remember distinctly how much at that moment I felt like I would hate, hate, hate to step into the bus, find an empty seat, keep my bag on my laps, and look out the window. I just couldn't bear to do it that day, for reasons unfathomable to me even today. The queue started moving, and approached the main gate in a couple of minutes. My dad was standing there. I don't merely use a figure-of-speech when I say that I closed my eyes and opened it again to make sure who I was looking at was my dad. There was no discernible reason that of all the days in the last one and a half years, today would be the day that he would show up randomly. To this day it ranks as one of my happiest few moments, those microseconds in which I felt ineffably infinite.


For many days that followed, I wondered to myself during quiet moments. Did I really bring him there by sheer will of urge? Some months later, I tried really hard to "re-want" him there. At around 1:30 PM I started doing "God please make Papa come fetch me today" repeatedly in my head, but it didn't quite work.

Tuesday, September 15, 2015

Dude!

Sometimes, I come home, put something on the TV (it doesn't even matter what) and then go straight to the kitchen, rummage the fridge and the cupboards for anything edible, and manage to eke out a diverse collection of distinct eatables with little compatibility with each other, and go back to the sofa in front of the TV. Then just as I am sitting down, I stand back up, and bring a can of Pepsi, and come back.

And then I eat. And I eat, and eat.

Today was one of those days.

Yeah, and then I feel guilty. Sometimes, I feel so guilty I decide to put it on the blog to shame myself as punishment. Oh, yeah, no kidding.

Friday, August 28, 2015

Leverage and Volatility


Suppose a trader predicts a given stock to rise by 25% over the next 10 days. Of course, if he is unleveraged, if the stock does indeed rise by 25% in 10 days, his 10-day return will be 25% irrespective of how volatile the stock price was in the interim. This, however, is far from true were he leveraged (i.e.trading on margin, as opposed to trading unleveraged while taking outside loan for providing capital). If he was 300% leveraged, then his return at the end of 10 days, is far from 100% (4 times 25%) as one would naively imagine, but a devastating -47%, in the volatile scenario 1. It is only in the non-volatile scenario 2 that leverage actually multiplied his returns.

Friday, August 21, 2015

Notes to myself on Investing

The biggest enemy of an otherwise prudent investor is an inability to sit tight. If he only acts upon his strongest convictions, in terms of putting on trades, and lets the low conviction trades pass by without feeling compelled to "see what happens once I put it on", he will over the long term be profitable. I have learned this from experience, but it is echoed by such great investors as Warren Buffett, that I do not have to worry as much about depending solely on my experience. Another note: don't depend solely on anything, irrespective of what thing it is. Well, depend on it at times, but don't bet the bank on it.

Of course, all this assumes that he is otherwise prudent, that is, understands the mechanics of the global markets well. This again, is not a 'talent'. It is a skill developed through self-effort. Self-effort, again, does not translate to merely working hard, although working hard is an indispensable part of it. In the context of investing, working hard entails reading a lot: books, academic research, market research. If hard-work was all, you could just maximize your profits by maximizing the numbers of pages read. However, this indiscriminate focus on quantity falls short on three things:

(1) Separating wheat from chaff: Deciding what to absorb and what to ignore is important, because much of what is out there has greater potential to harm than to benefit. Partly, this discrimination comes from experience, but I hope that not all of it must come through experience, because experience in this case often means trading losses. There is some respite. Discrimination also comes from a general attitude of thinking for oneself, even when reading. Too much reading is no better than gluttony: you become so busy eating you forget you have to clean and eat. Arthur Schopenhauer expresses it very will in his essay "On Thinking For Oneself":
The visible world of a man’s surroundings does not, as reading does, impress a single definite thought upon his mind, but merely gives the matter and occasion which lead him to think what is appropriate to his nature and present temper. So it is, that much reading deprives the mind of all elasticity; it is like keeping a spring continually under pressure. The safest way of having no thoughts of one’s own is to take up a book every moment one has nothing else to do. 
(2) Reading is not understanding: You have got to leave enough time to mull over things you have read, but perhaps this belongs to the previous bullet point. What definitely belongs here is to emphasize that it is very easy to misunderstand content when your fundamentals are not strong. Therefore, as important as it is to read, it is of greater primacy to study. Study entails not reading the latest book of economic wisdom acclaimed by one and all, but reading and solving problems from your boring, old textbooks. It is important that you have studied back in college (other than being rejected by a hot (to you, at any rate) girl) if you are to take away the important lessons from all the reading you will do as an investor. If you didn't, do that first. Depending on the kind of investor you are, it may include macroeconomics, accounting, statistics, financial mathematics, or all of them.

(3) Being wary of confirmation bias: Irrespective of what or how much you read, it is easy to come out of it with just your prior opinions solidified, as the mind has a tendency to read every little reaffirmation of your prior beliefs in bold, life-sized print, and read everything that's not so agreeable in Arial Narrow. So be careful. It is also important to emphasize breadth, than to read five books about the same thing, your favorite topic. Investing is a complex subject, it lacks the hard rules governing the physical sciences like Physics, and it is often tempting to ignore this aspect of investing, especially the more mathematical your training is. Don't. Because of this nature of investing, breadth has a depth all its own. Read widely. Read about things not immediately applicable to your next trade. CLR James and Harsha Bhogle rightly re-ignite Rudyard Kipling's famous sentence on England by applying it to Cricket: "What do they know of Cricket who only Cricket know?" The essence of this wisdom has a central place in investing. "What do they know of Equities who only Equities know?" Replace 'Equities' with any specific part of financial economics, and you will see what I mean.

In essence, make the goal of your reading be "to improve your perspective", and the three points above will largely be taken care of.

Monday, August 17, 2015

Reading list for the near future

Philosophy of Mind
Arthur Schopenhauer "On Thinking for Oneself"
Henry Hazlitt "Thinking as a Science"
Francis Bacon "On Studies"
Herbert Spencer "What knowledge is of most worth?"
E.H. Griggs "The Use of the Margin"
Adi Shankara "Vivekachoodamani"
Anonymous "Kenopnishad"
Anonymous "Taittriya Upanishad"
Swami Chinmayananda "Self-Unfoldment"
Iain McGilchrist "The Master and His Emissary"
Richard Thaler "Misbehaving"
Daniel Kahneman "Thinking Fast and Slow"

Finance and Economics
Andrew Ang "Asset Management"
Antti Ilmanen "Expected Returns"
John Cochrane "Asset Pricing"
Lasse Heje Pedersen "Efficiently Inefficient"
Steven Drobny "Inside the House of Money"
Will Durant "The Lessons of History"
Ray Dalio "Economic Principles"
George Soros "The Alchemy of Finance"
Robert Shiller "Irrational Exuberance"
Raghuram Rajan "Fault Lines"

Biographies
Robert Kanigel "The Man Who Knew Infinity"
Richard Ravitch "So Much To Do"

Fiction
William Trevor "The Story of Lucy Gault"
John Banville "The Untouchable"
P G Wodehouse "The Most of P G Wodehouse"
Kingsley Amis "Lucky Jim"
_________

Will write a review on this blog for each (more likely 'lessons from them' than 'reviews of them') once I read them.

Tuesday, August 4, 2015

Why waste words ..

.. when everything that you have to say is best said without any.

Saturday, July 18, 2015

Inflection

This is the 18th of July 2015.
Nothing happened to me today.

Saturday, July 4, 2015

Remembering Orkut

Back in the restless days of my undergraduate existence, I was a fairly active orkut person. I spent around two to three hours every week on orkut, and I never just surfed around - that time was spent actively messaging people, or 'scrapping' them, as it was lovingly called in orkut parlance - and I used to almost exclusively scrap girls from my high school who I had been out of touch with for over an year. Two to three hours a week might not sound like a lot to most millennials, but I am talking about 2006, and times, I kid you not, were simpler: walking half an hour at night for a Rs.10 glass of orange juice at a small corner in Rohini sector 16 used to be enough to get us boys all excited, so you can do your own calculations. Anyway, the advent of orkut had made me a bit of a popular kid among my friends. My friends were mostly small town guys: I don't think any of my close friends at DCE, except Adyansh, were Delhiites (Abhineet too, but he became a friend in 2007). At first, I had found them rather different from kids I grew up with in Delhi. It took me much longer to become thick with them than it took for them to get thick amongst themselves. But soon enough, I had not only accepted the differences, but rather realized that the ways in which they were different from me were mostly ways in which they were better than me, ways in which I'd like to change to be more like them. It has to be said, though, that one of those differences worked in my favor. I wrote more educated-sounding English sentences, and boy was that ever more prized than in the orkut days when every girl we wanted to talk to seemed to have a profile written in prim, pristine, Queen's English? True, there were also the 'i luv mah frnz' girls, but they were for some reason never the most sought-after ones. I rose to prominence in my hostel as the guy who could not only write you an orkut profile fairly eye-catching, but given the right incentives, might also write you a stellar 'testimonial'. Most of my zero-fee clients, engineers that they were, wanted the same things in their testimonial: that they don't study at all and still top their exams, that they were fun-loving and funny but were also daredevils ready to put themselves in any harm's way for their buddies. It is Delhi, mind you, and a facility with hot-blooded brawls was deemed to be a badge of honor for guys, even if the girl on the judgement chair were a Stephens educated, feminist, marxist, artist. One of my clients I wasn't a big fan of, let's call him NR. The testimonial I wrote for him read: "Basically he's a nice guy." I could have written "He's basically an asshole" to be more honest, but such testimonials were common and were supposed to be inferred as tongue-in-cheek jibes, intended actually to enhance the coolness quotient: 'we're so cool we insult each other with orkut testimonials', went the dictum. So that wouldn't have worked. But there was no redeeming factor for praise as mild as someone being "basically a nice guy", as if you couldn't find anything more remarkable to say about him even when writing a testimonial. It was the ultimate put-down. Expectedly, he didn't accept it. Moreover, the offense NR took exceeded even my expectations: he came to my room that night, and told me he had more 'fans' on his profile than I had 'friends'. ('Fans' was another orkut gimmick - basically you could choose to identify as a fan of any of your friends, and everybody's fan-count was displayed atop their profiles. It was the ultimate backscratching rehearsal for people entering the workforce.) I apologized, but he unfriended me anyway.

Monday, June 22, 2015

Talking to myself

When I started this blog a great objective was talking to myself. I talked to myself all the time anyway, but I felt that the written form would provide more structure and clarity to my conversations with myself. The reasoning was, and to this day I believe it to be true, that just by the virtue of writing writing something versus uttering it under my breath, I am able to identify things I knew but never knew I knew. And, of course, record it for future reference. In essence, I aimed to learn more about myself and how I think about other things. This was the objective, anyway. I daresay I came anywhere close to achieving it. Because soon after I started writing here, some people started telling me I wrote well or that I was funny or something. Then I forgot all about my objective and started trying to write in a way that would be considered well-written, or hilarious, or some such thing. It wasn't just the way of writing I altered but also the content. Because, of course, it was hard to write funnily about something inherently uninteresting to any audience wider than myself. So out went the window the idea of talking to myself, and I was writing mainly for applause. In striving to do so, I started working on my use of the language, tried to strengthen my grasp of the English language grammar, spent time reading books as well as just the dictionary and thesaurus to improve my vocabulary. Even read a couple of books on style and usage - "Mind the Gaffe" and "The Elements of Style" come to mind. All this, from what I recall, was around 2007, although it continued into much of the first half of 2008. It is 2015 now, I am 29 years old, and my preoccupations have changed so remarkably that I find it not merely surprising but mind-blowing that I had spent so much time and energy on something like that, especially since now it seems like the last thing I would bother about. I'm glad I put that time, though, because if I hadn't then I wouldn't ever.


While until this time, I compromised the objective of this blog for reasons related to the unexpected positive reception that some of my earlier posts received, beginning in 2008 I further compromised the objective for reasons a tad bit more convoluted. I fell for a girl who was into poetry, and started writing, yes, poems, or whatever half-assed cousins of poems that they actually ended up being. Soon, I found myself writing not for general appreciation, but a focused admiration, from the girl I wanted. Funny thing is, it continued well into after I actually was with her. I think it is fair to say that I had got so far away from the aforementioned "objective" that it is not fair to refer to it as the "objective" anymore. The objective now was just to have her see me as a clever, deep, writer. I wasn't even going for being funny anymore, and it's safe to say that I had lost most of my natural, unrehearsed funniness as well.


Lately, and that means for the last one year or two, I have felt really free to use my blog for its original objective. I haven't had any audience now for quite some time, so it has become easy for me to not fall for the temptation of writing for an audience. On the flip side, since writing well is not nearly high on my agenda, I end up writing short, rather to-the-point snippets. This one today is probably the longest post I have written in a very long time, I think.


I went skydiving the day before yesterday, with a couple of colleagues from work. They were not really friends, not even people I work regularly with, but just a couple of guys who, by some accident of common interest, got ready to take the plunge from 15000 ft. The skydiving experience itself was something I will not write much about, because the more I write about it the more I will be understating the magnificence of the true experience. I will post a video though to record the experience for the future:


I wish I knew how to change the thumbnail image on youtube.  Anyway, can only do so much ass-saving with a face like mine.




Thursday, April 30, 2015

Life as the sum of all embarrassments

All of life, I guess, is a giant exercise in gradually humbling yourself further. I find it amazing, and this is truly different from saying that I find it annoying, that there are any people at all who get more sure of what they know as they grow older.

Personally, I think, that the more I learn and get to know about things, the more it becomes embarrassingly clear to me that there is so, so much I do not know. One of the reasons I like working in finance is that it has so much to never come to know. (Yes, that sounds convoluted but that it what I wanted to say; it's not in error.)

At the start of this year, I made big, elaborate plans for what I will learn in 2015. 2 things have changed since then. One, I realize that to execute only them will take not one year but probably three, and two, that there are going to be many diversions on the way where I'd go about learning things I hadn't initially planned to, so in effect it will take more than three, maybe five or six. But the thing that I am not yet accounting for is that some of those diversions will become full-fledged highways in and of themselves, and that they will have their own diversions. And so on ad-infinitum. And with this, I'm pretty confident that the whole thing will take not five years but fifty, or however many I have left.

Which makes me wonder - is it worth planning for a period as long as an year, when so much changes during it? I would argue that there is value in planning, even when the failure of the plan is a foregone conclusion. It reminds us of the highway, when we're on our joyrides along diversions. It enhances our realization that the diversions are lovely, but also forces us to examine how lovely they are compared to what's at the end of the highway. And sometimes, to pave new paths  by which the diversion would eventually join the highway again.

That, I guess, makes us more creative..




Friday, March 27, 2015

Not normal

For the last three days I've been sleeping the whole time I'm home. After coming back home at 6 PM, I'm asleep at 6:20, waking up only at about 6:40 AM the next day, at which time I quickly get ready to work and reach office at 7:30. It's a miracle I've been coming to work on time all throughout. This isn't normal. It has got to be something in the medication.

Thursday, March 26, 2015

Lull

February and March haven't been great, healthwise. In February, I first contacted seasonal flu that lasted four days and just when I thought I had recovered, a week later I was down with a terribly irritating allergy that made breathing unbearable for a week. There is nothing like a blocked nose to make you realize how beautiful your immediately preceding life was. Then March began with a stomach that couldn't cope up with the move to India, and finally, a day before I was to travel back to the US, I contacted viral infection that led to bacterial infection and tonsillitis that I'm still battling. I'm recovering well and hoping to be fine in the next couple of days and hoping, also, that this will be the end of it for this year. All this has already set me back at least a month in my plans, and in addition to the time lost, what I worry about is the momentum lost. I think that it will now take me a couple of weeks just to get back into the groove of things and get the motivation going. Anyway. Hope that happens very very soon.

Saturday, February 21, 2015

Google Chrome

Never open more than 3 tabs at a time. If you must open another tab, first choose a tab to close.

Friday, February 6, 2015

Blogging platforms and moonlight

I'm contemplating moving the blog to wordpress. Since a big chunk of what I post nowadays tends to be code with all these greater than and less than signs, it totally throws the html on the blogger off. It is amazing to me that blogger won't add this small little feature that let's you insert code seamlessly with something like a code tag that wordpress provides. It is 2015 and it is very surprising to see that blogger would let so many users slip away but not pluck the low hanging fruit of adding code tags. I personally do not want to move the blog, but that is out of two entirely irrational reasons: one, that I'm lazy and do not have the time or enthusiasm to set up a blog from scratch, and two, that I've been on here for ten years now and it feels like home and so I don't want to leave.

I've been meaning to add tutorials for some great R libraries like dplyr, ggplot2, and shiny, and also some Python tutorials but before that I have fulfill the promise I made to myself of adding tutorials for the relatively uninspiring parts of R that form its basics. And, at any rate, to get started with any of that - it seems like moving to wordpress is the way. A couple of days ago, I tried to embed code snippets in earlier R posts but the results were clumsy and off-putting.

In any case, an interesting thing I learned today (let's assume I won't be adding anything else tonight): the earth's moon was once an asteroid that struck the earth and the hot molten ball that rebounded extremely slowly became the moon a couple hundred million years later. All that romantic poetry with moon as the evergreen metaphor seems a little incongruent now, doesn't it?

Monday, February 2, 2015

Some less talked about positives of the American Civil War

This is not a defense of wars, but the American Civil War had several positives coming out of it, and I thought I'd outline them briefly. Of course, it was at a great cost of 600,000 lives, about 2 percent of the entire US population at the time. Everybody knows about the biggest achievement of the war, which was also in large part the main engine behind the war: the abolition of slavery. Here I will mention some of the other, often overlooked positives:

1. For the first time, the recently discovered Bromine was used for healing and cleaning wounds. It improved standards of hygiene in wartime medical assistance in a big way, significantly reducing casualties where soldiers succumbed not to bullet wounds but to the ensuing gangrene.

2. Before the civil war, nursing was a primarily male occupation. With this war, the need for nursing outgrew the supply that men alone could furnish, bringing women in large numbers into the nursing profession. Alongside textile mills of the same period, this paved the way for women getting out of their houses for work in large numbers.

3. Working as a nurse at the time of the war inspired Carla Barton to start the American Red Cross post the war, an organization that has since saved millions of lives.

4. Embalming, the practice of using zinc chloride and arsenic for the preservation of the dead bodies of soldiers was an innovation of the civil war, which meant that the bodies could be received by their families, even weeks later, in recognizable and non-decomposed conditions for their last rites.

5. Telegram got a boost by Lincoln as a method of mapping and devising macro and micro level strategies. This would continue to remain a masterstroke of wartime planning for decades to come, including during the world wars.

6. In many ways, it was the first modern war. Before the civil war, the battle capacity of any regiment was limited by how much artillery they could carry with them. Once they were out of supplies, they could fight no longer. This was the first war to isolate supplies from actual offensives, by employing railroads to continually and strategically supply new arms to the fighting troops.

Sunday, February 1, 2015

R for Basic Statistics - 1

R for Simulation, Sampling and Inference


Simulation


outcomes = c("heads", "tails")
sim_fair_coin = sample(outcomes, prob=c(0.4,0.6) , size=100, replace=TRUE)
barplot(table(sim_fair_coin))


Another use of sample() is to sample n elements randomly from a vector v.
sample(v, n)


To create a vector of size 15 all of whose value are identical:
vector1=rep(0,15)
vector2=rep(NA, 15). NA is often used as placeholder for missing data in R.


For loop in R
for (i in 1:50) {}


Compare to Python (later)


Divide a plot into multiple plots using (following example divides plotting area into three rows and 1 column):


par(mfrow = c(3, 1))


Set the scale of any graph using xlim and ylim arguments.


range() when applied on vector gives a vector of length 2 showing the smallest and largest element of that vector. It is useful to set the scale of graphs using xlim and ylim. For example:


# Define the limits for the x-axis:
xlimits = range(sample_means10)
# Draw the histogram:
hist(sample_means10, breaks=20, xlim=xlimits)


A complete confidence-interval example (comment code later):


# Initialize 'samp_mean', 'samp_sd' and 'n':
samp_mean = rep(NA, 50)
samp_sd = rep(NA, 50)
n = 60


for (i in 1:50) {
   samp = sample(population, n)
   samp_mean[i] = mean(samp)
   samp_sd[i] = sd(samp)
}


# Calculate the interval bounds here:
lower=samp_mean - 1.96*samp_sd/sqrt(n)
upper=samp_mean + 1.96*samp_sd/sqrt(n)


# Plotting the confidence intervals:
pop_mean = mean(population)
plot_ci(lower, upper, pop_mean)


Please note below in the output of the program above, a great use case for plot_ci chart.

Saturday, January 31, 2015

What seems like work to other people that doesn't seem like work to you?

In a recent post, Paul Graham suggests that we ask ourselves this question, and that our answers to this question, are things we are well suited for. I totally agree.

I have always wanted to do a lot of things. Ever since I assumed a semblance of adulthood, I have wanted to to do many different things, have many different occupations. I don't use the term "wanted to" very loosely. When I say "wanted to" I mean that I have actively tried to better myself at those things for at least a month, with a view to do them professionally. These have included becoming a poet, a programmer, a short story writer, a singer, an investor, a quant, a film critic, a photographer, a cartoonist. Fundamentally, I am not a subscriber of the notion that one has to become this one specific thing in life. Right from my teenage, the one thing that the popularly reinforced idea of "you have just one life" has made me a little frantic about is the desire to pack a number of different professions into this one life. To many other people, this same idea is a great motivator pushing themselves in the opposite direction, of devoting themselves entirely to one great pursuit, and making a mark in it. I admire those people, but for some reason, doing many different things holds more sway to me than being a master of any one thing, and I think this is guided by my regret minimization utility function. Would I regret it more if I couldn't be great at one thing, or would I regret it more to not try having done so many others. For me, it is the latter.

At the same time, I very much believe in the other popular notion that "if something is worth doing, it is worth doing well". And it would be foolish not to concede to the oft proven point that trying to do several things is a big impediment in developing expertise in any one thing. Therefore, for people with dispositions such as mine, it is all that much more important that they choose their targets well, because they are only going to be good at so many things.

Which brings me back to Paul Graham's question. It is a great guide.
My answers: Writing essays, Studying statistics and probability, walking. I wish debugging was also on this list. But I suppose this list will change.
It is useful to create one's own list in answer to this question, and to come back to it periodically: both as a reminder to follow it, and as a reminder to update it.