[R] Computing Maximum Loglikelihood With nlm Problem

2008-05-21 Thread Edward Wijaya
Hi, I tried to compute maximum likelihood under gamma distribution, using nlm function. The code is this: __BEGIN__ vsamples- c(103.9, 88.5, 242.9, 206.6, 175.7, 164.4) mlogl - function(alpha, x) { if (length(alpha) 1) stop(alpha must be scalar) if (alpha = 0) stop(alpha must be

Re: [R] Computing Maximum Loglikelihood With nlm Problem

2008-05-21 Thread Charilaos Skiadas
Try: mlogl_out - nlm(mlogl, mean(vsamples), vsamples) or mlogl_out - nlm(mlogl, mean(vsamples), x=vsamples) The argument vsamples=vsamples is passed to mlogl, since nlm does not recognize it. But mlogl doesn't have a vsamples argument, only alpha and x arguments. So you have to either

Re: [R] Computing Maximum Loglikelihood With nlm Problem

2008-05-21 Thread Edward Wijaya
Thanks so much. - Edward On Thu, May 22, 2008 at 11:17 AM, Charilaos Skiadas [EMAIL PROTECTED] wrote: Try: mlogl_out - nlm(mlogl, mean(vsamples), vsamples) or mlogl_out - nlm(mlogl, mean(vsamples), x=vsamples) The argument vsamples=vsamples is passed to mlogl, since nlm does not