I have a log-likelihood function and I want to maximize it in respect to theta (N), and it is defined as:
function loglik(theta,n,r)
N=theta;k=length(n);
ar1=float(lgamma(N+1));ar2=sum(n)*log(sum(n)/(k*N));ar3=(k*N-sum(n))*log(1-(sum(n))/(k*N));
par=float(lgamma((N-r)+1));
return(-(ar1+ar2+ar3-par)) end
The I use Optim.jl's optimize
function as:
r=optimize(b->loglik(b,nn, 962), 978, BFGS() );
Where nn is an array. And I get this error:
ERROR:MethodError no method matching optimize (::#46#47,::Float64, ::Optim.BFGS)
Can anyone help?