[R] rexp and rweibull
Prof Brian D Ripley
ripley at stats.ox.ac.uk
Mon Aug 30 08:41:32 CEST 1999
On Mon, 30 Aug 1999, Mai Zhou wrote:
> In splus rexp() and rweibull() are related:
>
> > set.seed(153)
> > rexp(1)
> [1] 0.0493267
> > set.seed(153)
> > rweibull(1, shape=1)
> [1] 0.0493267
>
> (you can also try shape =2, then rweibull = sqrt(rexp) )
> However, in rw0.64.1 (on Win NT) they are different
>
> > .Random.seed <- 1:4
> > rexp(1)
> [1] 1.412030
> > .Random.seed <- 1:4
> > rweibull(1, shape=1)
> [1] 2.054032
>
> May be rweibull should be built on rexp.
Why?
You should make no assumptions whatsoever about the relationship between
the random number stream and the output random numbers: indeed the only
fairly safe assumption is that with the same initial seed on the same
release on the same platform of a statistical system you will get the same
output. It is not even true that the same initial seed will give the same
output on different platforms (due to inexact computations).
By the way, there are lots more relationships of this sort that are not
true in S-PLUS. For example, normal^2 = chisq(1) in distribution.
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help 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-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list