Skip to content
Prev 277299 / 398506 Next

how to include integrate in a function that can be solved with uniroot?

You need to explicitly pass th to your function with the ... argument
of integrate.

E <- function(th){
    integrate(function(x,th) x*g(x, th), 0, Inf, th)$value
}

Also, it's value, not Value, which might be producing errors of another sort.

Michael
On Mon, Nov 14, 2011 at 9:16 AM, Gerrit Draisma <gdraisma at xs4all.nl> wrote: