Peter Dalgaard wrote:
"Anon." <[EMAIL PROTECTED]> writes:


I assume that this is because for much of the range, the integral is
basically zero.

The help page for integrate() says When integrating over infinite intervals do so explicitly, rather than just using a large number as the endpoint. This increases the chance of a correct answer - any function whose integral over an infinite interval is finite must be near zero for most of that interval. That is, if you want an integral from 0 to Inf, do that.


Sorry, I forgot to put that in my message. It gives the same error as a large value. I assume it's all a result of the NaN's being returned.


It does seem to help a bit if you modify the integrand to


PLN1

function(lam, Count, mu, sigma2) { t1 <- dpois(Count, exp(lam), log=F) t2 <- dnorm(lam, mu, sqrt(sigma2)) ifelse(t1==0|t2==0,0,t1*t2) }


<snip>

Mange tak!

And thank you to everyone else for their help too. The generic solution will help me with the next stage of my work. I can see that it might break down, but only under rather bizarre circumstances.

Bob

--
Bob O'Hara

Dept. of Mathematics and Statistics
P.O. Box 4 (Yliopistonkatu 5)
FIN-00014 University of Helsinki
Finland
Telephone: +358-9-191 23743
Mobile: +358 50 599 0540
Fax:  +358-9-191 22 779
WWW:  http://www.RNI.Helsinki.FI/~boh/
Journal of Negative Results - EEB: http://www.jnr-eeb.org

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to