How much dice does god play?

I’ve always wondered why high schools bury students in calculus instead of teaching them the beauty of statistics and probability. A tiny fraction of these students will actually use calculus in their lives, but statistics are for everyone. And without clear statistical principles in our head, we get intimidated by numbers. I thought a small write-up on probability and statistics that touches upon some of their arcane concepts without sounding too technical was in order.

 Randomized response

To reel you guys in, let me begin with a real world application of probability, nothing obscure. Just an interesting use for the concept.

Suppose you’re conducting a survey where you ask people whether they cheated on their spouse. In spite of repeated assurances of confidentiality, the participants could never be sure that their data wouldn’t be traced back to them. After all, it’s on a piece of paper or a file on some computer. Who’s to say some disgruntled employee wouldn’t release them to the world?

The randomized response method, that’s who. It allows us to obtain our data without causing a rip tide of punitive alimonies. Here’s how it goes. When the participant comes to a yes/no question about a sensitive issue, he flips a coin. If the coin comes up heads, he fills Yes. If it comes up tails, he answers truthfully. It’s that simple. No one watches him flip the coin, so his motivations for filling Yes are secret.

We know that if we flip a coin enough times, we’ll get heads roughly half the time. So let’s say 1000 people participated in the survey, and assume that 700 of them answered Yes to the damning question. And 300 answered No. There is only one reason to answer No—you didn’t cheat on your spouse. This means every person who answered No got tails on the coin flip. That means an equal number of people must have gotten heads (300). So, out of the 700 who answered Yes, 300 did so because of the coin flip, which leaves 400 people who definitely cheated—their spouses are none the wiser.

Portrait of King Henry VIII 1540c.

How else would he make room for new wives? (Picture: lisby1)

Bayes’ theorem

Thomas Bayes blew our minds on conditional probability, you know, those icky questions like, “If it rains tomorrow, what’s the probability that the bus will be late?” The Bayes theorem, if one’s unfamiliar with it, gives us some counter-intuitive answers to questions that we would otherwise take for granted.

Say 1% of women over forty have breast cancer. Assume that 95% of women with breast cancer will test positive for it. Also assume that 5% of those without breast cancer will also test positive—false alarms. If a woman tests positive, what’s the probability that she actually has breast cancer? 95%? 90%? It’s at least 50%, right? It’s actually about 16%, which, incidentally is the percentage of doctors who got this question right.

Whenever an event we test for is present in a small fraction of the population, however precise the test, any true positive will be drowned in the absolute number of false alarms. Welcome to the world of Bayesian probability. Simply put, if 10000 women were tested for breast cancer, and 100 of them actually have it, 95 of the 100 will test positive. And out of the 9900 who don’t have breast cancer, 5% or 495 will test positive. This means, for every 10000 tested, 590 will test positive, of which only 95 will actually have breast cancer—16%.

This is why doctors re-test the samples that test positive. In this case, if a sample tests positive twice, the probability of cancer rises to 78%. Fun, right?

Confidence limits and statistical significance

Whenever those of us in the science fields hear the word significant, we go, “Oh yeah? Prove it.” When we say ‘significant’ we mean statistically significant with a given probability value. Even those outside the sciences hear of confidence limits and statements like “We know this with 95% confidence…” So what does it mean to have statistically significant information or to have confidence in it?

If we conclude something from a study with 95% confidence, we mean that we allow for a 5% chance that our results were sheer dumb luck. In other words, even though scientific research follows an innocent until proven guilty principle, if we kill 5 out of every 100 innocent people, we call it a good day.

To elucidate this, let’s say I gave you a coin and told you that it favors heads, i.e. if flipped enough times, it will give more heads than tails. It’s up to you, the skeptic, to test it instead of just believing me.

So you flip the coin once and get heads. Eureka! This coin favors heads! Not so fast…there was a 50% chance of getting heads by pure chance anyway. At best, you can state with 50% confidence that this coin favors heads. So you ante up again and re-flip this coin. Another heads. Don’t call Stockholm just yet. There’s now a 50% of 50% i.e. 25% probability that these two results were pure chance. But your confidence has increased now. You can state with 75% surety that there’s some funny business with the coin.

You flip it again. Another heads. Now your confidence has gone up to 88%.

Flip again. Another heads? You’re now 94% confident that the coin is biased. With the next flip, your confidence rises to 97%, which is more than enough for most scientific experiments.

Of course, I give this example to explain the intuition behind the % confidence concept. This experiment takes for granted a lot of things that change with every flip—how high you flip, air resistance, which side faces up when you flip, etc. In reality, you don’t accuse a coin of bias after five flips.

Expectation, Law of large numbers, and the Gambler’s Fallacy

Dice

In case my description wasn’t wordy enough…(Picture: Wikipedia)

