Programming expectation algorithm for negative binomial distribution
이전 댓글 표시
For the negative binomial distribution, there is a dispersion parameter to be estimated along with beta parameters. There is an error in defining the dispersion parameter.
How to define the dispersion parameter correctly.
Following is the code:
function logL = em_nbl(theta,ex,j)
global y x k n ;
beta= theta(k);
al=theta(k+1);
for i= 1:n,
L(i) = ex(i,j)*(log(gamma(y(i)+1/(al)))+y(i)*log(al)+(y(i)-1)*(x(i,:)*beta)-(y(i)+1/al)*log(1+al*(x(i,:)*beta))-log(gamma(1/a1)));
end;
logL = -sum(L);
return;
Following is the error:
Error using em_nbl (line 6)
Not enough input arguments.
댓글 수: 2
Walter Roberson
2015년 10월 10일
How are you invoking the code?
Walter Roberson
2015년 10월 10일
You should avoid using global.
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Binomial Distribution에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!