Strange means of numbers drawn from rpois (PR#730)
On 8 Nov 2000, Peter Dalgaard BSA wrote:
range(sapply(1:2000, function(n) mean(rpois(10000, c(15,15+1e-8)))))
[1] 14.8692 15.1200
AHA! Spotted, I think.
Wow! Great, that was fast!
It is possible to return from rpois in step N, in which case the initialisations in step P are not performed in that invokation and not the next times either because it thinks that it has been done previously.
Ah, I tried to poke at the code, but got confused rather fast...
I'm not quite sure what is the best way to fix it, though. Either kill muprev when exiting in step N, or make the initialisations currently in step P before entering step N. Or maybe save two versions of muprev ... yes, that might be it - will try.
Great! Thanks, I hope it'll work out. And thanks to all who responded! 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._