Skip to main content

"lower.tail" confusion in R.

 "lower.tail" in R  I usually get confused on how to use the argument in "pt" function and similar function. Here I will focus on t-distribution. I will utilize Minitab for graphical presentation. A:- lower.tail is FALSE       In R The code is  > pt(q = -2.262, df = 9, lower.tail = FALSE) The output  [1] 0.9749936      In Minitab This is shown as in the graph from Minitab. So when FASLE is chosen, the calculation will give the area after the critical value. B:- "lower.tail" is TRUE      In R  the code is  pt(q = -2.262, df = 9, lower.tail = TRUE) the output is  [1] 0.02500642      In Minitab When TRUE is used, it orders R to compute the area before the critical value.

How to compute the probability between two values using t-distribution in R.

 To compute the "P" between two cut offs in t-distribution (two points) in R.

The example uses the d.f. = 9 i.e. n = 10 , first quantile -2.262, the second quantile is 2.262.

I used Minitab to give a graphical representation of that as below:-



The code in R to use is as follow:- 

pt(q = 2.262, df = 9, lower.tail = TRUE) - pt(q = -2.262, df = 9, lower.tail = TRUE)

I recomend to play a little with above code, to find out the argument "lower.tail" , when it is TRUE and FALSE.

The output from R is :-

[1] 0.9499872

Which when rounded, it will be 0.95 as Minitab.

P.S 

d.f. ; degree of freedom.

Comments

Popular posts from this blog

"lower.tail" confusion in R.

 "lower.tail" in R  I usually get confused on how to use the argument in "pt" function and similar function. Here I will focus on t-distribution. I will utilize Minitab for graphical presentation. A:- lower.tail is FALSE       In R The code is  > pt(q = -2.262, df = 9, lower.tail = FALSE) The output  [1] 0.9749936      In Minitab This is shown as in the graph from Minitab. So when FASLE is chosen, the calculation will give the area after the critical value. B:- "lower.tail" is TRUE      In R  the code is  pt(q = -2.262, df = 9, lower.tail = TRUE) the output is  [1] 0.02500642      In Minitab When TRUE is used, it orders R to compute the area before the critical value.