Main Content

tstat

Student's t mean and variance

Description

example

[m,v] = tstat(nu) returns the mean and variance of the Student's t distribution with nu degrees of freedom.

Examples

collapse all

Compute the mean and variance for Student's t distribution with degrees of freedom nu equal to 1 to 30.

nu = reshape(1:30,6,5);
[m,v] = tstat(nu)
m = 6×5

   NaN     0     0     0     0
     0     0     0     0     0
     0     0     0     0     0
     0     0     0     0     0
     0     0     0     0     0
     0     0     0     0     0

v = 6×5

       NaN    1.4000    1.1818    1.1176    1.0870
       NaN    1.3333    1.1667    1.1111    1.0833
    3.0000    1.2857    1.1538    1.1053    1.0800
    2.0000    1.2500    1.1429    1.1000    1.0769
    1.6667    1.2222    1.1333    1.0952    1.0741
    1.5000    1.2000    1.1250    1.0909    1.0714

Note that the mean is undefined for 1 degree of freedom, and variance is undefined for 1 and 2 degrees of freedom.

Input Arguments

collapse all

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

Example: [9,19,49,99]

Data Types: single | double

Output Arguments

collapse all

Mean of the Student's t distribution with the degrees of freedom specified in nu, returned as a scalar value or an array of scalar values. m is the same size as nu.

Variance of the Student's t distribution with the degrees of freedom specified in nu, returned as a scalar value or an array of scalar values. v is the same size as nu.

More About

collapse all

Mean and Variance of Student’s t Distribution

The parameters of the Student's t distribution depend on the degrees of freedom.

The mean of the Student’s t distribution is μ = 0 for degrees of freedom ν greater than 1. If ν equals 1, then the mean is undefined.

The variance of the Student’s t distribution is νν2 for degrees of freedom ν greater than 2. If ν is less than or equal to 2, then the variance is undefined.

For more information, see Student's t Distribution.

Extended Capabilities

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

Introduced before R2006a