Perspective

May 13, 2012 8:07 pm

We watched a movie last week on Netflix called Turtle: The Incredible Journey.


A. It was awesome.

B. I don’t know what Heather finds to cry about. She didn’t have to break out of an egg and then dig through sand for 3 days to get to the surface. She didn’t have to then make a mad dash to the ocean, and she’s certainly never been chased by crabs or birds who want to eat her. Her life is so easy!

Bayes’ Theorem

May 12, 2012 3:38 pm

By request, here’s my attempt to explain Bayes’ theorem (cribbing heavily from Wikipedia).

Deriving Bayes’ Theorem

We start with the standard definition of conditional probability (for events A and B):

3c5bf4874edc582346cb78a5eb66aaeb

Which reads: The probability of event A given the known occurrence of event B is equal to the joint probability of events A and B (e.g., the probability of both events occurring) divided by the probability of event B (assuming the probability of B is not zero).  I’m not going to show the derivation of conditional probability.

The summation axiom helps us understand the joint probability of A and B:

9e168c9112e06ac47b11fef388957692

It tells us that the joint probability of A and B is equal to the probability of A given B multiplied by the probability of B.  All we’re talking about is the likelihood of events A and B both occurring.

Keep the following equivalence in mind, we’ll need it in a minute.  It simply says that the order of variables when writing the joint probability is irrelevant.  It should be fairly straightforward that the likelihood of events A and B both occurring is the same as the likelihood of events B and A both occurring.

joint_equivalance

Filling back in our definition of conditional probability, we have (with the understanding that P(B) is not 0):

bayes_derivation

The third equation is the simplest form of Bayes’ theorem.  It wasn’t very hard to get to and the math, relatively speaking, is quite simple (we’re not talking about deriving the Schrödinger equation or anything absurd).  But its application, and understanding what it means, can be tricky.

P(A) is called the “prior,” representing our prior belief in the occurrence of event A.

P(A|B) is called the “posterior,” representing our belief in the occurrence of event A after (post) accounting for event B.

The remaining pieces, P(B|A) / P(B), are called the “support,” representing the support event B provides for the likelihood of event A occurring.

Applying Bayes’ Theorem

I’ll re-use the medical testing scenario from the previous post.

Substituting T to represent a positive test result and D to indicate the presence of the disease our equation becomes:

test_disease

We expand P(T) into P(T|D)P(D) + P(T|¬D)P(¬D) which is to say: The probability of getting a positive test, P(T), is equal to [the probability of getting a positive test when the disease is present, P(T|D), multiplied by the probability that the disease is present, P(D)] plus [the probability of getting a positive test when the disease is not present, P(T|¬D), multiplied by the probability that the disease is not present, P(¬D)].

So now we just need to map the numbers we have about the disease and the test to the variables in our equation:

P(D), our prior, is 1 in 200 million–the disease occurrence rate in the general population.

P(T|D), the probability of getting a positive test when the disease is present, is derived from the false negative rate.  When the disease is present, our test will only incorrectly say it is not 1 out of 200,000 times; so P(T|D) is 199,999 out of 200,000.

P(T|¬D), the probability of getting a positive test when the disease is not present is the false-positive rate: 1 in 100,000.

P(¬D), the probability of the disease not being present is simply the other 199,999,999 out of 200 million.

So let’s plug these numbers in step by step:

test_disease_computation

And we see that P(D|T), the probability that the disease is present given a positive test, is only 4.76%.  (My previous post incorrectly reported this as 0.05%, I’ve corrected the error.)

The car example I presented didn’t use hard numbers, but I’ll frame the concept into Bayes’ Theorem.  S will represent a car being stolen and H will represent a car being a Honda Civic:

stolen_honda

Which says, the probability that a car is stolen given that it’s a Honda Civic is equal to [the probability that a car is a Honda Civic given that it’s stolen] multiplied by [the probability of a car being stolen] divided by [the probability of a car being a Honda Civic].

The dealership was trying to push an insurance policy on me by only reporting P(H|S), but unless we account for the number of Honda Civics on the road in the first place, P(H), we aren’t getting the full story.

(Notice that we don’t have to actually care about P(S) if all we’re doing is comparing car make/models.  P(S) doesn’t change for the different make/models so it doesn’t affect the relative rankings.)

Six Months (and 2 weeks)

May 11, 2012 6:35 pm

Heather turned 6 months old on April 28th. Overall, I would say that things are getting much better. She’s less cranky during the day and she’s sleeping better. We even have a schedule! (Yes, I am ridiculously pleased by this. My life once more has order and predictability! Huzzay!) Our typical day goes roughly like this:

