Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I calculate a p-value if I have the t-statistic and d.f. (in Perl)?

I have written a Perl script that performs many one-sample t-tests. I get thousands of t-statistics with their degrees of freedom (df). I need to upgrade the script to also return their p-values (there are too many to look them up manually in a table). Is there some kind of formula I can use for this with the t-statistic and d.f as input? I hope someone can help me with this, many thanks in advance!

A.A.

like image 917
Abdel Avatar asked Dec 06 '22 06:12

Abdel


1 Answers

Using Statistics::Distributions seems pretty straightforward:

print Statistics::Distributions::tprob($dof,$tstat);
like image 177
bubaker Avatar answered Dec 28 '22 05:12

bubaker