Unexplained error using fitdist with Stable distro - help?

8 次查看(过去 30 天)
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 个评论
Ameer Hamza
Ameer Hamza 2020-4-8
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.

请先登录,再进行评论。

采纳的回答

Ameer Hamza
Ameer Hamza 2020-4-8
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 个评论
Chad Bollmann
Chad Bollmann 2020-4-9
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]

请先登录,再进行评论。

更多回答(0 个)

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by