# [Rd] Re: [R] Strange means of numbers drawn from rpois (PR#730)

kjetil.kjernsmo@astro.uio.no kjetil.kjernsmo@astro.uio.no
Wed, 8 Nov 2000 17:23:12 +0100 (MET)

```On 8 Nov 2000, Peter Dalgaard BSA wrote:

>Done...

Great!

>(This kind of behaviour has been observed on various platforms and
>various compilers, sometimes getting stuck around 15.15 and sometimes
>around 14.5. Others report no problems. Very strange. I've seen one
>case where it apparently shifted from one regime to the other.)

Yes, it does that here too.... The following is a verbatim excerpt from my
session:
> sapply(1:15, function(n) mean(rpois(1000000, n)))
[1]  0.999031  2.000444  3.002296  3.997795  4.998880  5.995267  7.001894
[8]  7.999983  9.000267  9.513537 10.507142 11.502634 12.498944 13.498615
[15] 14.502410
> rpois
function (n, lambda)
.Internal(rpois(n, lambda))
> version
_
platform alphaev6-dec-osf4.0e
arch     alphaev6
os       osf4.0e
system   alphaev6, osf4.0e
status
major    1
minor    1.1
year     2000
month    August
day      15
language R
> plot(sapply(1:15, function(n) mean(rpois(1000000, n))), t='l')
> sapply(1:15, function(n) mean(rpois(1000000, n)))
[1]  0.997961  1.999509  3.000748  3.999825  5.002983  6.004424  6.998825
[8]  7.997999  8.998341  9.766942 10.781751 11.817181 12.856154 13.900369
[15] 14.999378

And from looking at 11, it is apparent that something happened... Also, by
inspecting the graph produced by plot, it may seem as if it happens in the
plot call... But this is really hard to see, but you might want to have a
look.

Best,

Kjetil
--
Kjetil Kjernsmo
Graduate astronomy-student                    Problems worthy of attack
University of Oslo, Norway            Prove their worth by hitting back
E-mail: kjetikj@astro.uio.no                                - Piet Hein
Homepage <URL:http://www.astro.uio.no/~kjetikj/>
Webmaster@skepsis.no

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

```