x <- seq(70,130) y <- dnorm(x, mean=100, sd=10) plot(x, y, type="l", main= "Sampling Distributions from a Normal Distribution", xlab= "", ylab= "density", ylim=c(0,1.4), lwd=3) text(80,.11, "Normal Distribution") text(80,.05, expression(paste("(",mu, "=100, ", sigma, "=10)"))) draws <- matrix(rnorm(40*100, mean = 100, sd = 10),40, 100) samplemean.40 <- apply(draws,2, mean) lines(density(samplemean.40)) text(110,.15, "100 draws of 40") draws.2 <- matrix(rnorm(1000*100, mean = 100, sd = 10),1000, 100) samplemean.1000 <- apply(draws.2,2, mean) lines(density(samplemean.1000)) text(110,1, "100 draws of 1000")