Hi everyone,
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.
-
it sounds like you are asking 'how do i compute a p-value', which isn't really a programming/implementation question, it's a theory question. if that is the case, your best bet is probably your stats book, your professor, or
http://en.wikipedia.org/wiki/P-value
and,
Some Statistical Issues in the Comparison of Speech Recognition Algorithms
also has some good, if somewhat advanced info.
-
If you are doing a two-tailed test, then your p-value = 2*P(T > t), where t is your calculated test statistic. So essentially, you need a way to model the T-dist in order to integrate(T-dist from t to INFINITY). Here is a demo: http://www.stat.tamu.edu/~west/applets/tdemo.html
I'm not familiar with Perl and its libraries, but hopefully this gets you started. You can write a rudimentary integrator and check some values to make sure that it is accurate enough.
j_random_hacker : FWIW, I think this is the best answer... :) -
CPAN is your friend:
http://search.cpan.org/~mikek/Statistics-Distributions-1.02/Distributions.pm
-
Using Statistics::Distributions seems pretty straightforward:
print Statistics::Distributions::tprob($dof,$tstat);
In addition, Statistics::Distributions::Analyze will perform the entire t-test.
Abdel : Thanks a lot u guys! I really appreciate all your help. I think bubaker's answer is the one I needed!
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.