Monthly Archives: February 2015

Marilyn vos Savant and Monty Hall

There’s an article about the notorious Marilyn vos Savant Monty Hall Problem incident at Priceonomics that I saw linked from the Diversity in Physics and Astronomy Facebook group.  If you’re not familiar, I recommend both that article and (perhaps first) the Wikipedia page on the problem.

The short version is that Marilyn vos Savant (what a name!), billed in Parade magazine as the smartest person in the world, posed the Monty Hall problem to her readers, with the solution.  The problem is (my phrasing):

A game show.  Three large doors: one hides a car, the other two hide goats.  You, the contestant, may choose any door, and receive whatever is behind it as a prize.  No matter which you choose, the host, following the format of the game, lets you know the location of one of the goats by opening one of the doors you didn’t pick.  Then you have the option of switching to the third door.  Does switching improve your chances of winning the car?

In her column, vos Savant posed and solved the problem (the answer is yes, you should switch).  A huge backlash ensued over her (correct) solution, mostly because it is counter-intuitive.  Over the next few columns she explained the answer in detail and published some of the responses she got, many of which were nasty (I think it’s safe to assume the nastiest ones never saw print).

I remember getting this series of columns as a case study in my first probability class. I got very defensive over my contention that her solution was wrong wrong wrong, and I’m surprised how much I still get riled up about it.  Now, this was the first time I had seen this material, so it’s not surprising I didn’t get the right answer.  But what really galled me (OK, it still galls me so much I’m writing a blog entry about it) was that I was thrown by her wording in the original problem.

The problem only works if you know the host’s rules. WHY does he open door #3? Does the host open it every single time a contestant plays, or only if they pick a certain door? Does the host always open a door with a goat?

Here’s how vos Savant phrased it:

You pick a door, say #1, and the host, who knows what’s behind the doors, opens another door, say #3, which has a goat.

180px-Monty_open_door.svg

It’s the word “say” that threw me. It means that what comes next is arbitrary, specific to the example she’s giving. But does it refer to just the number on the door, or also to what’s behind it? Is it “another door, (say #3, which has a goat)” or “another door (say #3), which has a goat.”

If it’s clear to you from her wording that the host always:
a) must show you a door, which:
b) you didn’t pick AND
c) has a goat

Then her original column is fine. But that wasn’t how I interpreted it.

Now, I probably would have gotten it wrong even if I had interpreted it correctly, but the fact that the wording was ambiguous gave me a face-saving way to protect my fragile young ego.  Yes, I had the wrong answer, but that’s because I was solving the wrong problem!

Only when I got to the column where she explained the rules clearly (by suggesting a way the reader could prove it to themselves) did I understand how the problem was supposed to work, and then I felt duped.  So I remember being incredibly annoyed by her intransigence in subsequent columns — why couldn’t she just acknowledge that her original column was ambiguous?

I’m not defending her detractors here; I agree that the criticism of her column was over the top.  I’m sure many of the complainers understood the problem just fine and simply got it wrong, even (especially) the math and probability professors who should have known better.

Anyway, in the past when this incident came up I was always quick to point out the syntactic ambiguity and criticize her presentation of the problem (I guess I still am!).  But the framing of the Priceonomics article makes it clear that there was a good deal of sexism involved in the backlash, which is something that I hadn’t noticed before.  I was a less enlightened, young lad then — if the original columns had been by Richard Feynman or George Gamow perhaps I wouldn’t have felt so embarrassed about misreading them, and perhaps I would have learned more, instead of developing a 20 year-grudge?

At any rate, safe to say that my probability professor gave problems that really made me think.

Bonus: I vividly remember another problem from that class that has also stuck with me all these years, and made me better at understanding probability and its proper role in science.  A black box flashes (only) x’s and o’s.  The sequence you see is:

XXOXOXOOOXOXOOOXOXOOOX…

what is the probability that the next symbol will be an O?  Highlight the white text below for the answer:

There is no “correct” answer because the problem is somewhat ill defined.  If you notice that the series is that of the prime and composite numbers (X’s are prime) then you would say that the answer is 100% (24 is composite).  If you like, you can estimate the (undefined) probability that the series just appears to be the sequence of prime and composite numbers and use that in your answer (maybe in a Bayesian way).  Or you could assume that the series is random, and that each symbol is an independent draw If you do, you can estimate the chances that the next symbol is an O by adding up the total number of X’s and O’s, giving you 13/22.  

