Categories &

Functions List

Function Reference: tinv

statistics: x = tinv (p, df)

Inverse of the Student’s T cumulative distribution function (iCDF).

For each element of p, compute the quantile (the inverse of the CDF) of the Student’s T distribution with df degrees of freedom. The size of x is the common size of x and df. A scalar input functions as a constant matrix of the same size as the other input.

This function is analogous to looking in a table for the t-value of a single-tailed distribution. For very large df (>10000), the inverse of the standard normal distribution is used.

Further information about the Student’s T distribution can be found at https://en.wikipedia.org/wiki/Student%27s_t-distribution

Input arguments must be double or single; integer, logical, and character arrays are rejected. MATLAB accepts a character array and evaluates it at the character codes, which Octave deliberately does not, since a character array is an integer type and integers are refused too.

Far in the tails the quantile stays accurate to the last few digits. MATLAB’s does not with one degree of freedom, where it evaluates tan (pi (p - 0.5)) and p - 0.5 loses the digits that matter: at p = 10^{-10} it is off by 5 10^{-7}, relative.

See also: tcdf, tpdf, trnd, tstat

Source Code: tinv

Plot various iCDFs from the Student's T distribution

 p = 0.001:0.001:0.999;
 x1 = tinv (p, 1);
 x2 = tinv (p, 2);
 x3 = tinv (p, 5);
 x4 = tinv (p, Inf);
 plot (p, x1, '-b', p, x2, '-g', p, x3, '-r', p, x4, '-m')
 grid on
 xlim ([0, 1])
 ylim ([-5, 5])
 legend ({'df = 1', 'df = 2', ...
          'df = 5', 'df = \infty'}, 'location', 'northwest')
 title ('Student''s T iCDF')
 xlabel ('probability')
 ylabel ('values in x')
plotted figure