I have Statistics and Machine Learning Toolbox but cannot use allfitdist

7 次查看(过去 30 天)
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

采纳的回答

Marc
Marc 2016-6-10
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

更多回答(1 个)

Ginés Aníbal
Ginés Aníbal 2022-8-16
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 个评论
Ginés Aníbal
Ginés Aníbal 2022-8-16
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

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by