kinde67 发表于 2014-8-25 11:12

matlab 中极大似然法mle错误求助

clc;clear;
A=csvread('c:\wk.txt');
m=6;
n=floor(length(A)/m);
for i=1:n;
    y(i)=max(A([(i-1)*m+1:(i*m)]));
end
%hist(y,15);
x=y;
mypdf=@(x,a,b,u)(exp(-(1+b.*(x-u)/a).^(-1/b))./b.*(-(1+b.*(x-u)/a).^(-1/b-1)));
mycdf=@(x,a,b,u)(exp(-(1+b.*(x-u)/a).^(-1/b)));
=mle(x,'pdf',mypdf,'cdf',mycdf,'start',[.1,.5,.1])


Error using mlecustom>llf_pdfcdf (line 440)
The PDF function returned negative or zero values.

Error in fminsearch (line 191)
fv(:,1) = funfcn(x,varargin{:});

Error in mlecustom (line 183)
         = ...

Error in mle (line 229)
             = mlecustom(data,varargin{:});

Error in Untitled2 (line 12)
=mle(x,'pdf',mypdf,'cdf',mycdf,'start',[.1,.5,.1])

madio 发表于 2014-8-25 11:12

这个和你的概率密度函数的定义有关,错误提示说这个函数返回了负值或者零值,这是不允许的,你好好推敲一下它的定义
Error using mlecustom>llf_pdfcdf (line 440)
The PDF function returned negative or zero values.

kinde67 发表于 2014-8-25 11:17

表情那里是    冒号和(
页: [1]
查看完整版本: matlab 中极大似然法mle错误求助