1

How do I obtain critical T values?

Using apache stat I can't seem to get the values?

For instance

Tdistribution t= new Tdistribution(10);
t.CumulativeProbabilty(0.05);//alpha=0.O5

if you look in table values are different.

shmosel
  • 49,289
  • 6
  • 73
  • 138
larry mintz
  • 109
  • 3
  • 1
    1. cumulativeProbability computes the CDF, i.e. the input is a t-value and the output is a P-value. You are looking for the opposite, i.e. the input is a P-value and the output is a t-value. This is called the inverse CDF and looking at the docs, it appears that apahe-commons-math doesn't do it. – David Wright May 09 '17 at 18:17
  • 1
    2. Most tables for critical t-values are for two-sided tests. That means that it gives you the t-value for which P(t' < -t) + P(t' > t) = P. The t distribution is symmetric, so that's the same as 2 P (t' < -t) = P. So once you find an inverseCumulativeProbability method, you want -inverseCumulativeProbability(P / 2) to match the table value. – David Wright May 09 '17 at 18:21
  • @DavidWright, I could seriously kiss you right now! That detailed explanation was exactly what I needed for my statistic project. Thank you, I think this should be the accepted answer. :) – Kaitn13 Nov 08 '22 at 21:49

1 Answers1

1

My guess is that you might be interpreting the values of the t-table incorrectly.

Take for example the exercise proposed here:

A t-value of 2.35, from a t-distribution with 14 degrees of freedom, has an upper-tail (“greater than”) probability between which two values on the t-table? Answer: 0.025 and 0.01 Using the t-table, locate the row with 14 degrees of freedom and look for 2.35. However, this exact value doesn’t lie in this row, so look for the values on either side of it: 2.14479 and 2.62449. [...]

If you try to solve this with apache-commons-math you get the following,

TDistribution t = new TDistribution(14);
System.out.println(1- t.cumulativeProbability(2.35));

0.016981716091246768

which is ok with the results, however more accurate. 0.016 is indeed between 0.025 and 0.01.

If you want to get straight a value of the t-table, like for example probability with 10 degrees of freedom and a t-value of 1.812461, the answer is

t = new TDistribution(10);
System.out.println(1- t.cumulativeProbability(1.812461));

0.050000010018874885

while the probability value in the table is 0.5

EDIT after comments: In order to calculate the quantile, you have to use inverseCumulativeProbability. This is in the abstract class AbstractRealDistribution.

System.out.println(t.inverseCumulativeProbability(0.95));
1.8124611228157772
lrnzcig
  • 3,868
  • 4
  • 36
  • 50