Skip to content
Back to formatted view

Raw Message

Message-ID: <Pine.LNX.4.31.0208170726540.4258-100000@gannet.stats>
Date: 2002-08-17T06:30:03Z
From: Brian Ripley
Subject: Random Numbers
In-Reply-To: <Pine.SOL.4.21.0208171544070.16355-100000@stat1.stat.auckland.ac.nz>

On Sat, 17 Aug 2002, Ko-Kang Kevin Wang wrote:

> Actually this applies not just to random numbers, but...
>
> Suppose I type:
>    x <- rnorm(30, 4, 1.5)
> to get some 30 random normal numbers with mean 4 and standard deviation
> 1.5.

Not quite.  You get numbers with a different mean and standard deviation:
(4, 1.5) apply to the population.

> Is there anyway to "re-trace" x?  i.e. am I able to find out what the mean
> and standard deviation for x is?

You can only estimate the population values, the usual estimates being the
sample mean and std dev.

> More generally, suppose I generated some random numbers using a particular
> distribution.  Can I find out the parameters of the distribution on these
> random numbers?

By fitting e.g. by maximum likelihood.  fitdistr(MASS) is a fairly general
function to do it.

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