Main Content

tinv

Student'stinverse cumulative distribution function

Description

example

x= tinv(p,nu)returns the inverse cumulative distribution function (icdf) of the Student'stdistribution evaluated at the probability values inpusing the corresponding degrees of freedom innu.

Examples

collapse all

Find the 95th percentile of the Student'stdistribution with50degrees of freedom.

p = .95; nu = 50; x = tinv(p,nu)
x = 1.6759

Compute the 99th percentile of the Student'stdistribution for1to6degrees of freedom.

percentile = tinv(0.99,1:6)
percentile =1×631.8205 6.9646 4.5407 3.7469 3.3649 3.1427

Find a 95% confidence interval estimating the mean of a population by usingtinv.

Generate a random sample of size100drawn from a normal population with mean10and standard deviation2.

mu = 10; sigma = 2; n = 100; rngdefault% For reproducibilityx = normrnd(mu,sigma,n,1);

Compute the sample mean, standard error, and degrees of freedom.

xbar = mean(x); se = std(x)/sqrt(n); nu = n - 1;

Find the upper and lower confidence bounds for the95%confidence interval.

conf = 0.95; alpha = 1 - conf; pLo = alpha/2; pUp = 1 - alpha/2;

Compute the critical values for the confidence bounds.

crit = tinv([pLo pUp], nu);

Determine the confidence interval for the population mean.

ci = xbar + crit*se
ci =1×29.7849 10.7075

This confidence interval is the same as thecivalue returned by attest of a null hypothesis that the sample comes from a normal population with meanmu.

[h,p,ci2] = ttest(x,mu,'Alpha',alpha); ci2
ci2 =2×19.7849 10.7075

Input Arguments

collapse all

Probability values at which to evaluate the icdf, specified as a scalar value or an array of scalar values, where each element is in the range[0,1].

  • To evaluate the icdf at multiple values, specifypusing an array.

  • To evaluate the icdfs of multiple distributions, specifynuusing an array.

If either or both of the input argumentspandnuare arrays, then the array sizes must be the same. In this case,tinvexpands each scalar input into a constant array of the same size as the array inputs.Each element inxis the icdf value of the distribution specified by the corresponding element innu, evaluated at the corresponding probability inp.

Example:[0.1 0.5 0.9]

Data Types:single|double

Degrees of freedom for the Student'stdistribution, specified as a positive scalar value or an array of positive scalar values.

  • To evaluate the icdf at multiple values, specifypusing an array.

  • To evaluate the icdfs of multiple distributions, specifynuusing an array.

If either or both of the input argumentspandnuare arrays, then the array sizes must be the same. In this case,tinvexpands each scalar input into a constant array of the same size as the array inputs.Each element inxis the icdf value of the distribution specified by the corresponding element innu, evaluated at the corresponding probability inp.

Example:[9 19 49 99]

Data Types:single|double

Output Arguments

collapse all

icdf values evaluated at the probabilities inp, returned as a scalar value or an array of scalar values.xis the same size aspandnuafter any necessary scalar expansion.Each element inxis the icdf value of the distribution specified by the corresponding element innu, evaluated at the corresponding probability inp.

More About

collapse all

Student’sticdf

The Student'stdistribution is a one-parameter family of curves. The parameterν的自由度。The Student'stdistribution has zero mean.

Thetinverse function is defined in terms of the Student'stcdf as

x = F 1 ( p | ν ) = { x : F ( x | ν ) = p } ,

where

p = F ( x | ν ) = x Γ ( ν + 1 2 ) Γ ( ν 2 ) 1 ν π 1 ( 1 + t 2 ν ) ν + 1 2 d t ,

νis the degrees of freedom, and Γ( · ) is the Gamma function. The resultxis the solution of the integral equation where you supply the probabilityp.

更多的information, seeStudent's t Distribution.

Alternative Functionality

  • tinvis a function specific to the Student'stdistribution. Statistics and Machine Learning Toolbox™ also offers the generic functionicdf, which supports various probability distributions. To useicdf, specify the probability distribution name and its parameters. Note that the distribution-specific functiontinvis faster than the generic functionicdf.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced before R2006a