数学建模社区-数学中国

标题: matlab 中极大似然法mle错误求助 [打印本页]

作者: 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)));
[paramhat,paramint]=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)
        [phat,nll,err,output] = ...

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

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

wk.txt

1.02 KB, 下载次数: 1, 下载积分: 体力 -2 点


作者: 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
表情那里是    冒号和(




欢迎光临 数学建模社区-数学中国 (http://www.madio.net/) Powered by Discuz! X2.5