0
$\begingroup$

I'm reading Discovering Knowledge in Data by Daniel T. Larose. In the two-sample t-test for difference in means section, there is the following example:

tdata = x-bar(1) - (xbar2)/ sqrt(s^2(1)/n(1)+ s^2(2)/(n2) =

1.5714 - 1.5361 / 1.3126^2 + 1.3251^2 = 0.6595

The two-tailed p-value for tdata = 0.6594 is :

p-value = 2 x p(t> 0.6595) = 0.5098

My problem is that there is no reference or explanation in the book about how the result 0.5098 came to be. For example, how do we get 0.5098 from 2 x p (t > 0.6595). So, I don't know what numbers the variable p and t are equivalent to in order to give me that results. Also, I don't understand ">" being there and how is that calculated. Does it make sense?

$\endgroup$
3
  • $\begingroup$ It comes from referring the obtained value of $t$ to the $t$ distribution. Can you clarify which part of that you do not understand, if any, by editing it into your post? Not sure why this got downvoted. $\endgroup$
    – mdewey
    Commented Jan 25, 2017 at 9:30
  • $\begingroup$ @mdewey ok so I edited the post. Hopefully yo can understand the problem better. $\endgroup$
    – KetDog
    Commented Jan 25, 2017 at 14:53
  • $\begingroup$ In t-testing, you compute the degrees of freedom and a test statistic, in your case $t_{data}=0.659$. The probability of some t under the null hypothesis being larger than nur your $t_{data}$ can then be looked up in a table or in your software. see en.wikipedia.org/wiki/… for an example $\endgroup$
    – Bernhard
    Commented Jan 25, 2017 at 14:58

1 Answer 1

2
$\begingroup$

First, a little background on the meaning of a p value

The p value in a t-test (any t-test, not just two independent samples) refers to what proportion of t-statistics (for those degrees of freedom) are that extreme or more, assuming you want a two-tailed p value. If you want a one-tailed p value, then it's what proportion of t-statistics (for those degrees of freedom) are that high or higher (for the positive tail) or that low or lower (for the negative tail).

There is a defined theoretical distribution of t-statistics (the t distribution). So as long as you know how many degrees of freedom you have, you know theoretically what distribution your t-statistic came from under the null hypothesis. That mens you can compare that t-statistic to the rest of its null distribution --- if it's a very unusual value for that distribution (i.e. way out in one of the tails), the you conclude that it is unlikely to have come from the null distribution. The p value is simply the proportion of the distribution --- the area under the curve --- that is at least as far from 0 as your t-statistic.

How p values are calculated

So in order to calculate the p value that corresponds to a particular t-statistic at some degrees of freedom, you need to measure the area under the curve from that point on out. Since the distribution is symmetrical, you can simply double that value to get the two-tailed p-value. If you've taken calculus, you may already know what needs to be done: The area under a curve is the integral of the function that defines the curve. Here's the function that defines the t-distribution (its probability density function, or PDF):

t dist PDF

where nu (looks sort of like a "v") is the number of degrees of freedom and Gamma (looks sort of like an upside down "L") is the gamma function.

In your example, your t statistic is 0.6595. You want to get the area under the curve from 0.6595 up, i.e. from 0.6595 to positive infinity. You would enter these as the values over which to integrate, and then crunch through the calculus to evaluate the integral of the t PDF function. This gives you the area under the curve from 0.6595 up, but for a two-tailed test you also want it from -0.6595 down. Since the distribution is symmetrical, you don't have to separately calculate that --- it will be exactly the same, so you can just double the value you got from 0.6595 to positive infinity.

That's a lot of intense calculation for what is otherwise a pretty simple test; most of us casual t-test users are not up for that kind of time investment. Instead, we have historically printed out tables of already-calculated p values for a range of degrees of freedom and t-statistics (you are likely to find such a table in the back of your intro to stats text book), or included algorithms in our software that do the heavy lifting of the p value calculation for us, as is suggested by the p() function in your question. That function represents the area under the curve of the t-statistic PDF for greater than or equal to your observed t-statistic. In R, that function is pt().

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.