Hello, All:

      Consider:


Browse[2]> set.seed(1)
Browse[2]> rpois(9, 1e10)
NAs produced[1] NA NA NA NA NA NA NA NA NA


      Should this happen?


      I think that for, say, lambda>1e6, rpois should return rnorm(., lambda, sqrt(lambda)).


      For my particular Monte Carlo, I have replaced my call to rpois with a call to the following:


 rpois. <- function(n, lambda){
      n2 <- max(length(n), length(lambda))
      n <- rep_len(n, n2)
      lambda <- rep_len(lambda, n2)
#
      big <- (lambda>1e6)
      out <- rep(NA, n2)
      out[big] <- rnorm(sum(big), lambda[big], sqrt(lambda[big]))
      out[!big] <- rpois(sum(!big), lambda[!big])
      out
  }


      Comments?
      Thanks,
      Spencer Graves

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to