How to find critical value for one-sided and two-sided t test in R?


To find the critical value for t test in R, we need to use qt function. This function requires level of significance and the sample size and returns the tabulated or critical value of t distribution. Below examples shows the calculation of critical value for different situations such as left-side test, right-side test or two-sided test.

Left side critical value with sample size 30 and 95% confidence level −

Example

 Live Demo

qt(0.05,30)

Output

[1] -1.697261

Right side critical value with sample size 30 and 95% confidence level −

Example

 Live Demo

abs(qt(0.05,30))

Output

[1] 1.697261

Example

 Live Demo

qt(0.05,50)

Output

[1] -1.675905

Example

 Live Demo

abs(qt(0.05,50))

Output

[1] 1.675905

Example

 Live Demo

qt(0.01,50)

Output

[1] -2.403272

Example

 Live Demo

abs(qt(0.01,50))

Output

[1] 2.403272

Example

 Live Demo

qt(0.01,51)

Output

[1] -2.401718

Example

 Live Demo

abs(qt(0.01,51))

Output

[1] 2.401718

Example

 Live Demo

qt(0.01,100)

Output

[1] -2.364217

Example

 Live Demo

abs(qt(0.01,100))

Output

[1] 2.364217

Example

 Live Demo

qt(0.01,20)

Output

[1] -2.527977

Example

 Live Demo

abs(qt(0.01,20))

Output

[1] 2.527977

Example

 Live Demo

qt(0.10,36)

Output

[1] -1.305514

Example

 Live Demo

abs(qt(0.10,36))

Output

[1] 1.305514

Two-sided critical value for 90% confidence level with sample size of 36 −

Example

 Live Demo

abs(qt(0.10/2,36))

Output

[1] 1.688298

Example

 Live Demo

abs(qt(0.01/2,101))

Output

[1] 2.625386

Example

 Live Demo

abs(qt(0.05/2,89))

Output

[1] 1.986979

Updated on: 10-Oct-2020

504 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements