[Rd] rpois gives a large number repeatedly (PR#439)

Peter Dalgaard BSA p.dalgaard@biostat.ku.dk
15 Feb 2000 12:34:52 +0100


kjetikj@astro.uio.no writes:

> Full_Name: Kjetil Kjernsmo
> Version: 0.65.1
           !!!!!!
> OS: Digital UNIX 4.0
> Submission from: (NULL) (129.240.28.172)
> 

> ncloudsbin <- function(binno, ntotalclouds, numberofbins = 100, linewidth =
> numberofbins / 6)
>   return(ntotalclouds * dnorm(binno, sd = linewidth))
> 
> photonsincidenttodetectorbin <- function(binno, ntotalclouds,
> avgphotonfromcloud, ampmode = 1, ampmean = 2, numberofbins = 100, linewidth =
> numberofbins / 6)
> {
>   sc <- ampmean - ampmode
>   if(sc <= 0) stop("Mean Amplification must be greater than Mode Amplification")
> 
>   ncb <- ncloudsbin(binno, ntotalclouds, numberofbins, linewidth)
>   rg <- rgamma(ncb, ampmean / sc, sc)
>   rp <- rpois(ncb, avgphotonfromcloud)
>   dr <- rg * rp
>   if(sum(dr) > 25000) print(cbind(rg, rp, dr, avgphotonfromcloud, ncb))
>   return(sum(dr))
> }
> 

I can't seem to generate anything unusual with the latest R snapshot.
Perhaps it would help if you told us what parameters to call
photonsincidenttodetectorbin with?

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._