Bayes is Baaack

Bayes illustration

Screen shot from Fathom showing prior (left) and posterior (right) distributions for a situation where you flip a coin 8 times and heads comes up once. Theta is the imagined probability of heads for the coin.

Actually teaching every day again has seriously cut into my already-sporadic posting. So let me be brief, and hope I can get back soon with the many insights that are rattling around and beg to be written down so I don’t lose them.

Here’s what I just posted on the apstat listserv; refer to the illustration above:

I’ve been trying to understand Bayesian inference, and have been blogging about my early attempts both to understand the basics and to assess how teachable it might be. In the course of that (extremely sporadic) work, I just got beyond simple discrete situations, gritted my teeth, and decided to tackle how you update a prior distribution of a parameter (e.g., a probability) and update it with data to get a posterior distribution. I was thinking I’d do it in Python, but decided to try it in Fathom first.

It worked really well. I made a Fathom doc in which you repeatedly flip a coin of unknown fairness, that is, P( heads ) is somewhere between 0 and 1. You can choose between two priors (or make your own) and see how the posterior changes as you increase the number of flips or change the number of heads.

Since it’s Fathom, it updates dynamically…

Not an AP topic. But should it be?

Here’s a link to the post, from which you can get the file. I hope you can get access without being a member. Let me know if you can’t and I’ll just email it to you.

Posted in Bayesian, content, Fathom tips, modeling, technology | Leave a comment

Science and Bayes

Right now, I’m pedaling really hard as I’m teaching a super-compressed (3 hours per day) math class for secondary-credential students. That’s my excuse for the slow-down in Bayes posts. The other being the ongoing problem that it takes me hours to write one of those; how Real Bloggers (the ones with more than about 6 readers) manage it I still do not understand.

So yesterday I dropped into my students’ morning class (physics) and heard the instructor (Dave Keeports) discuss the nature of science. Right up my alley, given my heartbreaking NSF project on teaching about the nature (and practice) of science. Also, the underlying logic of (Frequentist) statistical inference is a lot like the underlying logic of science (I’ve even written about it, e.g., here).

Anyway: Dave emphasized how you can never prove that a hypothesis is true, but that you can prove it false. Then he went on a little riff: suppose you have a hypothesis and you perform an experiment, and the results are just what your hypothesis predicts. Does that prove the hypothesis is true? (“No!” respond the students) Okay, so you do another experiment. Now do you know? (“No!”) But now you do a few dozen experiments, coming at the problem from different angles. Now do you know it’s true? (“No!”) 

But wait—don’t you eventually get convinced that it’s probably true? He went on to talk about how, when we have a great body of evidence and general agreement, hypotheses can become “Laws,” and somewhere in there, we have coherent collections of hypotheses and data that warrant calling something a “theory,” at least in common parlance.

He didn’t stress this, but it was really interesting to see how he slid from firm logic to the introduction of opinion. After all, what constitutes enough evidence to consider a hypothesis accepted? It’s subjective. And it’s just like Bayesian inference, really just like our hypothesis about the coin: each additional head further cements our belief that the coin is double-headed, but it’s always possible that it was a fair coin.

Philosophers of science must have applied Bayesian reasoning to this issue. 

Posted in Bayesian, content, philosophy | Tagged , , | Leave a comment

A Bayesian Example: Two coins, three heads.

As laid out (apparently not too effectively) here, I’m on a quest, not only finally to learn about Bayesian inference, but also to assess how teachable it is. Of course I knew the basic basics, but anything in stats is notoriously easy to get wrong, and hard to teach well. So you can think of this in two complementary ways:

  • I’m trying to ground my understanding and explanations in basic principles rather than leaping to higher-falutin’ solutions, however elegant; and
  • I’m watching my own wrestling with the issues, seeing where I might go off-track. You can think of this as trying to develop pedagogical content knowledge through introspection. Though that sounds pretty high-falutin’.

