An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-mixed-models/attachments/20100813/00578782/attachment.pl>
stuck with maximum likelihood problem
3 messages · Michael Larkin, Ben Bolker, Murray Jorgensen
Here is my situation in a simple description: I have an equation that has one parameter and 3 data variables. ?I need to get R to determine the parameter value that maximizes the sum calculated from the equation. I know this is simple problem but my search into functions of R got me confused. ?I think I should use the optim function but I also read about the trust function. ?I found some very useful examples for the optim function but they related to specific distributions (i.e. normal, poisson)
Your question is pretty vague ... Suppose you define a function objfun() that takes the parameter as its first argument (for simplicity, let's say that it just uses the values of the data drawn from the global workspace) so that objfun(p) returns the value you are trying to maximize. Then optim(startval,fn=objfun,control=list(fnscale=-1)) should find the value of the parameter that maximizes the function (by default optim() does minimization: the fnscale=-1 option makes it do maximization instead
Have you considered doing the math needed to solve the score equation?
You will need to solve a single nonlinear equation
g(theta) = 0
If you cant do this analytically you should be able to transform it to
the form
theta = h(theta)
and then iterate on h or h-inverse from a suitable starting value to
find a fixed point.
Murray Jorgensen
On 14/08/10 2:22 PM, Michael Larkin wrote:
I know this is a mixed effect model email list and I apologize if I annoy anyone. I figured since I was already a member of this list I could try my question here first. Also, I have received VERY helpful responses from this list in the past and I am hoping to repeat this. Here is my situation in a simple description: I have an equation that has one parameter and 3 data variables. I need to get R to determine the parameter value that maximizes the sum calculated from the equation. I know this is simple problem but my search into functions of R got me confused. I think I should use the optim function but I also read about the trust function. I found some very useful examples for the optim function but they related to specific distributions (i.e. normal, poisson) Any advice would be greatly appreciated. Mike [[alternative HTML version deleted]]
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
Dr Murray Jorgensen http://www.stats.waikato.ac.nz/Staff/maj.html Department of Statistics, University of Waikato, Hamilton, New Zealand Email: maj at waikato.ac.nz majorgensen at ihug.co.nz Fax 7 838 4155 Phone +64 7 838 4773 wk Home +64 7 825 0441 Mobile 021 0200 8350