Skip to content
Prev 85951 / 398502 Next

how to use mle?

I see two problems:

	  First, "mle" expects its first argument to return (-log(likelihood)); 
  your "LL" is closer to "+log(likelihood)", but it seems to be missing 
something beyond that.  In particular, "Y" is 10 x 3, but "fit" is only 
10 x 2.

	  Second, I'm not sure, but it looks to me like "mle" wants to optimize 
over scalar arguments its first argument, "LL" in your case, and you 
want it to optimize over a vector.  I can't see where the help page for 
"mle" spells it out, but unless I missed something, the examples all 
used scalar arguments.  Moreover, I walked through your call to "mle" 
line by line after 'debug(mle)'.  The argument "start" that "mle" passes 
to "optim" was of length 0.  Therefore, you need to do something 
different to convince "mle" that it needs to optimize by varying more 
than 0 parameters.

	  Have you considered changing the sign of the output of "LL" (which 
you need to do anway) and giving it directly to "optim"?  That should 
work.

	  Moreover, it looks to me like you want to do multinomial logistic 
regression.  If that is so, have you considered searching for that in 
particular?  RSiteSearch("multinomial logistic regression") returned 130 
hits for me just now.

	  hope this helps.
	  spencer graves
ronggui wrote: