I have Statistics and Machine Learning Toolbox but cannot use allfitdist

조회 수: 3 (최근 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

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Text Data Preparation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by