Monday, December 31, 2007

New Year Resolutions

...No more Maximators, but I'll have problems with pouring boiling water on ants. It's the only time I get to be a napalm pilot.

Saturday, December 29, 2007

Flight Of The Conchords - Jenny

Bret: Hello.

Jemaine: Hi.

Bret: Hello man sitting in the park.

Jemaine: I just said hi, woman in the park.

Bret: How you doin'?

Jemaine: Mmm'good thanks.

Bret: Your looking good.

Jemaine: Pardon?

Bret: I said you're looking good.

Jemaine: Fair enough.

Bret: 'Jenny

Jemaine: Pardon?

Bret: Jenny

Jemaine: No I am sorry I think you've mistaken me for somebody else

Bret: No it's me, I'm jenny, my name is Jenny

Jemaine: Oh You're'oh' Ha ha ha ha' I thought' oh' what a hilarious misunderstanding.
Nice to meet you Jenny

Bret: We've met before - quite a few times actually.

Jemaine: Yes of course we have. I meant it was nice to meet you that time that I met you. Where was it that we met that time that I met you when I met you?

Bret: At a party.

Jemaine: That's right! Wasn't it one of those boring work parties?

Bret: No.

Jemaine: That's why I said wasn't it. It was the party of a mutual friend. - Was it? - Wasn't it? - Was it? - Wasn't it?

Bret: Yes it was.

Jemaine: Yeah, I thought so. Oh'Bobby's.

Bret: No

Jemaine: Doug's?

Bret: No

Jemaine: D-dog's?

Bret: No

Jemaine: Maxwell's?

Bret: No

Jemaine: Andy's?

Bret: Yes Andy's

Jemaine: Yeah Andy's party, ooh that's right. Ooh, Andy knows how to throw a party, doesn't he Jenny?

Bret: Yeah, I love Andy's parties!

Jemaine: I love Andy's parties. What crazy parties. How is that guy anyway?

Bret: She's good

Jemaine: Ooh that's right, Andy hates it when I forget that.

Bret: We watched a movie.

Jemaine: Yeah'it was something like but not necessarily Schindler's List. We watched it and we wept

Bret: It was Police Academy 4. We went for a walk

Jemaine: On our feet if I remember correctly.

Bret: We walked to the top of the hill and we ate sandwiches.

Jemaine: Oh, We'd just grab a sandwich and put it in our mouths. Oh, that's the only way to have sandwiches. Oh Jenny, tell me do you still walk? Do you still get into sandwiches in a big way?

Bret: Still walk a lot but I am not eating as many sandwiches as back then

Jemaine: Uh'

Bret: Do you remember what we did up there at the top of the hill?

Jemaine: Kind of'

Bret: We were standing at the look out

Jemaine: Oh, I remember exactly what we did at the look out. We just looked out' across the city from our little spot on the hilltop. Oh, It is so pretty from way up there. We talked about how the lights from the buildings and cars seemed like reflections of the stars that shined out so pretty and bright, that night.

Bret: It was daytime.

Jemaine: The daytime of the night.

Bret: Do you remember what you said to me?

Jemaine: Not word for word actually Jenny, but I remember there was some verbs.

Bret: Well you said meet me here in one year. You just needed some time to clear your head, and you seem to have done that.

Jemaine: La la la la la la la la la la la la la.

Bret: We have a child.

Jemaine: Pardon?

Bret: We have a child.

Jemaine: Why didn't you tell me, Jenny? Why didn't you tell me that day when we went to the top of the hill and we made sweet, oh how we made such sweet, sweet sandwiches. Does it have my eyes, my way with words? Does it look like me at all?

Bret: No, not at all 'cause we adopted him. I can't believe you don't remember, it was a very difficult process!

Jemaine: Oh'uh, oh'are you sure that was me Jenny?

Bret: Yes I am pretty sure that it was you, John.

Jemaine: I'm Brian

Bret: Oh my god! I'm so sorry!

Jemaine: Don't worry.

Bret: Now that's terrible.

Jemaine: Oh, don't worry.

Bret: Oh, how embarrassing!

Jemaine: Don't worry Jenny, I'm actually quite relieved. *That kind of thing just happens all the time, I just got one of those faces I suppose

Bret: So does John, ha, he's got one of those faces as well'

Bret and Jemaine: *awkward laugher*



*Note from blogger: I got kicked playfully once while sitting in a public place. Of course I was pleasantly surprised when I turned around and saw this pretty girl with long tresses and big eyes, only to be disappointed that I wasn't the "I" she had meant to kick (playfully I should add). I just got one of those generic faces I suppose.

Flight Of The Conchords...

...are the best thing since Monty Python. Check out all their vids on youtube, and be in awe of their mastery of guitar licks and comedic timing.


