Re: [R] maximizing a likelihood function containing an integral

From: Ben Bolker <bolker_at_zoo.ufl.edu>
Date: Mon 11 Sep 2006 - 13:08:54 GMT

Sam Wong <qxsr <at> yahoo.com> writes:

>
>
> Hi, R Users;
>
> I am trying to maximize a likelihood function which
> contains an integral. The integral contains the
> unknown parameter as well. I am trying to use the
> following code to do the maximization:
>

  [snip]

> The error message is:
> Error in log(x) : Non-numeric argument to mathematical
> function
>

   The only obvious (?) mistake in the code is that you refer to integrate(...)$integral -- the help page for ?integrate says that $value is the estimate of the integral, so you might be getting a NULL here.

However, the code you gave us is not reproducible/self-contained -- since I don't know what z1, z2, n1, rho are, I can't run it and see if that's the only problem.

  cheers
    Ben Bolker



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Tue Sep 12 12:45:16 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 12 Sep 2006 - 04:30:05 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.