Consider an unbiased six-faced die with the faces numbered 1 through 6. If you roll a 1, you get $1 and if you roll a 2, you get $2…you get the idea. We all know that the probability of landing any particular number is 1/6. If you threw enough times, what’s the average amount of money you’d make per roll?

Expectation simply means the probability of an event multiplied by the reward or punishment associated with that event. There’s a one-in-six chance of rolling any given number.

The law of large numbers says that if you roll this die enough times, your expectation per roll winds up around $3.5. Every number is equally likely, so the reward expected from any particular roll is the average of the rewards for each number—

(1/6 X 1) + (1/6 X 2) + (1/6 X 3) + (1/6 X 4) + (1/6 X 5) + (1/6 X 6)

= (1+2+3+4+5+6)/6

= 21/6 or $3.5

The house always wins (Picture: Wikipedia)

We must remember that this averaging out happens over many many rolls…nearly approaching infinity. If we ignore this, we commit what’s known as the gambler’s fallacy. Every number on the die is equally likely, and each roll is independent of any other. If you rolled 1, 2, and 3 in succession, it doesn’t mean that 4, 5, and 6 are due. Every roll has 1/6 likelihood of yielding a particular number. Yes, if you rolled the die 60000 times, you’ll most likely end up with equal rolls for each number.

People who buy lottery tickets based on numbers that are due are fooling themselves. Then again, people who expect to make a lot of money on lottery tickets wouldn’t be swayed by statistics and probability anyway.

So there it is. A small primer on statistics and probability with some real-world examples. Some of this is oversimplified here and more nuanced in actuality. Some of the intuitive explanations are based on how I understand them and subject to further exposition.

Related articles

Posted in rants, science | Tagged , , , , , , , , , , , , , | 16 Comments

My post on Canadica “A Mouthful of Canada”

A Mouthful of Canada is my contribution to Canadica, where writers from Canada and the USA get together to be funny. Check it out.

Posted in humor | Tagged , , , , , , | 2 Comments

2012 in review

The WordPress.com stats helper monkeys prepared a 2012 annual report for this blog.

Here’s an excerpt:

4,329 films were submitted to the 2012 Cannes Film Festival. This blog had 17,000 views in 2012. If each view were a film, this blog would power 4 Film Festivals

Click here to see the complete report.

Posted in Uncategorized | 16 Comments

Connecticut, gun-control, and human nature

LAWS are written for the average citizen, the meaty portion of the demographic bell curve, but a referendum on a law usually springs from something an outlier does. It may be subtle, like someone exploiting a tax-loophole, or in-your-face, like someone walking from classroom to classroom firing multiple rounds at cherubic victims.

Adam Lanza (Wikipedia)

Adam Lanza discharged a firearm on innocent children, teachers, and his mother, before killing himself. Twenty eight people died, fourteen of them children. We have seen this before. The Virginia Tech shooting happened about five years ago. And a few months later—not nearly as gruesome, but closer to home—a man had sneaked a gun into my university campus before he was apprehended. Luckily there were no casualties. These, with the Gabrielle Giffords case,  and the Aurora shooting, have ensured a stalemated gun-control debate, with one side claiming it’s too soon to talk about it and the other questioning the logic of civilians carrying assault weapons. What we have here is a nation divided, with most participants refusing to budge, on an issue that isn’t elucidated as much as we’d like to believe.

For every gun-owner who kills innocent people, there are thousands who don’t. That we cannot ignore. Instead of restricting the sale of weapons, let’s collect and publicize information on gun-owners. Nancy Lanza was a survivalist who owned over a dozen guns and stockpiled food in preparation for the ‘apocalypse.’ She also took her sons to shooting practice. There are fewer red flags at a communist rally. Instead of banning assault weapons for civilians, why not use the information? Put someone such as Lanza’s mother on a watch-list. When a twenty-year old has access to and carries semiautomatics, in violation of Connecticut law, follow him around in a chopper if you like. The Second Amendment prohibits none of that.

The more regulatory hoops people have to jump through to get whatever they want, the likelier that they pursue illegal methods to get it. And shadow economies that fly under the radar use violence as currency. The drug war and Prohibition have taught us that. Let people buy the weapons legally, but keep tabs on them. Educate them that the Second Amendment doesn’t protect them from a tyrannical federal government that possesses nuclear weapons. Nothing does. It was drafted back when the government and the people had the same weapons. Today, you have the right to own a gun, not the right to keep it secret. It’s not a perfect solution, but it’s something.

Some say that had twenty-eight people died in a terrorist attack, the people drooling all over the Second Amendment right now would have gladly forfeited what’s left of their Fourth Amendment. That, I believe, is a false equivalence. Terrorists are malevolent but sane people who kill in cold blood. Every single terrorist act must be punished swiftly and harshly, or more will happen. But this man was crazy, and besides his mother, he didn’t know his victims; so this wasn’t personal.

