Unexplained error using fitdist with Stable distro - help?

17 views (last 30 days)
I am receiving an unusual error that I can't decode when using fitdist with the 'Stable' distribution option. I've tried troubleshooting by using different datasets and different distributions; the Normal works on the same data. I've used fitdist for stable distributions many times, though not with this release and not in the past 6 months. I've never encountered this error / difficulty before.
The error is:
"Unrecognized function or variable 'getIpOptions'.
Error in fmincon (line 832)
options = getIpOptions(options,sizes.nVar,mEq,flags.constr,defaultopt,10,0.01);
Error in prob.StableDistribution>stablefit (line 1318)
[parmhat,~,err,output] = fmincon(@(params)stable_nloglf(x,params),phi0, ...
Error in prob.StableDistribution.fit (line 211)
params = stablefit(x,0.05,opt);
Error in fitdist>localfit (line 245)
pd = feval(fitter,x,'cens',c,'freq',f,varargin{:});
Error in fitdist (line 192)
pd = localfit(dist,fitter,x,cens,freq,args{:});"
Code that works is:
load hospital;
z = hospital.Weights;
pd = fitdist (z,'Normal');
This generates the error:
pd2 = fitdist(z,'Stable');
Is this a bug in r2020a? I have a copy of Nolan's stablefit toolbox and it fits the same data without throwing an error and with the following result:
>> stablefit(z,1,0)
ans =
2.0000 -0.0214 18.6947 154.0000
  1 Comment
Ameer Hamza
Ameer Hamza on 8 Apr 2020
I am using R2020a and not getting any error.
>> pd2 = fitdist(z,'Stable');
Warning: Maximum likelihood estimate of the shape parameter ALPHA has converged
to a boundary point.
Confidence intervals and standard errors can not be computed reliably.
> In prob.StableDistribution>stablelike (line 1186)
In prob/StableDistribution/fit (line 212)
In fitdist>localfit (line 245)
In fitdist (line 192)
>> pd2
pd2 =
StableDistribution
Stable distribution
alpha = 2 [0, 2]
beta = 0.988294 [-1, 1]
gam = 18.7061 [0, Inf]
delta = 154.031 [-Inf, Inf]
The solution is also pretty close to your solution from stablefit, except for the beta parameter.

Sign in to comment.

Accepted Answer

Ameer Hamza
Ameer Hamza on 8 Apr 2020
The error message shows that MATLAB defines a function named stablefit internally for its own use. The definition of stablefit from Nolan's toolbox is also on MATLAB's path. This confuses the MATLAB and MATLAB seems to call the wrong stablefit function. Remove stablefit from Nolan's toolbox from MATLAB's path, and it will probably work fine.
  13 Comments
Chad Bollmann
Chad Bollmann on 9 Apr 2020
Ameer, Walter,
Remove -> Reinstall was the key. All good now; thank you for teaching me about the potential complications with mcr files.
>> pd2 = fitdist(x,'Stable');
Warning: Maximum likelihood estimate of the shape parameter ALPHA has converged to a boundary point.
Confidence intervals and standard errors can not be computed reliably.
> In prob.StableDistribution>stablelike (line 1186)
In prob/StableDistribution/fit (line 212)
In fitdist>localfit (line 245)
In fitdist (line 192)
>> pd2
pd2 =
StableDistribution
Stable distribution
alpha = 2 [0, 2]
beta = 0.9883 [-1, 1]
gam = 18.7061 [0, Inf]
delta = 154.031 [-Inf, Inf]

Sign in to comment.

More Answers (0)

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!