The student t distribution is also available as scipy.stats.t. Calling
stdtrit directly can improve performance compared to the ppf
method of scipy.stats.t (see last example below).
The function is computed using the Boost Math library [1], which
relies on the incomplete beta function.
Array API Standard Support
stdtrit has experimental support for Python Array API Standard compatible
backends in addition to NumPy. Please consider testing these features
by setting an environment variable SCIPY_ARRAY_API=1 and providing
CuPy, PyTorch, JAX, or Dask arrays as array arguments. The following
combinations of backend and device (or other capability) are supported.
stdtrit represents the inverse of the student t distribution CDF which
is available as stdtr. Here, we calculate the CDF for df at
x=1. stdtrit then returns 1 up to floating point errors
given the same value for df and the computed CDF value.
It is possible to calculate the function at several points for several
different degrees of freedom simultaneously by providing arrays for df
and p with shapes compatible for broadcasting. Compute stdtrit at
4 points for 3 degrees of freedom resulting in an array of shape 3x4.
The t distribution is also available as scipy.stats.t. Calling stdtrit
directly can be much faster than calling the ppf method of
scipy.stats.t. To get the same results, one must use the following
parametrization: scipy.stats.t(df).ppf(x)=stdtrit(df,x).
>>> fromscipy.statsimportt>>> df,x=3,0.5>>> stdtrit_result=stdtrit(df,x)# this can be faster than below>>> stats_result=t(df).ppf(x)>>> stats_result==stdtrit_result# test that results are equalTrue