Between 6 and 7am—wake up
7am—nurse
8:30am—feed cereal (barley or oatmeal mixed with prune juice and applesauce)
9-10am—nap
10:30am—nurse
12:45pm—nurse (I’m thinking about changing this to another feeding of solids at some point)
1-2pm—nap
3pm—nurse
4:30pm—feed some variety of fruit/vegetable (squash, sweet potato, pears, peas)
4:45pm—bath (if it’s a bath day)
5:15pm—nurse
5:30pm—storytime with Daddy (I read to her before her naps, too)
6pm—bedtime
Between 2 and 3 am—nurse (as of this last week, this feeding is going away)

IMGP7776as

All the in-between times are filled, of course, with playing and such. We usually make a circuit between the playmat, the exersaucer thingie, the bouncer, the floor with toys, and sometimes the high chair with toys. Sometimes she’ll play by herself, but she really prefers to have me or Kyle hanging out right there with her. I usually take her on a walk in the afternoon, but it’s been really hot…we’ll see how that goes this summer.

IMGP7839as

Heather is getting to be a lot of fun and growing her own personality. Sometimes she’ll be very serious, and look around with her brow furrowed, as if she’s not sure her surroundings are quite up to snuff. But then she’ll break out into a huge smile, start throwing her hands around, and make the goofiest noises. Here’s some info about her:

Nicknames: Bug, Drgn, Goober, Bug-a-boo, Bug-a-bug,
Squirmington, Lady Heatherington Fusspants
Favorite Books (she LOVES storytime!): Snuggle Puppy, Babes of the Wild, Stanley & Rhoda
Favorite Songs: “Baby Mine,” “Slippery Fish” (or anything with hand actions), “Hard Scrabble Harvest”
Favorite Toys: Taggies blanket, an empty vitamin bottle (she chews on the dropper squeezer part, and I put some rice in it so it rattles a bit), links, pacifier (she’s getting pretty good at getting it into her mouth properly, but then she often pulls it back out and starts over again)
Favorite Activities: playing on the bathroom counter, going for walks (either in her stroller or the carrier, which she has just started to love)

IMGP7777as

Heather had her 6-month checkup on the 30th, and she’s doing great! She weighed in at 13.5 lbs, putting her up in the 9th percentile. This made me extremely happy. Guess those solids are really helping!

Heather really likes to be outside. All of these pictures (except the first one) were taken at a little park area across the street. She enjoys laying on the blanket and watching the treetops, but she also loves to watch the cars go by. So if she gets cranky, I will often take her for a walk. The change of scenery usually calms her right down.

IMGP7855as

She’s currently working on two major skills: sitting and crawling! She can sit, but somebody/thing has to support her so she doesn’t tip over. And she’s getting better and better at pulling her knees up under her (preparatory to crawling). So far, though, she just rocks; she hasn’t made any attempt to move from that position yet. But I bet it won’t be long!

IMGP7887as

And yes, she likes to put her fingers in my mouth. Best game in the world.

Bayesian Reasoning

May 10, 2012 4:10 pm

Bayesian reasoning (the application of Bayes’ theorem) is incredibly important, but virtually unknown (and not understood) in the general population.  While politicians, advertisers, and salespersons take advantage of this lack of understanding to extract votes and money; doctors, lawyers, and engineers can make life-threatening mistakes if they don’t apply the process correctly.  It’s a concept so vital to the proper interpretation of the world around us that I believe it should be a mandatory subject during high school.

Let’s start with an example to motivate the subject.  Let’s say you’re not feeling well and you go to your doctor.  Your doctor can’t determine what’s wrong and decides to run some blood tests.  The results come back and your doctor informs you that the test for a terminal disease came back positive.  Do you panic?  Probably.  Should you panic? Not necessarily.  There is vital information which we don’t know and need to know in order to understand the situation properly.

First, we need to know how accurate the test is.  We need to know the rates of type I and type II errors (“false positive” and “false negative”, respectively).  Let’s say you ask this question and your doctor tells you the test has a false positive rate of 1 in 100,000 and a false negative rate of 1 in 200,000.  One might believe that there is a 99.999% chance that you have this rare disease, but we need to interpret these error rates correctly.  This is where Bayes’ theorem comes in and to apply it we also need to know how rare the disease is.

Let’s say it’s an extremely rare disease, affecting 1 in 200 million people.  Knowing this you can update the probability that you have the disease to something more accurate.  Applying Bayes’ theorem we can calculate that a more accurate probability of having the disease is 4.8%.  That’s a pretty big difference.

There is a caveat though; we’re ignoring any compounding factors that led the doctor to run the test in the first place.  This calculation assumes that we had no particular reason to run the test, so we use the occurrence rate in the general population (1 in 200 million) in our calculation.  If you have specific risk factors that narrows the base group then the probability of having the disease will increase.

