version (2.93 KB) by Star Strider
TSTAT3 computes: one- or two-sided t-probability, or the one-sided t-statistic (‘tinv’ equivalent).


Updated Mon, 11 Apr 2016 20:44:39 +0000

View License

TSTAT3 computes the one- or two-tailed t-probabilities for ‘v’ degrees-of-freedom, and a t-statistic ‘tp’, with the third argument being 'one' or 'two' respectively. It computes the inverse t-distribution (one-tailed t-statistic) for ‘v’ degrees-of-freedom and probability ‘tp’ with the third argument being 'inv'. It takes only precalculated t-statistics to calculate its probabilities, and does not take raw data as input. It is not vectorised, and throws an error for vectorised arguments, so separate calls must be made for each set of inputs.
It uses the core MATLAB incomplete beta function ‘betainc’ to calculate the t-distribution probabilities, and the core MATLAB ‘fzero’ function to calculate the inverse. It is extensively internally documented. It produces results that are within about 1E-12 of the comparable Statistics Toolbox Functions. It is written with MATLAB version R2015b, but should work with all versions that have the two functions it uses. It does not require the Statistics and Machine Learning Toolbox.
USES: TSTAT3 produces probabilites useful for determining the statistical significance of data characterised by known degrees-of-freedom and calculated t-statistics, and it produces t-statistics for known degrees-of-freedom and the requested probabilities, useful for determining confidence intervals. It requires a basic knowledge of statistics to the extent of understanding how to calculate degrees-of-freedom and t-statistics and how to apply confidence intervals, and to determine that the t-distribution is appropriate for the data being analysed.

HELP: TSTAT3 has help documentation available by right-clicking on its name in the MATLAB Editor, typing ‘help tstat3’ or by reading its code with the ‘type’ command.

Cite As

Star Strider (2022). TSTAT3 (https://www.mathworks.com/matlabcentral/fileexchange/56500-tstat3), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2015b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!