To that end, having looked critically at some examples of Bayesian inference from the first chapters of textbooks, I’m looking for a prototypical example I might use if I were teaching this stuff.  I liked the M&Ms example in the previous post, but here is one that’s simpler—yet one which we can still extend.

USCoinsThere are two coins. One is fair. The other is two-headed. You pick one at random and flip it. Of course, it comes up heads. What’s the probability that you picked the fair coin?

Continue reading

Posted in Bayesian, content, curriculum development, philosophy | Tagged , , , | 1 Comment

The Search for a Great Bayesian Example

When we teach about the Pythagorean Theorem, we almost always, at some point, use a 3-4-5 triangle. The numbers are friendly, and they work. We don’t usually make this explicit, but I bet that many of us also carry that triangle around in our own heads as an internal prototype for how right triangles work—and we hope our students will, too. (The sine-cosine-1 triangle is another such prototype that develops later.)

In teaching about (frequentist) hypothesis testing, I use the Aunt Belinda problem as a prototype for testing a proportion (against 0.5). It’s specific to me—not as universal as 3-4-5.

Part of this Bayesian quest, I realized, is to find a great example or two that really make Bayesian inference clear: some context and calculation that we can return to to disconfuse ourselves when we need it.

The Paper Cup Example

Here’s the one I was thinking about. I’ll describe it here; later I’ll explain what I think is wrong with it.

I like including empirical probability alongside the theoretical. Suppose you toss a paper cup ten times, and 8 of those times it lands on its side. At that point, from an empirical perspective, P( side ) = 8/10. It’s the best information we have about the cup. Now we toss it again and it lands on its side. Now the empirical probability changes to 9/11.

How can we use a Bayesian mechanism, with 8/10 as the prior, to generate the posterior probability of 9/11?

It seemed to me (wrongly) that this was a natural. Continue reading

Posted in Bayesian, content, curriculum development, philosophy | Tagged , , , , , , | 4 Comments

Early Bump in the Bayesian Road: a Search for Intuition

Last time, I introduced a quest—it’s time I learned more about Bayesian inference—and admitted how hard some of it is. I wrote,

The minute I take it out of context, or even very far from the ability to look at the picture, I get amazingly flummoxed by the abstraction. I mean,

P(A \mid B) = \frac{P(A)P(B \mid A)}{P(B)}

just doesn’t roll of the tongue. I have to look it up in a way that I never have to with Pythagoras, or the quadratic formula, or rules of logs (except for changing bases, which feels exactly like this), or equations in kinematics.

Which prompted this comment from gasstationwithoutpumps:

I find it easiest just to keep coming back to the definition of conditional probability P(A|B) = P(A & B) / P(B). There is no complexity here…(and more)

Which is true, of course. But for this post I’d like to focus on the intuition, not the math. That is, I’m a mathy-sciencey person learning something new, trying to record myself in the act of learning it. And here’s this bump in the road: What’s up with my having so much trouble with a pretty simple formula? (And what can I learn about what my own students are going through?) Continue reading

Posted in Bayesian, content, curriculum development, philosophy | Tagged , , , | 3 Comments

A Closet Bayesian

At least that’s how I’ve described myself, but it’s a weak sort of Bayesianism because I’ve never really learned how to do Bayesian inference.

It’s time that chapter came to a close. So, with luck, this is the first in a series of posts (all tagged with “Bayes”) in which I finally try to learn how to do Bayesian inference—and report on what happens, especially, on what is confusing.

Bayesian rumors I’ve heard

Let’s begin with what I know—or think I know—already. Continue reading

Posted in Bayesian, content, philosophy | Tagged , | 5 Comments

How Good is the Bootstrap?