For example: let’s suppose that the doctor chose to run this test specifically because you have high cholesterol levels and a family history of diabetes.  Suppose that the disease occurs in roughly 1 in 1 million of people with those risk factors.  Now, instead of using the 1 in 200 million as our occurrence rate, we’d use the 1 in 1 million.  In which case the probability of having the disease rises to 9.1%.

Suppose another risk factor increases the likelihood from 1 in 1 million to 1 in 100.  Now the probability of having the disease shoots up to 99.9%.  It’s really important to understand what a positive result from a medical test actually means.  If you don’t understand Bayes’ theorem then you can wildly misinterpret reality and make some pretty serious mistakes.

Let’s do another example.  This one is a little easier to understand than the medical testing example.

When I bought my car in 2007, the dealership tried to tack on a charge for something which amounted to a small insurance policy which would pay out if the car were stolen.  The argument used to push this charge was that Honda Civics are the number one stolen car.  Of course, our questions are:  Is that true?  And does it mean what we think it means?

According to the Insurance Bureau of Canada’s 2006 list of the top ten most-stolen cars, the 2000, 1999, 1996 and 1994 Honda Civics took 4 of the 10 places.  Hmmm…sounds bad, huh?  But I’m sure you can guess by now that there’s a catch.

It’s vitally important to our analysis to know how many 2000, 1999, 1996, and 1994 Honda Civics exist in the first place and how many actually got stolen.  But we don’t have any of these numbers.  What we have is someone taking a list of stolen cars and adding up each type and declaring the Honda Civic as the most stolen car.  We need to know how many are stolen compared to how many of them exist.

Luckily for us, the Highway Loss Data Institute understands the difference and correctly reports the likelihood of a vehicle getting stolen by comparing the “‘theft claim frequency,’ which is the number of thefts reported for every 1,000 of each vehicle on the road.”  When we look at these numbers the picture changes entirely.  This top-ten list is filled with expensive cars like the Cadillac Escalade and several high-end pickup trucks.  The Honda Civic is nowhere to be found. 

If you don’t understand Bayes’ Theorem you can be manipulated into making bad decisions.  This applies all over the place in our lives.  It applies in our airport security procedures, our medical exams, our insurance decisions, political decisions, and our general level of fear about life.

You can read more about Bayes’ Theorem in its Wikipedia article.  I’m not going to try to teach it here (unless I hear a demand for it in the comments) because it’s not an entirely intuitive concept and it’s a little tricky to wrap your head around (which is why we get it wrong so often).

Mama’s Day Off

May 6, 2012 6:59 pm

  1. Heather slept through the night last night. As in, I put her down at 6pm last night as usual and she didn’t get up until 6:15am! Kyle went in at one point to check on her and moved her binky (which she had spit out) up to where she could easily find it, and that was all the intervention she required for 12 hours! She usually cries for her binky a few times a night and gets up to eat once. It was awesome.
  2. After I fed her at 6:30am, I wanted her to go back to sleep (though I didn’t think she would), so I started bouncing her, but then she got the hiccups, so I knew she wasn’t going back to sleep. I put her down in her crib, turned her mobile on, and let her play. After a while, I realized she hadn’t made any noise in a few minutes, so I went in and she was asleep. She has NEVER fallen asleep in her crib on her own. This was a little early for her usual morning nap (7:40am instead of 9am), but I wasn’t complaining. (I think she’d been awake for a long time before she started making noise at 6:15am.) And she slept for a whole hour!
  3. I brought Heather home from church after sacrament meeting to put her down for her nap, but she fell asleep in the car. I knew she was tired, but she hasn’t slept in the car in months (or anywhere other than her crib, for that matter—that’s why we went home early), so I didn’t try to keep her awake on the way home. But I managed to get her into the house still asleep, so I just put her carseat down in the nursery and let her sleep. She had another good hour-long nap! (The true significance of this item will be shown later.)
  4. This afternoon, the three of us went across the street to the park and hung out in the shade for a while. Kyle and I wanted to walk downtown to walk through the Wine Country Festival going on, but the sun was too hot for me. I went home while Kyle took Heather downtown, and they were gone for about 40 minutes. That’s 40 minutes I was home alone, with no baby!
  5. Once again, as I started to put Heather to bed tonight, she got the hiccups, so I just put her down in her crib to play until they went away. A few minutes later, I went in and she was asleep. Sweet!
What this boils down to is that I got to sleep all night last night, I got some alone time this afternoon, and I didn’t have to get Heather to sleep one single time today! I spent zero time bouncing her on that bleeping exercise ball! Heather’s gotten much better about going down relatively easy, but it’s still a chore, and since she won’t go to sleep for Kyle anymore, it’s always my chore. I feel like a whole new woman!