Skip to content
Prev 4306 / 20628 Next

stuck with maximum likelihood problem

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