4
$\begingroup$

I was searching on this forum to calculate the p value from a t.test score.
So I found this topic.
The answer giving:

> 2*pt(ttestscore, lower=FALSE) 

However it makes no sense to me using the lower = FALSE.
enter image description here

When using the lower = F argument you will calculate the probability of the black shaded area in the second figure right?

This means that you are calculating the probability that the t score is LESS then the giving t score, but you want to calculate the probability that the T score is bigger (if you are giving the t score as a positive number)?

$\endgroup$
  • 3
    $\begingroup$ The argument is lower.tail and if set to FALSE the function gives the upper tail probability just as you'd expect and as the documentation says. Type ?pt in the R console. $\endgroup$ – dsaxton Oct 4 '16 at 17:43
  • $\begingroup$ You may find vonjd's answer in that thread relevant. In particular consider these two (equivalent) alternative versions, the first being his code: 1:... p.value = 2*pt(-abs(t.value), df=length(data)-1) ... $\qquad\quad\:\:$ 2: ... p.value = 2*pt(abs(t.value), df=length(data)-1,lower.tail=FALSE) $\endgroup$ – Glen_b Oct 4 '16 at 22:23
6
$\begingroup$

Check out the documentation for R's pt() function.

lower.tail
logical; if TRUE (default), probabilities are P[X ≤ x], otherwise, P[X > x].*

In other words, when lower.tail=FALSE you get the probability to the right of X (the first of your two diagrams).

Or just run it for yourself:

> pt(2,10)  
[1] 0.963306  
> pt(2,10,lower.tail = FALSE)  
[1] 0.03669402  
$\endgroup$
0
$\begingroup$

Student t distribution is symmetric. So if you calculate the area under upper tail and multiply it by 2, you end up with the 2 tailed p-value of your test score.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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