There has been a lot of happy chatter recently about doing statistical tests using randomization, both in the APStat listserve and at the recent ICOTS9 conference. But testing is not everything inferential; estimation is the other side of that coin. In the case of randomization, the “bootstrap” is the first place we turn to make interval estimates. In the case of estimating the mean, we think of the bootstrap interval as the non-Normal equivalent of the orthodox, t-based confidence interval. (Here is a youtube video I made about how to do a bootstrap using Fathom.) (And here is a thoughtful blog post by list newcomer Andy Pethan that prompted this.)

But Bob Hayden has recently pointed out that the bootstrap not particularly good, especially with small samples. And Real Stats People are generally more suspicious of the bootstrap than they are of randomization (or permutation) tests.

But what do we mean by “good”?

Continue reading

Posted in content, philosophy, Randomization, technology | Tagged , | 2 Comments

“You Get What You Assess”: another couple cents about the Common Core

common_core_logoIn discussions about the Common Core, I often hear (and often say), “you get what you assess.”

Sometimes, this is a backhandedly snarky dig at real classroom teachers: we’re saying, essentially, “we don’t trust teachers to do the right thing on their own, so we have to implement some sort of stick, in the form of an assessment, so that when they inevitably teach to the test, at least they’ll teach the right stuff.”

But it has another meaning: the Common Core Standards are, like the constitution, subject to interpretation. And the interpretation that will get implemented is in the hands of the assessors.

I don’t think there’s a way around this second point. We can’t write standards unambiguously and completely—and get them agreed on. This way, if we’re feeling charitable, we can see in the Standards what we want to see, enough, at least, so we can move forward. When I first read the grade 7 standards on stats and probability, my reaction was, OMG this is way too early! This is the college course! but when I calmed down, I realized that if we interpret the words of the Standards in a humane way, the 7.SP standards make sense and are the right thing at the right time.

But that does put a lot of power in the hands of assessment developers. They don’t ask me what I think we ought to ask seventh-graders about statistics—so I’m bound to think they’ve gotten it wrong :)

More importantly, (as was recently pointed out by an NCTM officer but I can’t find the reference) much of the giant brouhaha about Core Standards, corporate control of education, lack of teachers on the committee, and so forth, misses the point: the Standards themselves are probably OK; but the devil is in the assessment: what will students actually be asked to do, what do we need to do to prepare teachers to get students ready, and what are the consequences for teachers, schools, and students?

Posted in Core Standards, philosophy | Tagged , , | 1 Comment

Hanging Slinky Analysis 2: The Pre-Tension Wrinkle

Hanging SlinkyLast time, we saw how the length of a hanging slinky is quadratic in the the number of links, namely,

\Delta x = \int \mathrm{d}x = \int_0^M \sigma mg \, \mathrm{d}m = \frac {\sigma M^2 g}{2},

where M is the mass of the hanging part of the slinky, g is the acceleration of gravity, and \sigma is the “stretchiness” of the material (related to the spring constant k—but see the previous post for details).

And this almost perfectly fit the data, except when we looked closely and found that the fit was better if we slid the parabola to the right a little bit. Here are the two graphs, with residual plots:

HangingSlinkBothGraphs

Continue reading

Posted in content, curriculum development, modeling, technology, Uncategorized | Tagged , , | 1 Comment

Hanging Slinky Analysis 1: Sums to Integrals

Hanging Slinky

Last time, we (re-)introduced the Hanging Slinky problem, designed a few years back as a physics lab but suitable for a math class, say Algebra II or beyond. We looked at the length of the hanging slinky as a function of the number of slinks that hang down, and it looked seriously quadratic.

I claim that knowing that the real-world data is quadratic will help you explain  why the data has that shape. That is, “answer analysis” will guide your calculations.

I beg you to work this out for yourself as much as you can before reading this. I made many many many wrong turns in what is supposed to be an easy analysis, and do not want to deprive you of that—and the learning that comes with it.

HangingSlinkyWithParabola Continue reading

Posted in content, curriculum development, modeling, philosophy, technology | Tagged , , , , | 2 Comments