Getting serious on social issues...


and having fun with randomness.


The duo, who are obviously very comfortable with the ladies, have a deadly refrain for the perennially clueless(and the nocturnally prematured). Try these lines next time you find yourself tongue-tied for words:
"I want to make love to you, it's the least I can do. In the bedroom, I'm a gentleman, the ladies come before me....but 2 minutes...2 minutes is all you need--cos I'm so intense..."

Wednesday, December 26, 2007

The Snowman

Flying through the moonlit sky and dancing under the Northern Lights are what childhood dreams are made of. The girl in the attic must have been Norwegian girl Cecilia from Through the Looking Glass, Darkly. There are no penguins in the Artic though. And the haunting minor song belies what seems at first to be a Christmas tale full of innocent fun and glee.

Saturday, December 22, 2007

The Normal Bound

*Warning:Post contains pseudo-philosophical ramblings. Read at your own intellectual risk.

Most of us are only too familiar with crushing disappointments, meaningless jobs, indifferent love lives. Trapped in the monotony of everyday life, we make peace with regrets even as they slowly take the place of our dreams. We yearn for something more, and we continue to hope and dream and be disappointed and unhappy in an unyielding cycle. Sages have often hinted at the key to these life problems. "Seek material comforts, and you become enslaved by them.", "A simple life is a contented life", so says the Zen masters. Even Dilbert got into the act with "Tell me what you need, and I'll tell you how to get along without it". They all mean the same thing: Please lower your expectations.

There is even a mathematical construct for this. We are all bounded by the normal curve, and we aren't even aware of it. In math-speak, our hopes are often dashed because we aim at results which lie outside of the standard deviations that our lives are bounded by.

99.7% of [just about everything] are bounded by 3 standard deviations (sigmas) on either side(=6 sigmas in total). Six Sigma isn't the cult or martial arts movement that its fanciful name suggests, but a set of management practices implemented to improve manufacturing yield.

You wish to be a millionaire? Wealth is most likely a zero-sum game...so....
You yearn to be good-looking? Even the biological genes adhere to the normal curve. Just thank your lucky stars you (most of us anyway) are born without major defects.
You hope to have genius level IQ? Sorry to disappoint, but the normal curve doesn't agree.
You pray to be extremely talented? Consult with the normal curve first.
You want to be unique? But you already are...just like everyone else. We live in a wonderful world of predictable uniqueness and conventional individuality.

So what exactly is this normal curve that imprisons us so? Here's a Q-and-A session (with knowledge of high-school statistics assumed) to aid your understanding of your fate.

Q: What is the normal curve?
A: It's a probability distribution that is an approximation to the binomial distribution, which is the distribution of HAVES against HAVE-NOTS, the BLACKS against WHITES...or anything with bipolar outcomes (or Bernoulli trials).

It is also the approximation to a lot of other distributions, including that of sample mean, sample variances, in which case, the Central Limit Theorem applies, but I shall focus only on the special case of the Binomial (De Moivre-Laplace Theorem).

Q: The equation please.

n(x) is the normal equation, and R(x) is its integral or area under the curve with bounds given as -infinity to x.

Q: Why this equation?
A: It could be seen as a conscious sculpturing of what is essentially an exponential curve to a bell-shaped curve. And because if you integrate from -infinity to infinity, you get a probability of 1. Everybody in the world must belong under the umbrella.

But there is a rigorous mathematical proof which is based on the binomial distribution. Using firstly Stirling's Formula to strip away at the binomial coefficients, then approximating (k/n) ~ p and (n-k/n)~ q as n gets large,
(here, we are treating k as the random variable Number of Success, and the law of Large Numbers dictate that the rv goes near the mean), and substituting:
and finally applying Taylor's Formula, one arrives at the beautifully stark Exp[-0.5x^2]. This is a real statistical workhorse found in many applications.

A very clear proof is given in Yakov Sinai's Probability Theory:An Introductory Course.
Google on Sinai

Q: How about the term 1/ root (2pi)?
A: From the constant of Stirling's formula, which in turn is derived from the Wallis product. Wiki on Wallis

Q: The binomial distribution is discrete, varies according to p and n, and comes in different shapes and sizes, so how can it be approximated by the normal curve?
A: Ultimately, they all take on the shape of the bell-curve. The local asymmetries are overshadowed by the general symmetry as n goes larger.

Take for example binomial distribution with n=10, and probability p=0.1, with an obvious skew (they call it right skew, even though the graphs sort of leans left).



If I increase n to 100, the skew disappears--as if by magic. No, it's magic.



Q: How do they make sure that the normal curve, despite coming in all shapes and sizes, have a total area of 1?
A: Realise that area under f(x) = area under hf(hx), where h is scaling factor. It's that simple. Intuitively, for h>1, the height becomes taller, but the width becomes smaller.
For h<1, the height becomes shorter, but the width broadens. The area simply never changes.

