[R] Greater than 1 or less than 1?

Thomas Lumley tlumley at u.washington.edu
Mon Jun 21 01:16:57 CEST 2004


On Sun, 20 Jun 2004, Zhen Chen wrote:

> I have problem evaluating the expression h = exp(x)/(exp(exp(x))-1) for
> large negative x. This expression is actually the probability
> that y = 1 when y is a Poisson random variable truncated at 0, hence
> must satisfy 0 <= h <= 1. However, when


You would be better off using the functions provided for the Poisson
distribution.

Either
dpois(1,exp(x))/ppois(0.5,exp(x),lower.tail=FALSE)
or to get 1-h
ppois(1.5,exp(x),lower.tail=FALSE)/ppois(0.5,exp(x),lower.tail=FALSE)

	-thomas




More information about the R-help mailing list