for a given dataset i need to calculate parameters value using mle where cdf = a*(1-exp(-b*A)) and pdf = a*b*exp(-b*A),if i use following code
A=[6 10 17 20 29 34 38 41 50 55 ];
[phat,pci] = mle(A,'pdf',@(A,x,y) x*y*exp(-y*A),'start',[1,1])
i get
Error using mlecustom>llf_pdfcdf
(line 440)
The PDF function returned negative
or zero values.
Error in fminsearch (line 330)
x(:) = xe; fxe =
funfcn(x,varargin{:});
Error in mlecustom (line 184)
fminsearch(llf,start,opts,uncensData,censData,uncensFreq,censFreq,fun1Args,fun2Args,checkFunVals,lb,ub);
Error in mle (line 247)
[phat, pci] =
mlecustom(data,varargin{:});
I am not able to understand what is wrong and how to rectify it as i am new to matlab.Please help how sholud i evaluate parameters a and b using mle function in matlab.

 Réponse acceptée

w w
w w le 23 Juin 2021

0 votes

try 'lowerbound'

Plus de réponses (1)

Jeff Miller
Jeff Miller le 13 Jan 2021

0 votes

One problem is that mle's search function (fminsearch) may try negative parameter values, in which case your pdf function returns a negative value. You could avoid that problem by squaring the parameter values, like this:
[phat,pci] = mle(A,'pdf',@(A,x,y) x^2*y^2*exp(-y^2*A),'start',[1,1])
If you do that, just keep in mind that the "real" x and y values you want are the squares of the phat values returned by mle.
Another problem, though, is that these are not legitimate pdf and cdf functions except when a=1. So, I think you really only have one parameter to estimate here--namely, your y parameter. It looks to me, anyway, like you are fitting an exponential distribution to these A values and looking for the best-fitting rate parameter. That value is 0.03333 = 1/mean(A)

4 commentaires

shalini sharma
shalini sharma le 17 Jan 2021
thanks but squaring the values give
Warning: Maximum likelihood
estimation did not converge.
Iteration limit exceeded.
> In mlecustom (line 241)
In mle (line 247)
Warning: Matrix is close to singular
or badly scaled. Results may be
inaccurate. RCOND = 3.426193e-22.
> In mlecov (line 291)
In mlecustom (line 260)
In mle (line 247)
phat =
1.0e+20 *
3.8864 -0.0000
pci =
1.0e+20 *
2.1832 -0.0000
5.5897 -0.0000
shalini sharma
shalini sharma le 17 Jan 2021
using fsolve i am able to find out the values of parameters a and b (for cdf = a*(1-exp(-b*A)) and pdf = a*b*exp(-b*A)) but i want to evaluate parameters of a cdf and pdf having 5 unknowns which is estimating incorrect values using fsolve (not matching the given results) and therefore i want to compare the results of mle and fsolve to estimate the correct output. So i tried using simpler pdf having known parameters to check which method will be best suited for my model,but i am not able to find correct values of a and b for the given pdf using mle(above mentioned problem). Moreover i dont understand why fsolve,mle and coding (newton ralphson) all gives different values. Since i dont have deep understanding of matlab so i am very confuse which method is best fsolve or mle for estimating parameters (5 to 10) .
thanks...
Elifnur Öztürk
Elifnur Öztürk le 22 Mai 2021
Did you find the answer to your question? @shalini sharma
shalini sharma
shalini sharma le 26 Mai 2021
I tried using the square of parameters in equation to be evaluated...and also with used different PDF and cdf but every time I got error....anyway thanks ....will try again

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by