米ain Content

tcdf

Student'stcumulative distribution function

Description

example

p= tcdf(x,nu)returns the cumulative distribution function (cdf) of the Student'stdistribution withnudegrees of freedom, evaluated at the values inx.

example

p= tcdf(x,nu,'upper')returns the complement of the cdf, evaluated at the values inxwithnudegrees of freedom, using an algorithm that more accurately computes the extreme upper-tail probabilities than subtracting the lower tail value from 1.

Examples

collapse all

Generate a random sample of size100from a normally distributed population with mean1and standard deviation2.

rngdefault% For reproducibilitymu = 1; n = 100; sigma = 2; x = normrnd(mu,sigma,n,1);

Compute the sample mean, sample standard deviation, andt-score of the sample.

xbar = mean(x); s = std(x); t = (xbar-mu)/(s/sqrt(n))
t = 1.0589

Usetcdfto compute the probability of a sample of size100having a largert-score than thet-score of the sample.

p = 1-tcdf(t,n-1)
p = 0.1461

This probability is the same as thepvalue returned by attest with null hypothesis that the sample comes from a normal population with mean1and alternative hypothesis that the mean is greater than1.

[h,ptest] = ttest(x,mu,0.05,'right'); ptest
ptest = 0.1461

Determine the probability that an observation from the Student'stdistribution with degrees of freedom99falls on the interval[10 Inf].

p1 = 1 - tcdf(10,99)
p1 = 0

tcdf(10,99)is nearly1, sop1becomes0. Specify'upper'so thattcdfcomputes the extreme upper-tail probabilities more accurately.

p2 = tcdf(10,99,'upper')
p2 = 5.4699e-17

You can also use'upper'to compute a right-tailedp-value.

Input Arguments

collapse all

Values at which to evaluate the cdf, specified as a scalar value or an array of scalar values.

  • To evaluate the cdf at multiple values, specifyxusing an array.

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

If either or both of the input argumentsxandnuare arrays, then the array sizes must be the same. In this case,tcdfexpands each scalar input into a constant array of the same size as the array inputs.Each element inpis the cdf value of the distribution specified by the corresponding element innu, evaluated at the corresponding element inx.

Example:[-1,0,3,4]

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 cdf at multiple values, specifyxusing an array.

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

If either or both of the input argumentsxandnuare arrays, then the array sizes must be the same. In this case,tcdfexpands each scalar input into a constant array of the same size as the array inputs.Each element inpis the cdf value of the distribution specified by the corresponding element innu, evaluated at the corresponding element inx.

Example:[9,19,49,99]

Data Types:single|double

Output Arguments

collapse all

cdf values evaluated at the values inx, returned as a scalar value or an array of scalar values.pis the same size asxandnuafter any necessary scalar expansion.Each element inpis the cdf value of the distribution specified by the corresponding element innu, evaluated at the corresponding element inx.

米ore About

collapse all

Student’stcdf

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

The cdf of the Student’stdistribution is

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

whereνis the degrees of freedom and Γ( · ) is the Gamma function. The resultpis the probability that a single observation from thetdistribution withνdegrees of freedom falls in the interval[–∞,x].

For more information, seeStudent's t Distribution.

Alternative Functionality

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

  • Use theProbability Distribution Functionapp to create an interactive plot of the cumulative distribution function (cdf) or probability density function (pdf) for a probability distribution.

Extended Capabilities

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

Version History

Introduced before R2006a