It is a natural human tendency to take for granted the good things that happen and to regard as the workings of the devil the bad things. And that if a bad thing comes along, you say, my God, we ought to pass a law and do something. — Milton Friedman

Gun ownership prevents crimes too. Sure, fewer guns are fired in defense than offense, but the presence of a gun, or even the possibility of one, makes a person less of a sitting duck. We cannot know of all the attempted burglaries, rapes, and muggings thwarted by the victim’s possession of a gun, without even firing it. While this argument does not justify a 20-year-old carrying a Bushmaster XM-15, it does muddy the issue.

It’s human nature to make sense of tribulation—a significance, anything to escape the sad truth that we are but dots on a tapestry, whole lives without meaning to anyone except those living them. (Perhaps that’s why our ancestors invented religion.) I don’t mean to insult the loss of life, or those that died. But these events are an aberration. It’s unlikely and unfortunate when an earthquake or a tsunami occurs, and similarly, now and then someone, somewhere snaps and hurts people without reason. This wasn’t an act of terrorism, not a murder for profit, nor anything preventable. This was a tragedy. Let’s grieve with all of our hearts and comfort the bereaved.

Source: abcnews.com

Let’s not forget, in our sorrow for the victims and our indignation on guns, that there were heroes in that school. It is often said that heroes are those put themselves in harm’s way. The teachers and aides, the principal, and the school psychologist showed outstanding courage as they selflessly rescued as many children as they could, often paying with their own lives. Victoria Soto actually misdirected Lanza by telling him that her students were in the auditorium, while she hid them in cabinets and cupboards. She probably knew he’d kill her, but she protected the tots in her charge anyway. These women did more than save lives. They did wonders to conserve my faith in humanity. And probably yours.

Posted in events, opinion, politics | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | 20 Comments

The precipice

Reblogged from Bharatwrites:

"Hey man...can you come over in an hour?"

"Ya sure...what's up?"

