File Exchange

## fitmethis

version 1.3 (3.95 KB) by

FITMETHIS finds best-fitting distribution to data vector

Updated

F= fitmethis(X) finds the distibution that best fits data in vector X among all distributions available in MATLAB's function MLE. Either continuous or discrete distributions are used based on user input or the type of data supplied (see below) The function returns a structure array with fields:
name: name of the distribution (see HELP MLE for a list)
par: vector of parameter estimates (1, 2 or 3 values)

ci: matrix of confidence limits, one column per parameter

LL: Log-Likelihood of the data

aic: Akaike Information Criterion

Optional arguments can be specified as name/value pairs (see help).

Francisco

### Francisco (view profile)

You can decide which is the best-fitting distribution using either the Log-Likelihood or the Akaike Information Criterion (AIC). Both are returned by the function. The distributions and their parameters are printed on the screen already ordered by Log-Likelihood, so the first one would be the best-fitting according to that. Be aware that small differences in Log-Likelihood or AIC may not be significant, so you could use another distribution. How small the difference should be to be significant (in the sense of hypothesis testing) is another matter.

Zakari Seybou

### Zakari Seybou (view profile)

Thanks very much. how can I fin which dist. is the best?

This nice code, How to resolve the which distribution was the best?

moatez hassan

### moatez hassan (view profile)

I am interesting to use lines of code in my work

Isabella Osetinsky-Tzidaki

### Isabella Osetinsky-Tzidaki (view profile)

Hoped to use, however, after just a first trial, encountered some confusions starting from: the MATLAB GEV version is for maxima, the MATLAB EV version is for minima, so to match between them, your must mirror either GEV or EV. You may compare the location parameter you get for GEV as is with the location parameter you get for EV as is. They are a great deal different. A simple solution for this case is mirroring EV by negating the input, i.e. by using "-x" instead of "x" and then mirroring the EV location parameter by negating it. In this way, you will come much closer to the GEV location parameter.

AUROJYOTI PRUSTY

### AUROJYOTI PRUSTY (view profile)

Nice piece of work.I am so thankful to you as this code has solved much of my research work.The problem is, I also wanna find out the mean and SD of that distribution.So how could I do that?

Francisco de Castro

### Francisco de Castro (view profile)

I didn't realize there was already a function to do this (more comprehensive, probably): ALLFITDIS by Mike Sheppard.