Search Comments and Ratings

go

   
Date File Comment by Comment Rating
20 Feb 2015 Fit all valid parametric probability distributions to data ALLFITDIST Fit all valid parametric probability distributions to data. Author: Mike Sheppard

Mike Sheppard (view profile)

Roudy DAGHER

Hi Mike,

that's a very nice script.
It would be also useful to test against mixtures, for instance when the data can be fit to a mixture of two or more gaussians, with the parameter k increasing...
see fitgmdist Matlab function.

Best,
Roudy

5
20 Jan 2015 Fit all valid parametric probability distributions to data ALLFITDIST Fit all valid parametric probability distributions to data. Author: Mike Sheppard

Mike Sheppard (view profile)

SANHANAT

best MATLAB code so far

5
10 Sep 2014 Repeated Values Finds all repeated values for input X, and their attributes. Author: Mike Sheppard

Mike Sheppard (view profile)

Xindi Li

really helpful, thanks!

5
22 Aug 2014 Fit all valid parametric probability distributions to data ALLFITDIST Fit all valid parametric probability distributions to data. Author: Mike Sheppard

Mike Sheppard (view profile)

Alireza

The allfitdist function for normally distributed data return 'rayleigh' as best fit distribution! So weird as it is an example included in file.

commands: data = normrnd(5,3,1e4,1); [D PD] = allfitdist(data,'PDF'); D(1)

output: ans =

DistName: 'rayleigh'
NLogL: 2.4515e+04 - 1.5959e+03i
BIC: 4.9038e+04 - 3.1919e+03i
AIC: 4.9031e+04 - 3.1919e+03i
AICc: 4.9031e+04 - 3.1919e+03i
ParamNames: {'B'}
ParamDescription: {'scale'}
Params: 4.1166
Paramci: [2x1 double]
ParamCov: 4.2366e-04
Support: [1x1 struct]

Comment only
02 Jul 2014 Fit all valid parametric probability distributions to data ALLFITDIST Fit all valid parametric probability distributions to data. Author: Mike Sheppard

Mike Sheppard (view profile)

Nebitno

5
26 May 2014 Political Apportionment Allocates seats according to METHOD until NUM seats have been allocated Author: Mike Sheppard

Mike Sheppard (view profile)

Jorge

Jorge (view profile)

