I have Statistics and Machine Learning Toolbox but cannot use allfitdist

8 views (last 30 days)
I tried running a script I found on http://blogs.mathworks.com/pick/2012/02/10/finding-the-best/ to learn how to find the best distribution fit. When I run the script
% Create a normally distributed (mu: 5, sigma: 3) random data set
x = normrnd(5, 3, 1e4, 1);
% Compute and plot results. The results are sorted by "Bayesian information % criterion".
[D, PD] = allfitdist(x, 'PDF');
I get this error message:
Undefined function or variable 'allfitdist'.
Error in Find_best_distribution (line 7) [D, PD] = allfitdist(x, 'PDF')
I tried using the ver command to confirm that I have the Statistics toolbox and got this:
MATLAB Version 9.0 (R2016a) Statistics and Machine Learning Toolbox Version 10.2 (R2016a)
I also tried the disttool command and that worked.
Why can I not run allfitdist?
Thanks, Josefin

Accepted Answer

Marc
Marc on 10 Jun 2016
Did you download allfitdist.m from the file exchange? This is not a Mathworks function. If you go back to the blog, there is a link that will take you to the file exchange for allfitdist. Download the file and make sure that you put it in a folder on your path

More Answers (1)

Ginés Aníbal
Ginés Aníbal on 16 Aug 2022
Thank you very much Marc!!!!
The zip that indicated for the download, did not contain that added function.
I'm trying to get conditional probabilities between 2 (for now), and 3 hydrological variables.
I will be aware that the authors have news with the extension for more than 2 variables...
best regards, Ginés.
  2 Comments
Ginés Aníbal
Ginés Aníbal on 16 Aug 2022
Hello Walter: I did not finish the explanation well: the link indicated 'allfitdist' below, but not in the zip. I downloaded it separately, and as far as I've tried, it works.
But I'll follow your advice, in case this adds any bias correction.
thanks, and best regards

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!