Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Critical t values in R

Tags:

r

I need to determine the critical t values for one-sided tails of 75% and 99%, for 40 degrees of freedom.

The following is code for a two-sided 99% critical t values:

qt(0.01, 40)

but how can I determine for a one-sided critical t value?

like image 355
luciano Avatar asked Jul 17 '12 15:07

luciano


People also ask

How do you find the critical value in R?

You can use the qt() function to find the critical value of t in R. The function gives the critical value of t for the one-tailed test. If you want the critical value of t for a two-tailed test, divide the significance level by two.

What are critical t values?

A critical-T value is a “cut-off point” on the t distribution. A t-distribution is a probability distribution that is used to calculate population parameters when the sample size is small and when the population variance is unknown. T values are used to analyze whether to support or reject a null hypothesis.

What is the critical value of T for a 95 confidence interval?

The critical value for a 95% confidence interval is 1.96, where (1-0.95)/2 = 0.025.


2 Answers

The code you posted gives the critical value for a one-sided test (Hence the answer to you question is simply:

abs(qt(0.25, 40)) # 75% confidence, 1 sided (same as qt(0.75, 40))
abs(qt(0.01, 40)) # 99% confidence, 1 sided (same as qt(0.99, 40))

Note that the t-distribution is symmetric. For a 2-sided test (say with 99% confidence) you can use the critical value

abs(qt(0.01/2, 40)) # 99% confidence, 2 sided
like image 193
Ryogi Avatar answered Sep 21 '22 00:09

Ryogi


Josh's comments are spot on. If you are not super familiar with critical values I'd suggest playing with qt, reading the manual (?qt) in conjunction with looking at a look up table (LINK). When I first moved from SPSS to R I created a function that made critical t value look up pretty easy (I'd never use this now as it takes too much time and with the p values that are generally provided in the output it's a moot point). Here's the code for that:

critical.t <- function(){
    cat("\n","\bEnter Alpha Level","\n")
    alpha<-scan(n=1,what = double(0),quiet=T)
    cat("\n","\b1 Tailed or 2 Tailed:\nEnter either 1 or 2","\n")
    tt <- scan(n=1,what = double(0),quiet=T)
    cat("\n","\bEnter Number of Observations","\n")
    n <- scan(n=1,what = double(0),quiet=T)
    cat("\n\nCritical Value =",qt(1-(alpha/tt), n-2), "\n")
}

critical.t()
like image 32
Tyler Rinker Avatar answered Sep 20 '22 00:09

Tyler Rinker