Reputation: 1
I have data on Italian city size from 2011 census and I would like to fit them with a Double Pareto LogNormal but I cannot. I tried defining a function handle that is the log likelihood of the distribution in this way
ln_lik_dpln=@(alpha,beta,mu,sigma) ...
- sum(log(alpha) + log(beta) - log(alpha+beta) + ...
normpdf((pop2011-mu)/sigma) + ...
log(normpdf((alpha*sigma)-((pop2011-mu)/sigma))/normcdf((alpha*sigma)- ...
((pop2011-mu)/sigma)) + ...
normpdf((beta*sigma)-((pop2011-mu)/sigma))/normcdf((beta*sigma) - ...
((pop2011-mu)/sigma))))
and then minimizing it with fmincon
and fminunc
but both do not recognize beta.
Upvotes: 0
Views: 193
Reputation: 791
You need to write your anonymous function so that its parameters are described by a single vector rather than multiple scalar arguments. E.g.,
ln_lik_dpln=@(x) ...
- sum(log(x(1)) + log(x(2)) - log(x(1)+x(2)) + ...
normpdf((pop2011-x(3))/x(4)) + ...
log(normpdf((x(1)*x(4))-((pop2011-x(3))/x(4)))/normcdf((x(1)*x(4))- ...
((pop2011-x(3))/x(4))) + ...
normpdf((x(2)*x(4))-((pop2011-x(3))/x(4)))/normcdf((x(2)*x(4)) ...
((pop2011-x(3))/x(4)))))
Then you can pass this function handle to fmincon
or fminunc
for minimization from some initial vector of length 4.
Upvotes: 1