Hi, Not exactly what you asked for, but related.
I wrote the following little function to emulate a quincunx (a good illustration of the CLT, in my opinion): quincunx <- function(nb.bins, nb.rows=nb.bins-1, nb.balls=2^nb.bins) { x <- sample(c(0, 1), nb.balls * nb.rows, replace=TRUE) dim(x) <- c(nb.rows, nb.balls) hist(colSums(x), breaks=0:nb.rows, main="Number of balls per bin") } Idea: drop nb.balls in a quincunx with nb.bins bins at the bottom. The bin in which a ball ends up is the sum of nb.rows Bernouilli trials (where 0 stands for "left" and 1 for "right"). Hope this helps! Le 21 Avril 2005 13:06, Paul Smith a écrit : > Dear All > > I am totally new to R and I would like to know whether R is able and > appropriate to illustrate to my students the Central Limit Theorem, > using for instance 100 independent variables with uniform distribution > and showing that their sum is a variable with an approximated normal > distribution. > > Thanks in advance, > > Paul > > ______________________________________________ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html -- Vincent Goulet, Professeur agrégé École d'actuariat Université Laval, Québec ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html