But the point is that probability theory is a model that we apply when we think we can describe some event as “random”, and as being drawn from a distribution we can characterize.  The correctness of your answer is subject to the correctness of your model.

Thanks Aki Roberge and Nicole Sullivan for spotting errors in post.

Does it transit?

Stephen Kane,  standing next to his magical starlight-catching, planet-finding bucket.

Stephen Kane, chief TERMIite, standing next to his magical starlight-catching, planet-finding bucket.

Regular readers know that I and my students are part of Stephen Kane’s TERMS consortium.  TERMS seeks to find a long period transiting planet around a bright star, by cleverly noting that so many longer period planets are known from radial velocities that there’s a good chance that a few of them transit.  This means we need to accurately calculate the orbital ephemerides of all of these planets and go watching their host stars for when they are in inferior conjunction (lined up).  If we check them all, sooner or later we’ll find one that happens to have its orbital plane lined up with our line of sight, and we’ll see a transit.

One of our first forays into this was Sharon Wang’s paper on HD 37605.  Sharon used whole troves of radial velocities to get a sufficiently precise ephemeris for HD 37605b, that the MOST satellite could search for transits.  We ruled them out at 100-σ, which is a dispositive null detection (i.e., we did not “fail to find a transit”, we found that it does not transit).

Natalie Hinkel, compiler of stellar abundances, exposer of underlying systematics therein, constructor of the Hypatia catalog, and presenter at the 18th Cambridge Workshop on Cool Stars, Stellar Systems, and the Sun

Natalie Hinkel, compiler of stellar abundances, exposer of underlying systematics therein, constructor of the Hypatia catalog, and presenter at the 18th Cambridge Workshop on Cool Stars, Stellar Systems, and the Sun

Well, TERMS is at it again.  Natalie Hinkel has just published her work on the HD 130322 system.  This star has a 11-day orbital companion, a roughly one Jupiter mass planet in an essentially circular orbit.  Because the star is nearby, determining whether this planet transits is important: if it does, it would be one of the brightest stars to host a transiting giant planet, and one of the “coldest” such planets known (since, in this game, an 11-day orbit is actually very long, so the planet isn’t very close to its star).

Natalie has previously made a name for herself with the Hypatia catalog (named for the ancient Egyptian astronomer/philosopher), which compiled abundance measurements for nearby, bright stars from the literature, and revealed that all the groups doing this sort of work are getting inconsistent answers.  Worse, she held a “stellar stoichiometry” workshop, where she challenged these groups to analyze the same data with the same assumptions — and they still all got inconsistent answers.  This is an important issue for stellar astrophysicists to untangle.

Henry

Greg Henry, photometrist extraordinaire.

But, back to the planets!  Natalie put together a thorough analysis of this star: my former undergraduate Katherina Feng did the orbital analysis as part of her senior thesis, and she determined the transit time window using Sharon Wang’s BOOTTRAN routine.

Greg Henry then phased up his many years of photometry from his small telescope array at Fairborn Observatory at this period, to hunt for the transit. Greg’s amazing collection of photometry for this star is sensitive to transits at this period at the 0.3 millimagnitude level.  Since a giant planet would generate a transit with a depth of 17 millimagnitudes, this is a a 50-σ null detection, which is dispositive.  HD 130322 does not transit its star.*

So, one more TERMS target down.  Stephen will catch his quarry eventually!

But there’s a lot more to this paper than this dispositive null result.  We provided chromospheric activity measurements which phase up nicely with Greg’s photometry at the stellar cycle period of the star, which is 5.2 years.  These data sets are anti-correlated, meaning that the star is slightly fainter (by 4 millimagnitudes = 0.4%!) during starspot maximum than during starspot minimum.  This is opposite the behavior of the Sun, but typical for younger stars.

Greg uses those starspots to easily pick out the rotation period of the sun, which is 26.5 days, indeed faster than that of the (older) Sun.

So even though we’re ostensibly studying planets, we’re actually learning a lot about Sun-like stars and how they behave.  Some might find this to be a necessary but boring step towards planets, but I actually find it to be one of the most interesting outputs of the exoplanet hunt.

Natalie’s paper is here.

*=Technically, it could still have just-barely-grazing transits.  These can never be totally ruled out from transit photometry alone.  Our dispositive null result is for non grazing transits (impact parameter less than 1-(R_planet / R_star).).  Also, the planet could in principle have an outrageously high density — if it is actually Earth-radius (despite having a Jupiter mass) then we would not see it transit.  Also, leprechauns might have shone tiny flashlights into the telescopes during the transits, ruining our experiment.  

