How do I access the nu's from a fitted probability distribution?

1 view (last 30 days)
So I created a vector of random numbers from a t-distribution with nu/degrees of freedom = 30, and I want to fit the distribution and basically find the estimated nu's for different sample sizes. However, when I use the fitdist function, I am not sure how to access the the nu that it fits. For example, with the following code:
random_dist = trnd(30, n, 1);
t_dist = fitdist(random_dist, 'tLocationScale')
I get an ouput like:
t_dist =
tLocationScaleDistribution
t Location-Scale distribution
mu = -0.000195642 [-0.00659519, 0.00620391]
sigma = 1.00619 [0.999327, 1.01311]
nu = 36.7948 [30.3379, 44.626]
and I don't know how to access that nu = 36.7948.
Thanks.

Answers (2)

Star Strider
Star Strider on 22 Sep 2015
The output of fitdist is a structure, so you can get any of the results it calculates by addressing them as structure elements:
nu_calc = t_dist.nu

Walter Roberson
Walter Roberson on 22 Sep 2015
Edited: Walter Roberson on 22 Sep 2015
t_dist.nu
or you might need
get(t_dist,nu)
if your MATLAB is sufficiently old.
Note: this is not a structure, it is an object.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!