# # Written by: # -- # John L. Weatherwax 2009-04-21 # # email: wax@alum.mit.edu # # Please send comments and especially bug reports to the # above email address. # #----- save_plots = F set.seed(0) library(stats) # Chapter 5: Exercise 45 # if( save_plots ){ postscript("../../WriteUp/Graphics/Chapter5/ex_45.eps", onefile=FALSE, horizontal=FALSE) } old_par = par(mfrow=c(2,2)) meanlog = 3 varlog = 1 n_replications = 500 for( n in c(10,20,30,50) ){ data = rlnorm( n_replications*n, meanlog, sqrt(varlog) ) WD = matrix( data=data, nrow=n_replications, ncol=n ) hist( colMeans( WD ), freq=F, main=sprintf('n=%d', n) ) } par(old_par) if( save_plots ){ dev.off() }