Roger D Metcalf DDS, JD

PO Box 137442

Fort Worth, TX 76136-1442

ph: +1-817-371-3312

roger

*How to actually calculate it by hand--not simply how to go look it up in a book. *

*But you still have to use a computer.*

*© 2021 Roger D Metcalf. All Worldwide Rights Reserved. *

I’m enrolled in the PhD program in Forensic Science at Oklahoma State University. This semester (Spring 2021) one class I’m taking is a statistics class under Dr. Mark Payton. In our review of various statistical methods, he had us look at, of course, two-sample methods that might be employed in research. The test statistic calculated for many designs is the good old *t-*statistic, and we are usually most interested in the p-value for that calculated *t*-statistic.

Now the *t*-value itself can generally be calculated in a pretty straightforward way, the p-value not so much. In fact, almost every text I’ve seen says something along the lines of “calculate the *t*-value and then go look up the associated p-value in a table--or use one of the many probability calculators available online.” They don’t really go into the nuts-and-bolts computation of the p-value *per se*.

Ok, fine. But *somebody* *somewhere* had to calculate all those numbers in all those tables, and *somebody* had to tell my TI calculator how to calculate that p-value--*so how did they do it?*

I’m one of those people who don’t always “get” things right away and it really helps me to work through the calculations by hand. So, again, how do I compute the p-value “by hand”?

It’s not so straightforward.

Like I said, every internet search I made looking for step-by-step instructions on how to determine the p-value for a *t-*statistic was “here’s how you look it up in a table” or “here’s how to find it with a TI calculator”…*but not how to actually do the math. *

So I pulled out an old trusty copy of the 29^{th} edition of *CRC Standard Mathematical Tables and Formulae *and found this nugget on page 514:

Fig. A.

Now, above is how the function appears after I got it uploaded and working with Maple 2020^{®} and not precisely how it appears in the CRC book. I also found another form for this function on page 19 of my very old copy of *Biometrika Tables for Statisticians Volume 1, *and that one helped me eventually get this one working.

Anyway, the above form in Fig. A works just fine for calculating the desired p-value for a given *t *and *n *with computer software*—*but again, just how would one calculate this “by hand”? Maple math software can instantly evaluate the above just fine, I can't.

Well, for one thing we have to go find out how to evaluate those pesky Gamma functions--which is trivial for positive integers, but look at our function: whether *n* is an even number or odd, we're surely going to have a fraction involved in that Gamma function in the numerator because of all the stuff going on up there--example: *t*^2 is almost certainly not going to be a nice integer. Further, if *n* is odd we'll wind up with a fraction in the Gamma function in the denominator, too. Those are not very easy to evaluate.

Anyway, in Fig. B is what I finally got working in Maple (the integral used to evaluate Gamma is found on pp. 350-51 of the CRC handbook I'm consulting):

Fig. B.

(I know the images here are small, but you can click on them and zoom in.)

It’s a thing of beauty and it took only a little bit of tweaking the equation to finally get it into a form that actually worked in Maple—and please keep in mind that I want this basically as a check to see if I got it “right” when I did the math myself.

So, the point is: now I can sit down and have a decent chance of working through this by hand with my good old antique HP-67 calculator if I have to. I could--probably, LOL. Still not easy, but certainly more do-able than before. And now I have a much better grasp on what's going on "behind the curtain" as it were.

Of course, it might strike one right away that evaluating this and other assorted functions in order to assemble those tables like the logarithm tables and *z*-tables and F-tables we now take for granted was a gargantuan task a hundred-and-fifty-or-so years ago before computers. Very impressive feats, indeed!

I found out that one of the coolest things about Maple 2020^{® }is that one can work out the layout of the function by hand with pencil and paper and then just take a photo of it with the Maple Calculator app for iPhone, upload the expression to one’s Maple cloud account, and shoot it right on into the Maple software. Very neat. No, wait…*extremely awesome.*

One can use Maple on the above function to “evaluate at a point”--enter *n* (which sometimes is sample size and sometimes is degrees of freedom) along with the *t-*value one has calculated and Maple will instantly compute the associated p-value.

Ok, right, there seems to be dozens of online probability calculators that will do this exact same thing, yeah, yeah, but, again, you don’t *really* know how they’re calculating the result and here you can see what you’re doing.

___________________________________________

** But I haven't seen any of them do the plots in the next column!! >>>>>>>>>>>>>>>**

___________________________________________

Fig. 1. Looking at the 3D plot of the *t*-distribution family from straight on—the 2D view that we always see in textbooks. But we're really looking into a sort of "tent" here as it turns out.

Fig. 2. When you think about it, we have two variables we’re dealing with here—the *t*-value *AND* the degrees of freedom—so wouldn’t that mean we could have a 3D plot? Yeah we can. Here we’ve started rotating that 3D plot a little bit.

Fig. 3. Looking at the *t-*distribution family-the "tent"--directly from the side instead of directly from the front as we usually do. Here our x-axis is now the degrees of freedom. Notice the *t-*value seems to flatten out at about *n* = 30 or so. Awesome. Kind of interesting as to what’s going on at around *n *= 0 to 5 or so down in the lower R corner of the plot…Gamma gets funky at *n* = less than 1 and is not defined for 0 or less.

Fig. 4. Rotating our *t-*distribution some more.

Fig. 5. Rotating the *t*-distribution yet more to look at the “back end” of the plot. Awesome.

Fig. 6. And finally here is our *t*-distribution family rotated all the way round to look directly at “the back end of the tent.” Very cool—compare to Fig. 1.

The 3D plots produced by Maple are awesome, in my opinion. Maple 2020 did this for me. Thank you Maple!!!

And, ok, ok, if you know a little R or Python--or even if you have a TI-84--it's pretty easy to get these numbers using one of those. And there's also dozens of online probability calculators one could use....but I wanted to know how to do the math....

*The computations here were performed using Maple 2020®.*

* Maple is a trademark of Waterloo Maple, Inc.*

**References**

Maple2020. Maplesoft, a division of Waterloo Maple, Inc., Waterloo, Ontario.

Percentage points, Student’s t-distribution. (1991). *CRC Standard mathematical tables and formulae, 29 ^{th} edition. *W.H. Beyer, ed. Boca Raton, FL:CRC Press, Inc.

The t-distribution. (1962). *Biometrika tables for statisticians. Volume 1. *E.S. Pearson and H.O. Hartley, eds. Cambridge:Cambridge University Press.

** Now, you may ask, "why the interest in these statistical things?" **

**For one thing, I really like doing statistics. In my PhD program I actually have a declared minor in Statistics--not many PhD programs have real "minors," but mine does.**

**And, not to be ****too**** coy, it may also have something to do with dental age assessment. Stay tuned.....**

**My early statistical training was as a hard-core, staunch frequentist. But then I went to Business School....**

© Copyright 2013, 2019 Roger D Metcalf DDS, JD. All worldwide rights reserved. No reproduction without permission. Neither the Tarrant County Medical Examiner's District, Tarrant County, the American Board of Forensic Odontolgy, the American Society of Forensic Odontology, the Royal College of Physicians, Oklahoma State University, nor any other organizaion mentioned here necessarily supports or endorses any information on this website. Any opinions, errors, or omissions are my responsibility, and mine alone. This site DOES NOT REPRESENT the official views of any of these--or any other-- organizations. Similarly, those other organizations may not fully represent my views, either.

Roger D Metcalf DDS, JD

PO Box 137442

Fort Worth, TX 76136-1442

ph: +1-817-371-3312

roger