In the plot below, the taller plot has h =1, while the flatter plot has h=0.5. The areas under both curves are....you guessed it, 1.



In math-speak,



Letting:



We get:



which is of the form hn(hx).

Q: How do we convert every single normal curve to their standard form?

Substituting:


We re-evaluate the normal integral with a given range k1 to k2 as:


In doing so, we have also scaled the discrete k-axis (of the binomial) to the continuous z-axis. Some ppl call this the z-transform. But this terminology conflicts with the actual z-transform used in signal processing. I stay away from the term.

Q: Is the substitution arbitrary?
A: No. We know the number of success X (random variable of the binomial distribution) has mean and variance.

In general,



We are turning all binomial distros to normals with mean 0 (centred at 0 ) and variance 1.

Q: If it wasn't arbitrary, then how was it derived?
A: I am not aware of any derivation, but the remarkable coincidence (in the fact that this substitution in the proof reduces the binomial to an exponential curve and at the same time, reduces the mean to 0 and variance to 1) seems like a natural phenomenon just waiting to be discovered.

Q: How can one take a discrete scale and turn it into a continuous scale?
A: This is only an approximation. The area under the discrete scales are formed by blocks of rectangles (or Riemann Sums, since everybody loves Riemann), while the continuous area is formed by passing a curve through the centre of the rectangles. The curve will naturally tend to underestimate the true area. To compensate for the error, we enlarge the range of the integral to include the areas at the extreme sides. They call this the continuity correction.



Q: Why do we use the standard normal statistic table?
A: The integration of the statistical workhorse is difficult. There is a fancy term for the integration: Jacobi elliptic integral, when we change the integration from xy-coordinates to polar. Someone came up with the bright idea to tabulate all the possible permutations of the answers into what is known as the Statistical Tables.
Anyway, in those pre-Casio days, they had tables for everything.

Q: What is the name of this theorem again?
A:De Moivre-Laplace Theorem. It first appeared in 1733, published by Abraham de Moivre. At that time, most of humanity was ekeing out a living not much better off than that of the Dark Ages, and yet math was already, compared with* our present world, graduate level stuffs.

*not compared to

Q: How is it related to the Central Limit Theorem?
A: The CLT is the generalisation of the De Moivre-Laplace Theorem. As long as we have the mean and the variance of any one single trial of the distribution (e.g. for binomial distro, a single trial is the Bernoulli Trial, and hence mean = p, and variance=pq), we can approximate them using the transformation below:



Q:What do I get out of the normal curve?
A: What seems at first to be asymmetry in a collection of data is revealed to be a beautiful(if austere)symmetry. The good news is, you can apply this theorem to practically anything, simplifying many otherwise computationally tedious tasks. The bad news is, you are part of it.

Q:How do I get out of the normal curve?
A:Best of luck.

Thursday, December 20, 2007

Things I learnt from Nassim Taleb

(in order of priority)

1. Beware David Hume's black swan.
No amount of observations of white swans can allow the inference that all swans are white, but the observation of a single black swan is sufficient to refute that conclusion.

Chickens pay the ultimate price by haemorrhaging like elephants.

2. Heed Solon's warning: It ain't over till it's over.

3. Learn from Odysseus who stuffed wax in his ears in the Sea of the Sirens:
I am not intelligent enough, nor strong enough, to fight my emotions.

4. Do not get married to yourself. Change your ideas and opinions as often as is necessary.
(In a parallel, Arthur Rubinstein was known as a pianist who changed his musical ideas and thoughts on a whim, much like George Soros and his investment principles.)

5. Children only learn from their own mistakes, no possible warning by others can prevent them from touching the hot stove. Likewise, book knowledge never lasts compared to life's (bitter)experience.

6. Yiddish saying: If I am forced to eat pork, it better be of the best kind.

7. Maths is a way of thinking, (much) more than a way of computing.

8. Your life expectancy increases each year you get older. If national life expectancy is 75, and you are 74, you are NOT LIKELY to die the next year. Remember that 50% of the population have lower than national life expectancy.
Other similar sayings: 50% of the population has lower than average IQ.
If you are not doing more than the average, you are pulling the average down.

9. Survivorship bias:
Imagine 1,000,000 analysts (or monkeys) making completely random predictions on 2 outcomes (market go up/market go down). 1 epoch (whatever length of time you may choose to define) later, only 500,000 analysts get their predictions correct.
Another epoch later, 250 000 analysts remain standing. After 15 epochs, there are still at least 30 analysts (1mil/ 2^15) surviving with 100% records. They are the fools of randomness we worship as Gurus.

10. Gurus usually develop the unfortunate habit of writing books about their random success.