**From:** Anon. (*bob.ohara@helsinki.fi*)

**Date:** Thu 04 Mar 2004 - 03:26:46 EST

**Next message:**torsten@hothorn.de: "Re: [R] read.spss and time/date information"**Previous message:**Dirk Eddelbuettel: "Re: [R] get.hist.quote - is great, but am I missing something?"**In reply to:**Peter Dalgaard: "Re: [R] Problem with Integrate"**Next in thread:**Prof Brian Ripley: "Re: [R] Problem with Integrate"

Message-id: <40460746.90602@helsinki.fi>

Peter Dalgaard wrote:

*> "Anon." <bob.ohara@helsinki.fi> 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'HaraDept. 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

______________________________________________ R-help@stat.math.ethz.ch 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

**Next message:**torsten@hothorn.de: "Re: [R] read.spss and time/date information"**Previous message:**Dirk Eddelbuettel: "Re: [R] get.hist.quote - is great, but am I missing something?"**In reply to:**Peter Dalgaard: "Re: [R] Problem with Integrate"**Next in thread:**Prof Brian Ripley: "Re: [R] Problem with Integrate"

*
This archive was generated by hypermail 2.1.3
: Fri 23 Apr 2004 - 18:36:28 EST
*