Documentation

tstat

Student's t mean and variance

Syntax

[m,v] = tstat(nu)

Description

[m,v] = tstat(nu) returns the mean of and variance for Student's t distribution using the degrees of freedom in nu. nu can a vectors, matrix, or multidimensional array. The returned values for m and v are the same size as nu.

Examples

collapse all

Compute the mean and variance for Student's t distributions with degrees of freedom nu equal to 1 through 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 variance does not exist for one and two degrees of freedom.

collapse all

Student’s t Mean and Variance

The mean of the Student’s t distribution is

$\text{mean}=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

$\mathrm{var}=\frac{\nu }{\nu -2}$

for degrees of freedom ν greater than 2. If ν is less than or equal to 2, then the variance is undefined.