From kjetikj@astro.uio.no  Tue May 23 19:33:30 2000
From: kjetikj@astro.uio.no (kjetikj@astro.uio.no)
Date: Tue, 23 May 2000 20:33:30 +0200 (MET DST)
Subject: [Rd] Random number generation problem (PR#554)
Message-ID: <200005231833.UAA06834@pubhealth.ku.dk>

Full_Name: Kjetil Kjernsmo
Version: 1.0.1
OS: osf1
Submission from: (NULL) (129.240.28.227)


Hello!

I'm getting strange numbers from a random number generation 
function again. I was wondering if it could be the same problem 
as I reported in (PR#439). 

I'm using the functions (some comments deleted for brevity):

qamp <- function(p,  type=c("point", "nolens"))
{
  if(type == "point")  
    return(1 / (2 * sqrt(1 - p)))
  else return(1)
}
  
ramp <- function(n, type=c("point", "nolens"))
{
  if(type == "point")
    return(qamp(runif(n), type))
  else return(rep(1, n))
}

...to generate random numbers. I think there might be something wrong
with runif, possibly the same problem as rpois had. 

More details:
I'm calling this function a number of times through a function
intensityfromcloud <- function(ncloudsbin, cloudintensity, amptype,
                               exptime, ...)
{
  amps <- ramp(ncloudsbin, amptype)
  write(c(max(amps), sum(amps), sum(amps - 1)),
        "lastamps.dat", ncolumns=3, append=T)
  return(cloudintensity * exptime * amps)
}
...that is called a lot. As you can see, I'm writing the maximum 
(among other things) of the generated numbers to file 
(this is a preliminary hack, for a (quite unrelated) sanity 
check I'm running). 
Now, it turns out that in 8080 maxima, the number 14654.29 appears
twice. Things like that happen, this _is_ statistics,
and my pdf doesn't fall that fast, but you know...
I thought I'd report this sooner the better... 
I made a histogram of the logarithm of the maxima for the 8080 points
and put it at <URL:http://www.astro.uio.no/~kjetikj/tmp/ampsmax.ps>

BTW, update on my other reports: 

The problem I had with match.arg() (PR#536) was in the same piece of code,
and unfortunately, it seems to happen with 1.0.1 as well.

About my crashes, PR#545 and PR#551, I had another crash today, and I 
have a 250MB (Warning! :-)) core dump at
<URL:http://www.astro.uio.no/~kjetikj/tmp/core2>
I was doing a summary of a rather strange data.frame, I was just curious 
as to what summary would say to such a thing. I don't know if it would 
be of any use. Uwe suggested that it might be a hardware problem, and I 
have contacted my sysadm, and a check will hopefully be performed on Friday.
If it would be useful to see my actions prior to the crash, please let me 
know.

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[Rd] Random number generation problem (PR#554)
kjetikj@astro.uio.no