I don't know if I'm doing this correctly, but I'm unable to reproduce the Wikipedia example for the D'Hondt method (http://en.wikipedia.org/wiki/D%27Hondt_method#Example)

I try the following:
apport([100 80 30 20],8,'DH',0)

and the result is 5 3 0 0, while the example states that it should be 4 3 1 0. Incidentally if I select 'All', four of the methods show this 4 3 1 0 result, but D'Hondt is not among them. Am I doing something wrong or is there something that I'm missing here? =(

Comment only
28 Jan 2014 Fit all valid parametric probability distributions to data ALLFITDIST Fit all valid parametric probability distributions to data. Author: Mike Sheppard

Mike Sheppard (view profile)

sonakis23 sonaki

Hi, I was wondering how could I plot both PDF, CDF and the error graph any ideas?

Comment only
26 Nov 2013 Fit all valid parametric probability distributions to data ALLFITDIST Fit all valid parametric probability distributions to data. Author: Mike Sheppard

Mike Sheppard (view profile)

debora

debora (view profile)

@Hernando

I've the same problem. You need to change all ~ (line 245 and others) by another letter.

5
25 Nov 2013 Fit all valid parametric probability distributions to data ALLFITDIST Fit all valid parametric probability distributions to data. Author: Mike Sheppard

Mike Sheppard (view profile)

Hernando

Well i`m using r2009a. and using the file i've got this error:
??? Error: File: allfitdist.m Line: 245 Column: 11
Expression or statement is incorrect--possibly unbalanced (, {, or [.

[D PD] = allfitdist(data,'CCDF');
??? Error: File: allfitdist.m Line: 245 Column: 11
Expression or statement is incorrect--possibly unbalanced (, {, or [.
data = normrnd(5,3,1e4,1);
>> [D PD] = allfitdist(data,'CCDF');
??? Undefined function or method 'allfitdist' for input arguments of type 'double'.
Is there any restriction for the file?

Comment only
24 Sep 2013 polymorph Morphs two polygons Author: Mike Sheppard

Mike Sheppard (view profile)

Daniel Golden

Works perfectly. Excellent work!

5
16 Sep 2013 Fit all valid parametric probability distributions to data ALLFITDIST Fit all valid parametric probability distributions to data. Author: Mike Sheppard

Mike Sheppard (view profile)

Venkatesh

Very useful script

5
04 Sep 2013 Minkowski Sum Minkowski sum of two arrays Author: Mike Sheppard

Mike Sheppard (view profile)

Samuel Cole

Alex,
Columns add dimensions, rows add cardinality. You want:

minksum([1;2],[6;7])

ans =

7
8
9

5
14 Aug 2013 Fit all valid parametric probability distributions to data ALLFITDIST Fit all valid parametric probability distributions to data. Author: Mike Sheppard

Mike Sheppard (view profile)

Shebuti Rayana

I am using Matlab R2008a version I am trying to use this code but its not working Its showing no distributions were found for the example no 1. I checked my matlab version and it contains Statistics toolbox. Now what should I do. Please help.

Comment only
09 Jul 2013 Fit all valid parametric probability distributions to data ALLFITDIST Fit all valid parametric probability distributions to data. Author: Mike Sheppard

Mike Sheppard (view profile)

katmai46

Dear Mr. Sheppard,

I have been used your code to fit several datasets that I have. I found it really useful. My question is (I am very new in Matlab as well as statistics)... how do you define the "best" distribution? Based on p-values of KSTest?
Thanks

5
15 May 2013 Minkowski Sum Minkowski sum of two arrays Author: Mike Sheppard

Mike Sheppard (view profile)

Alex Dytso

Alex Dytso (view profile)

I don't think that your code works.
Try this:

X2=[1 2]
X2 = 1 2
>> X1=[ 6 7]
X1 = 6 7
>> minksum(X1,X2)
ans =7 9

the answer should be 7 8 9

Comment only
29 Apr 2013 Generalized Bar Charts Stacked, Grouped, Clustered, Floating; and MIXED of any combination Author: Mike Sheppard

Mike Sheppard (view profile)

Mariana

Great code! Can we change color on the bars?

4
07 Feb 2013 Excel Column Conversion Converts between column name and number for Excel representation Author: Mike Sheppard

Mike Sheppard (view profile)

Benjamin

5
28 Jan 2013 Repeated Values Finds all repeated values for input X, and their attributes. Author: Mike Sheppard

Mike Sheppard (view profile)

Timothy Russell

5
22 Aug 2012 Fit all valid parametric probability distributions to data ALLFITDIST Fit all valid parametric probability distributions to data. Author: Mike Sheppard

Mike Sheppard (view profile)

Manuel Kuhs

Really appreciate your function, was doing this manually for a while!

I apologise in advance if this is an ignorant question, as I'm a very basic MatLab user.

Would it be possible to amend your script to take into account for situations in which you know some data is missing? The particular type I'm interested in is when I know that my data actually only represents e.g. the first 70% on the CDF.

I hope this question makes sense. I'm not even sure of the right terminology to use!

5
03 May 2012 Fit all valid parametric probability distributions to data ALLFITDIST Fit all valid parametric probability distributions to data. Author: Mike Sheppard

Mike Sheppard (view profile)

Nitin

Nitin (view profile)

5
05 Apr 2012 Generalized Bar Charts Stacked, Grouped, Clustered, Floating; and MIXED of any combination Author: Mike Sheppard

Mike Sheppard (view profile)

Michael Crimmins

Really great to see a script that supports floating bar charts! I can't seem to change the face or edge color of the bars, though. Is this supported?

Comment only
05 Apr 2012 Generalized Bar Charts Stacked, Grouped, Clustered, Floating; and MIXED of any combination Author: Mike Sheppard

Mike Sheppard (view profile)

Michael Crimmins

4
01 Apr 2012 Nested logical indexing nested(IN) returns the final result of a list of nested logical indices. Author: Mike Sheppard

Mike Sheppard (view profile)

Oleg Komarov

Oleg Komarov (view profile)

Has H1 line, description, some author and log info and Examples (here, I would explicitly add the output to visualize the result).

Misses checks. For instance, if for some reason you have ind2 = {1 0}; it throws an incomprehensible error (due to the logical conversion).

The error within the "try ... catch" is uninformative. I think it would even be faster to check that the sum of the 'n-th' logical index is within the 'n-1 th' sum and throw an error otherwise specifying exactly which index is the faulty one.

Other minor things:
- notlog = find(~cellfun('islogical', varargin)); % faster
- numel(varargin) is equivalent to nargin

A consideration on the approach: from time to time I find myself stuck with the problem of having performed logical comparisons on nested sets when what I really need is a comparison against the original set.
In this situation 'nested' could be very useful, however I found that rewriting the code in order to generate logical indices that 'fit' the original set pays off in the long run (especially if debugging). While it may take additional time to rewrite the code, the comparison of the logical indexes is immediate and easy to understand.

Comment only
25 Mar 2012 Fit all valid parametric probability distributions to data ALLFITDIST Fit all valid parametric probability distributions to data. Author: Mike Sheppard

Mike Sheppard (view profile)

Olga Petrik

5
15 Mar 2012 Fit all valid parametric probability distributions to data ALLFITDIST Fit all valid parametric probability distributions to data. Author: Mike Sheppard

Mike Sheppard (view profile)

Roni Peer

Great Job.
I've changed it a bit to suit my needs, and going to add a GUI to allow the user to fit just a specific distribution, or select some of them. ALL of them would be a default.
Thanks!

5
13 Mar 2012 Fit all valid parametric probability distributions to data ALLFITDIST Fit all valid parametric probability distributions to data. Author: Mike Sheppard

Mike Sheppard (view profile)

Mike Sheppard

Mike Sheppard (view profile)

Hi Roni,

The "Best Fit" can be found by the output by either D(1) or PD{1}, depending on if you want a structure or ProbDist class object. You can use the class object directly in other statistical functions, such as:

p=cdf(PD{1},xvalue)

The reason for including all valid distributions is that depending on preferences of model selection or assumptions from the data the distribution that you may prefer to use may be the 2nd or even 3rd "best" from the output, or not given at all. This is especially true if the SORTBY values are close in value, or if a parameter in a given distribution is close to a simpler special case.

Example 3 is an example of the latter; should you use as a model the Negative Binomial Distribution with r=.98 or assume it is actually the more simpler Geometric Distribution with r=1 which is not given as an output?

The error graph is displayed when 'CDF' is given as an input. You can change the number of distributions to include in the plot by adjusting the max_num_dist variable in the plotfigs subfunction.

Hope that helps,

-MIke

Comment only
13 Mar 2012 Fit all valid parametric probability distributions to data ALLFITDIST Fit all valid parametric probability distributions to data. Author: Mike Sheppard

Mike Sheppard (view profile)

Roni Peer

Hi Mike,

Why not add a "Best Fit" output also?
For example, if the best distribution which represents this data is "Weibull", return it as another output.
This can be used to find "Best Fit" for this data, which can be really useful.
I would also add a summary graph, which shows the error on all types of distributions, and what was the best one.

Roni.

Comment only
07 Mar 2012 Fit all valid parametric probability distributions to data ALLFITDIST Fit all valid parametric probability distributions to data. Author: Mike Sheppard

Mike Sheppard (view profile)

Eric Diaz

Very useful indeed!

5
28 Feb 2012 Fit all valid parametric probability distributions to data ALLFITDIST Fit all valid parametric probability distributions to data. Author: Mike Sheppard

Mike Sheppard (view profile)

Francesco Cosentino

Hi Guys,

the problem at lines 247 etc is resolved by replacing the tilde operator with any name for a variable that will remain unused, but for the problem that also Olivier noted, this is due to the fact that function fitdist is missing in matlab 7.7

Regards
Francesco

Comment only
28 Feb 2012 Fit all valid parametric probability distributions to data ALLFITDIST Fit all valid parametric probability distributions to data. Author: Mike Sheppard

Mike Sheppard (view profile)

Francesco Cosentino

Hi people,

This script is not working on matlab 7.7.

Matlab recognises an error in the code at line 247. It says:

Parse error at ',': usage might be invalid matlab syntax
Parse error at ']': usage might be invalid matlab syntax

And the error is repeated for lines 249 249 251 253.

Is there any way of getting it working on 7.7???

Regards
Francesco

Comment only
15 Feb 2012 Fit all valid parametric probability distributions to data ALLFITDIST Fit all valid parametric probability distributions to data. Author: Mike Sheppard

Mike Sheppard (view profile)

Mike Sheppard

Mike Sheppard (view profile)

Warwick, thanks for your note. I am updating the file a bit, and the functionality of custom distributions seems interesting.

If you like, you can e-mail me directly with your improved functionality and I can include it in the next update with acknowledgment.

Comment only
14 Feb 2012 Fit all valid parametric probability distributions to data ALLFITDIST Fit all valid parametric probability distributions to data. Author: Mike Sheppard

Mike Sheppard (view profile)

Warwick

Mike, I am sorry and aghast about the rating. I actually meant to leave the rating blank. On further experiment, there seems to be no way to go back to a null rating once my cursor merely touches the rating banner of stars (using iMac and the beta R2012a) . Anyway, I was able to use the file to obtain sorted best-fit curves on the type of problems I have and even added custom dist.

5
14 Feb 2012 Fit all valid parametric probability distributions to data ALLFITDIST Fit all valid parametric probability distributions to data. Author: Mike Sheppard

Mike Sheppard (view profile)

Mike Sheppard

Mike Sheppard (view profile)

Warwick, for a "potentially a very useful script" I'm sorry you felt it was only worth a rating of one. Do you have suggestions on how it can be improved? Constructive criticism or ways to improve the program/functionality are always welcome, but I did not see any in your comment, other than asking for specific help after giving it a poor rating.

Please re-read the help section; specifically Example 2.

Comment only
14 Feb 2012 Fit all valid parametric probability distributions to data ALLFITDIST Fit all valid parametric probability distributions to data. Author: Mike Sheppard

Mike Sheppard (view profile)

Warwick

Mike, this is potentially a very useful script for me. How can I use it for this example problem? I have frequency data describing number of events against day number. Logically the day number must be an integer from 1.
Eg, for discrete days 1:10 and the Yobs are [1099 478 263 159 99 64 41 28 18 12]. Exponential and Weibull are fair candidate distrubution and I have previously fitted these as curves using LS or weighted LS, but an MLE approach ( ie, use neg log likelihood) would be much better as there can be a lot of noise in the tails. Thanks, Warwick

1
13 Feb 2012 Fit all valid parametric probability distributions to data ALLFITDIST Fit all valid parametric probability distributions to data. Author: Mike Sheppard

Mike Sheppard (view profile)

Jiro Doke

Jiro Doke (view profile)

Olivier,

Do you have Statistics Toolbox? It's required to use this function.

Comment only
12 Feb 2012 Fit all valid parametric probability distributions to data ALLFITDIST Fit all valid parametric probability distributions to data. Author: Mike Sheppard

Mike Sheppard (view profile)

Tony Dalton

4
10 Feb 2012 Fit all valid parametric probability distributions to data ALLFITDIST Fit all valid parametric probability distributions to data. Author: Mike Sheppard

Mike Sheppard (view profile)

Matthew

Great idea, good examples, functional code (style could be better).

5
10 Feb 2012 Fit all valid parametric probability distributions to data ALLFITDIST Fit all valid parametric probability distributions to data. Author: Mike Sheppard

Mike Sheppard (view profile)

Olivier Planchon

Does not work on Matlab 7.7
(Or I misunderstood how to use it)

>> [D, PD] = allfitdist(randn(1000,1)) ;
??? Error using ==> allfitdist at 238
No distributions were found

Comment only
07 Feb 2012 Fit all valid parametric probability distributions to data ALLFITDIST Fit all valid parametric probability distributions to data. Author: Mike Sheppard

Mike Sheppard (view profile)

Jonathan Sullivan

5
03 Feb 2012 Political Apportionment Allocates seats according to METHOD until NUM seats have been allocated Author: Mike Sheppard

Mike Sheppard (view profile)

Jonathan Sullivan

Very interesting function. Well written.

5
08 Dec 2011 All Sums Distribution of unique sums among all combinations of vectors. Author: Mike Sheppard

Mike Sheppard (view profile)

Mike Sheppard

Mike Sheppard (view profile)

For unequal probabilities see "Sum of probability distributions" #34082

Comment only
08 Dec 2011 Sum of probability distributions SUMPDF Probability distribution of the sum of distributions Author: Mike Sheppard

Mike Sheppard (view profile)

Mike Sheppard

Mike Sheppard (view profile)

Good idea. Expanded the code the uploaded a new file to handle more general cases. See "Apply a function to a set of probability distributions" #34108

Comment only
06 Dec 2011 Sum of probability distributions SUMPDF Probability distribution of the sum of distributions Author: Mike Sheppard

Mike Sheppard (view profile)

Jonathan Sullivan

Very nice. Exactly what I needed! Now, if only this could be expanded to additional operators (i.e. times, max, min, mean, etc)

5
01 Dec 2011 System of linear congruences Solution to Simultaneous Linear Congruences Author: Mike Sheppard

Mike Sheppard (view profile)

Su Dongcai

Su Dongcai (view profile)

5
31 Oct 2011 All Sums Distribution of unique sums among all combinations of vectors. Author: Mike Sheppard

Mike Sheppard (view profile)

Jonathan Sullivan

5
13 Sep 2011 Excel Column Conversion Converts between column name and number for Excel representation Author: Mike Sheppard

Mike Sheppard (view profile)

Image Analyst

Image Analyst (view profile)

Thanks. Works great. Just what I needed. I just had one Excel cell reference and the results came back as a MATLAB cell when what I needed was a string (character array), but I just passed the cell returned from ExcelCol into cell2mat() and I got my string like I needed.

5
13 Jul 2011 polymorph Morphs two polygons Author: Mike Sheppard

Mike Sheppard (view profile)

Daniel

Daniel (view profile)

WOW! That is exactly what I have been looking for! The code seems to be robust and worked perfect for my needed cases. Thanks!

5
13 May 2011 Read Wikipedia articles S=wiki(str) returns the Wikipedia article for string 'str' Author: Mike Sheppard

Mike Sheppard (view profile)

Joachim

5
25 Feb 2011 Repeated Values Finds all repeated values for input X, and their attributes. Author: Mike Sheppard

Mike Sheppard (view profile)

Jaime Undurraga

thanks, useful and practical.

5
18 Jan 2011 Read Wikipedia articles S=wiki(str) returns the Wikipedia article for string 'str' Author: Mike Sheppard

Mike Sheppard (view profile)

Shahab

Shahab (view profile)

helpful

4

Contact us