Changing my brain (learning Python)

When we learn a new language , we have to retrain our brains to think in new ways.

Many of us that program forget how deeply counter-intuitive it is to write:

a=2
a=4
3=a

where the first two statements can both be valid in the same program, and not only is the third not a contradiction, it’s nonsense.  Thats because these aren’t equations.  Back in math, we learned in math that the = symbol is a comparison operator.  Computer programs have this, too, but it’s usually different, like .eq. or ==.

The equals sign in computer programming doesn’t mean “these two things are equal.” Instead, it means “the thing on the left is the address of a place in memory; erase whatever is in that part of memory and replace it with whatever the thing on the right evaluates to.”  Worse, in C the statement isn’t “true” if the two sides are equal, it’s true if the right hand side of the statement is true.

But after a while we get used to this sort of thing, and incorporate the totally different meanings for = into our brains without really realizing we’re doing it.

I’m learning Python now, and I’m having these sorts of major mental obstacles.  I know a smidgen of object oriented programming (some C++ and F90) but Python is requiring me to really reprogram my brain because it’s SO object oriented. Note that what follows is my very primitive attempt to wrap my brain around newfound knowledge, I’m sure I have the details wrong.

The first place I got hung up is that Python uses two different definitions for the = sign, and it’s almost never clear without context which is being used.  For instance, if I write:

a=2
b=a
b+=2
print(“a:”,a)
print(“b:”,b)

I get as output (from the print statements):

a: 2
b: 4

Things work basically like we expect. The variable b got the value 2 from a, I added 2 to that number “in place” (using the “+=” operator), then I printed out the two variables. Since I added 2 to b, and not to a, they have different values now. Just like we expect from C, FORTRAN, and most other languages.

But there’s another definition, too. If I write:

m=[2]
n=m
n+=[2]
print(“m=”,m)
print(“n=”,n)

things do not work this way. The syntax m=m+[2]” here means “add another element, 2, to the list m”. But what I get out is:

m: [2, 2]
n: [2, 2]

OK, so it didn’t do any array math, it appended another 2 to the end of the list. That’s fine, it’s just how operators work on lists, a choice the language creators made.

But why did m change?!

Because in this case, the statement “n=m” doesn’t mean “put the evaluated contents of m in the place in memory specified by n”. It means something very different: “from now until I redefine one of them, n and m are just different names for the same variable“. So, if I change either of them “in place” (by calling a function or using an operator like +=), the other one also changes.

So how is a user to know which = operator they are invoking when they type “a=b”? You have to know whether b is a “mutable” or “immutable” data type. Lists are “mutable”, so “=” here is an alias operator (and is commutative). Strings and floats are not, so “=” here is an assignment operator (and does not commute).

This will take getting used to.

The next thing I’ve gotten hung up on is that functions are just another kind of object, like variables, so they can be redefined just like variables. In other languages, I can write:

a=1.3
cos = cos(a)

and this means that I want my variable “cos” to refer to a place in memory that, for now, contains a floating point number equal to the mathematical cosine of the number 1.3.

But (one way to make) an equivalent statement in Python is:

from numpy import *
a=1.3
cos=cos(a)

(Python programmers are trying to stifle howls of protest right now…) The first line defines the mathematical function cos() (and many others) from the numpy module. The next two lines are equivalent to the above, with a major exception:

I no longer have access to the cosine function:

In: print(cos)
Out: 0.267498828625
In: cos=cos(a)
Out: TypeError
—-> cos=cos(a)
TypeError: ‘numpy.float64’ object is not callable

That’s because there’s a namespace collision: I have redefined cos to be a variable, so it’s no longer a function.

Again, it’s a choice Python made, and I’m sure it’s all very elegant and Pythonic. It shouldn’t be a problem, because my first statement that enabled this abomination, “from numpy import *” is B-A-D bad. One should instead import it as “import numpy as np” or some such, and call the cosine function as “np.cos()”

But the very fact that this is even possible is something I’m still wrapping my brain around.

n.b.: I’m not complaining about Python, attacking it, or saying it’s “wrong” or “bad”. I’m sure this will be a great, growing experience for me. I just find these choices in how the language works, especially the first one, hard to internalize. Why overload the = operator in a way that gives it two totally separate meanings like this? Why not use <- or <-> or something instead to distinguish?