Roger D Metcalf DDS, JD

 

Forensic Odontology

and Some Other Stuff

 

 

 Odontologists--remember we need basic, foundational research in all areas of our discipline.  Are our procedures scientifically valid? 

 

Critically examine everything we've been taught.  Question the scientific basis of every standard, guideline, best practice, or principle followed.

 

Keep in mind  the quote attributed to W. Edwards Deming: "Without data you are just another person with an opinion."  I would add, if you use incorrect data, you are commit forensic malpractice, because, after all: "First, do no harm."

 

Merely saying "we're following the science" without verifying that the "science" being followed is actually true is the same thing that a religion or cult does.

 

 

 

 

Roger D Metcalf DDS, JD
PO Box 137442
Fort Worth, TX 76136-1442

ph: +1-817-371-3312
fax: +1-817-378-4882

metcalfdds@gmail.com

  • Home
  • Go Do Some Research!
  • Some Texas Legal Cases and Documents of Note
  • Doyle v. State of Texas
  • Striae of Retzius and Perikymata
  • Statistics Stuff
    • Best Calculators for Stats Class
    • Calculating exact p-value for a t-statistic
    • Calculating exact p-value for an F-ratio and for Chi Square
    • Some things that would be cool to have with calculators
  • Dental Age Guesstimation Bibliography
  • "Bite This!"
  • Contact

Calculating exact p-value for a t-statistic

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 familiar t-statistic, and we are usually most interested in the p-value for that calculated t-statistic.

   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, but somebody somewhere had to calculate all those numbers in all those tables, and somebody had to program my calculator so that it could 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.

   Pretty much 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 calculator”…but not how to actually do the math. 

   I looked through an old copy of the 29th edition of CRC Standard Mathematical Tables and Formulae and found this entry on page 514:

Fig. A.   

   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.   

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

   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 referencing): 

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.

  Now I can sit down and have a decent chance of working through this by hand (albeit with calculator assistance).  Maybe not easy to do by hand, but certainly more do-able than before.  But the point is I now have a much better grasp on what's going on "behind the curtain" as it were.

   It might occur to one 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 couple of hundred-or-so years ago before electronic 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 along with the t-value one has calculated and Maple will instantly compute the associated p-value. 

   And, admittedly, there seems to be dozens of online probability calculators that will do this exact same thing--and even my old HP-21S calculator will do the calculations with, literally, just a couple of clicks--but, again, you don’t really know how they’re calculating the result, while 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 independent 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? Yes, 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 starts getting funky at n < 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!!!


   Again, if you know a little R or Python--or if you're using a TI-84 (or, especially, an HP-21S)--or, really, pretty much any high-end graphing calculator--it's fairly easy to get these numbers with one of those programs.  And, of course, all the serious stats programs--Statistica, SAS, JMP, SPSS, Minitab, NCSS, etc.--live for doing these calculations.  There's also dozens of probability apps and online probability calculators one could use....but I wanted to know the calculations involved.


  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, 29th 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.


   You might ask, "why the interest in these statistical things?" 

   For one thing, I just 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.


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

© Copyright 2013, 2019 Roger D Metcalf. 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.

 

Web Hosting by Yahoo

Roger D Metcalf DDS, JD
PO Box 137442
Fort Worth, TX 76136-1442

ph: +1-817-371-3312
fax: +1-817-378-4882

metcalfdds@gmail.com