I'm tryng to find MLE from inverse gamma distribution using SAS/IML, however when I run optmization appear an error. I suposse the error is because the function 'l' underflow. I have seen the Rick's blog about MLE (http://blogs.sas.com/content/iml/2011/10/12/maximum-likelihood-estimation-in-sasiml.html) and write this code: proc iml;
/*Quantile*/
start qinvgama(p,alpha,beta);
qf = 1/quantile("GAMMA",1-p,alpha,beta);
return(qf);
finish;
/*Variate*/
start rinvgama(n,alpha,beta);
u = j(n,1);
call randgen(u, "Uniform");
rg = qinvgama(u,alpha,beta);
return(rg);
finish;
start MLE(par) global (x);
alpha = par[1];
beta = par[2];
n = nrow(x);
l = n#(alpha#log(beta) - log(gamma(alpha))) - beta#sum(1/x) - (alpha + 1)#sum(log(x));
return (l);
finish;
x = rinvgama(100,2,3);
sup = { 0 0,
. .};
ini = {1.2 3};
opt = {1, 4};
call nlpnra(it, resmle, "MLE", ini, opt, sup);
print resmle;
quit;
ERROR: (execution) Invalid argument to function.
... View more