python - Is there a way to automatically estimate the best degree of freedoms for a t-distribution using Scipy? -
a lot of functions asking input degree of freedoms fit distribution , return other items. however, function r's fitdistr estimates mean, scale parameter, , df. ultimate goal obtain t-score using best estimated df.
using scipy can use fit function associated t-distribution class estimate degrees of freedom, location , scale (see here , here more details). estimates parameters using maximum likelihood fitdistr function mass in r. e.g.
from scipy import stats import numpy np np.random.seed(2015) x = [ stats.t.rvs(9) in range(250)] stats.t.fit(x) this gives estimates of df = 5.63, location = 0.00 , scale = 0.85 point of caution estimated fit degrees of freedom may not great if estimating scale , location. may hit local optimum when maximising likelihood function, maybe standardise data?
Comments
Post a Comment