There are two possibilities: either I’m crazy, or everyone else is wrong.

Well, I’m ’bout to prove I’m not wrong.

Yes, I know it’s hard for people to accept we should abandon the standard stats curriculum in favor of the GLM.

But you can’t deny you’ll get identical results doing a t-test as a GLM.

“Prove it!,” you say?

Well, I am happy to oblige.

Let’s go ahead and run a regular old t-test:

(Note the default t-test in R, Welch’s, does a correction which will make it not equal to a regression, hence the var.equal=TRUE. Thanks for the reminder Michael!)

Now let’s do the same thing as a glm:

Oh, would you look at that. The t-statistic for the t-test (-8.195) is exactly the same as the t-statistic for the “slope” in the linear model (8.195), at least in absolute value. (The t-test version subtracts north from south, while the glm version does the opposite).

It’s. The. Same. Thing.

Bazinga.

Except the GLM approach gives you more than the t-test and is easily expandable; the t-test is NOT.

And, of course, we might as well look at a graphic of the glm (which you cannot do with the t-test, btw).

plot of chunk unnamed-chunk-4

Leave a Reply

Your email address will not be published. Required fields are marked *