Main Content

tpdf

Student's t probability density function

Description

y = tpdf(x,nu) returns the probability density function (pdf) of the Student's t distribution with nu degrees of freedom, evaluated at the values in x.

example

Examples

collapse all

The value of the pdf at the mode is an increasing function of the degrees of freedom.

The mode of the Student's t distribution is at x = 0. Compute the pdf at the mode for degrees of freedom 1 to 6.

tpdf(0,1:6)
ans = 1×6

    0.3183    0.3536    0.3676    0.3750    0.3796    0.3827

The t distribution converges to the standard normal distribution as the degrees of freedom approach infinity.

Compute the difference between the pdfs of the standard normal distribution and the Student's t distribution pdf with 30 degrees of freedom.

difference = tpdf(-2.5:2.5,30)-normpdf(-2.5:2.5)
difference = 1×6

    0.0035   -0.0006   -0.0042   -0.0042   -0.0006    0.0035

Input Arguments

collapse all

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

  • To evaluate the pdf at multiple values, specify x using an array.

  • To evaluate the pdfs of multiple distributions, specify nu using an array.

If either or both of the input arguments x and nu are arrays, then the array sizes must be the same. In this case, tpdf expands each scalar input into a constant array of the same size as the array inputs. Each element in y is the pdf value of the distribution specified by the corresponding element in nu, evaluated at the corresponding element in x.

Example: [-1 0 3 4]

Data Types: single | double

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

  • To evaluate the pdf at multiple values, specify x using an array.

  • To evaluate the pdfs of multiple distributions, specify nu using an array.

If either or both of the input arguments x and nu are arrays, then the array sizes must be the same. In this case, tpdf expands each scalar input into a constant array of the same size as the array inputs. Each element in y is the pdf value of the distribution specified by the corresponding element in nu, evaluated at the corresponding element in x.

Example: [9 19 49 99]

Data Types: single | double

Output Arguments

collapse all

pdf values evaluated at the values in x, returned as a scalar value or an array of scalar values. p is the same size as x and nu after any necessary scalar expansion. Each element in y is the pdf value of the distribution specified by the corresponding element in nu, evaluated at the corresponding element in x.

More About

collapse all

Student’s t pdf

The Student's t distribution is a one-parameter family of curves. The parameterν is the degrees of freedom. The Student's t distribution has zero mean.

The pdf of the Student's t distribution is

y=f(x|ν)=Γ(ν+12)Γ(ν2)1νπ1(1+x2ν)ν+12,

where ν is the degrees of freedom and Γ( · ) is the Gamma function. The result y is the probability of observing a particular value of x from the Student’s t distribution with ν degrees of freedom.

For more information, see Student's t Distribution.

Alternative Functionality

  • tpdf is a function specific to the Student's t distribution. Statistics and Machine Learning Toolbox™ also offers the generic function pdf, which supports various probability distributions. To use pdf, specify the probability distribution name and its parameters. Note that the distribution-specific function tpdf is faster than the generic function pdf.

  • Use the Probability Distribution Function app 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