[R] plot - central limit theorem
rroa at udec.cl
Wed Oct 15 22:10:38 CEST 2008
Jörg Groß wrote:
> Is there a way to simulate a population with R and pull out m samples,
> each with n values
> for calculating m means?
> I need that kind of data to plot a graphic, demonstrating the central
> limit theorem
> and I don't know how to begin.
> So, perhaps someone can give me some tips and hints how to start and
> which functions to use.
> thanks for any help,
x <- runif(10000,0,1)
y <- runif(10000,0,1)
z <- runif(10000,0,1)
u <- runif(10000,0,1)
v <- runif(10000,0,1)
w <- runif(10000,0,1)
t <- x+y+z+u+v+w
hist(t,breaks=100,xlab="sum of i.i.d r.v with finite mean and
Change runif for the corresponding function of the distribution of your
Not exactly what you wanted but it does verify the C.L.T.
More information about the R-help