File name : 'CritT.m'. This file can be used
for quickly obtaining the critical t-value for
alfa values of 0.01, 0.05, 0.10 and degrees of freedom
between 1 and 100
One input values : 'alfa','v','tail'
One output value : 't'
alfa: significance level (0.01,0.05,0.10)
v: degrees of freedom (integer from 1 till 100)
tail: one-tailed = 'one' two-tailed = 'two'
t: critical t-value
Input syntax : CritT(alfa,v,tail)
NOTE: Only the above-mentioned values for alfa and v
can be used as input arguments
Table with alfa values and corresponding t-values
were obtained by using the icdf functions
Developed by Joris Meurs BASc (2015)
Nice function! It includes tables of critical t-values and a lookup. I have refactored the code a bit, and will upload a derivative version.
Sorry, I mistyped in my other comment. You can use the formulas in that other comment if you replaced alpha with the confidence level (e.g., 0.95). If you want to use the alpha level (e.g., 0.05), you should use the following:
alpha = 0.05; n = 50;
tcrit2 = tinv(1-alpha/2,n-1);
tcrit1 = tinv(1-alpha,n-1);
tcrit1 = 1.6766
You can also get the critical t value using the tinv() function.
For two tails:
tcrit = tinv(1-(1-alpha)/2,n-1);
For one tail:
tcrit = tinv(1-(1-alpha),n-1);
Inspired: Critical t-value calculator - 2017