"Aa jana phir batata hoon." (I'll tell you when you get here.)

"Okay, see you in an hour."

"Accha sun, quarter leke aana." (Bring a quarter liter of whiskey)

"Sure...Royal Stag?"

"Abbe kanjoos, abhi to note chaapne laga hai...bring JD at least!" (Cheapo! You're making good money now.

Read more… 948 more words

A short-story I wrote in dialogue form four years ago. The sentences in Hindi are translated in parentheses.
Posted in Uncategorized | Leave a comment

Memory tricks we forgot

Every Spring, the ConEd building in Manhattan hosts an unusual tournament; the contestants compete to remember, among other things, a poem, a deck of cards, biographical information about strangers, and strings of numbers. In case you’re thinking this is just a MENSA meeting with expensive parking, let me add that the contestants aren’t geniuses. Nor do they have photographic memories.

The truth is actually more impressive, as Joshua Foer explained when he spoke at our university a few days ago. He said that these champions of recall hone their craft with practice. They simply maneuver their brains to get around natural human limitations of rote memorization. And he should know—he is one. Having chanced upon bouts of memory as a science journalist, Joshua was hooked. To write about it, he studied it the best possible way. He became a memory champion. His book, Moonwalking with Einstein: The Art and Science of Remembering Everything, describes his experience and notes these skills etched inside our brains.

Cover

(Pic:Wikipedia)

In it you’ll understand how orators remembered their speeches many generations before the teleprompter. Back then, the pages of history were passed down from teachers to students through speech and memory. The last few centuries saw major changes. From Gutenberg to the iPhone, every time an invention enhanced our lives, it reduced our need to remember details. And we lost these nifty tricks that our ancestors had devised.

But the same technology that we can now blame for forgetting our wives’ birthdays allows us to scan people’s brains while testing their memory. fMRI studies of regular people and memory champions as they try to memorize things reveal a key difference—the champions use the spatial part of their brains, as if they are laying out the random items on a map-like structure inside their brains. Psychologists call this elaborative encoding. Let’s use Joshua’s examples.

If I told you that a guy’s name was Mr. Baker, you’re less likely to remember it than if you were told that the guy was a baker—because you associate a baker with a white hat, sweet smell, and hands covered with flour. ‘Mr. Baker’ doesn’t inspire anything nearly as vivid.

If you show chess grandmasters a photograph of an ongoing game, they can reconstruct the board from memory. But show them a picture of a randomly arranged board, and they remember barely more than a layperson. Context is everything. The position of a pawn in an ongoing chess game is part of a story, and a random one is not.

But what if you could generate context, or manufacture a story, for random bits of information?—or imagine baguettes and cakes when  introduced to a Mr. Baker? You can do that using the memory palace, a structure you must train yourself to imagine, which holds the things you want to remember encased in layers of fabricated context. And the more evocative the context—the brighter, smellier, noisier it is—the smoother your recall. Your verbal memory doesn’t hold a candle to your visual/spatial memory, which you should mobilize. You don’t have to memorize thousand digits of pi,  but you’ll always know where your keys are.

But really, can just anyone do this with practice? Yes, Joshua says, provided you remember to call upon this skill whenever you get information. Most of all, you must remember that you can do this. And the images should be really wacky. Here’s one of Joshua’s gems: you know how he remembers to begin speeches with the unusual memory contest? He imagines nudist bicyclists racing towards his front door with sweat glistening over their fat, jiggly bodies (antithetical to all that cardio they’re getting if you ask me.)

Joshua’s TED speech

Posted in events, Interesting | Tagged , , , , , , , , | 41 Comments

For a few dollars more

I am famously cheap.

My friend regales crowds with the time he and I bought blank DVDs in Mumbai. Each one cost Rs. 12 (about 24 cents for the uninitiated), and I noticed that the DVDs were shiny on both sides without any drawings or logos. I had to ask, “Does this mean I can burn data on both sides?” The shopkeeper literally facepalmed and said, “Sir. How much do you expect for just Rs. 12?” He couldn’t tell what embarrassed him more—my ridiculous question or that he was more embarrassed with the exchange than I.

Coaxing dollars out of my wallet is a running dare among my friends. Every outing they propose to me begins with a ‘should you choose to pay for it’ clause. It’s not like they aren’t careful with money. They just don’t make it as obvious as I do. I have never been too embarrassed to ask, “But how much will it cost?” And that helps me negotiate with chemical vendors for lab supplies. It’s a real production. I dial up the Indian accent, play the poor immigrant card like a zither, and make them repeat every sentence until they surrender and dangle the biggest discount their supervisor can authorize. Occasionally I get busted because the guy at the other end is in a call center in Bangalore.

Now I know the stereotype in America—Indians are cheap. There is some truth to that. What distinguishes me is that my ‘Indian’ friends call me cheap. In restaurants that don’t split checks, I usually pay, and the next day my companions receive an Excel sheet in an email with what they owe me in bold. Social decorum rarely stops me from lecturing the friend who never orders anything and disposes of three plates of the free bread. Nor do I shy away from interrogating the friend who habitually leaves to answer nature’s call when the waiter approaches with the check. Why do I hang out with such douchebags?

A typical conversation should highlight my agony. I dislike going to Starbucks alone. So I call someone—

“Hey I’m going to get a coffee. Come with?”

“No man. I’m busy. But as you’re going, can you get me a Chai tea latte?”

“Certainly. I chug a 50-cent coffee refill while chauffeuring your $3 drink. Guess what? Next time I have a yen for coffee, you’re not invited.”

It’s no secret whence I acquired this character. My mom earns and spends without losing sleep. The World Bank lends India huge sums against mom’s sari collection. Dad on the other hand, as mom illustrates, enjoys money by having it. So as I gloss over my penny-pinching by waxing lyrical about abysmal stipends and the GINI coefficient, the truth is that it’s coded into my DNA to fret about the doubloons. My salary has doubled from almost nothing to nearly nothing over the last few years, but I have increased my spending just enough to let me salivate over something I can’t buy.

And what I can’t buy are usually possessions, even though studies suggest that buyer’s remorse is lower when you spend on experiences than on things—a crock if you ask me. Studies of happiness usually involve self-reporting, basically shoving a mic into someone’s face and asking them if they’re happy—a subjective concept if there ever was one. Anyway, as a guy, and a geeky one at that, I like splurging on tech stuff. Seriously, I have gadgetry that a person with twice my salary and half my debt should eschew.

It’s not like I won’t fork over for experiences. I can be weak too. I splurge on food. If you gave me ten thousand dollars and a month in NYC to spend it, I would see you in two weeks with blocked arteries and type II diabetes. And I tip well. I don’t eat in places where I can’t afford the meal plus at least 15% tip. And I’m not an asshole. I purchase my music from iTunes. Sure I grab every free iTunes card I can at the school Starbucks. But that’s essentially free money. A guy’s gotta eat.

My spending habits are paradoxical. I will order takeout instead of cooking for myself, but I’ll save the little napkins. I like eating at Chipotle, but when the ladle-wielding woman tells me that guacamole is extra—she can’t help it. It’s probably in her contract—I crumble and eat a soulless burrito bowl.

All because that little analog meter is perpetually running in my head. Like the MasterCard ad but without the corny ending.

Posted in humor, Uncategorized | Tagged , , , , , , , , , , , , | 36 Comments