file <- "http://www.uvm.edu/~rsingle/stat211/data/extra/Rectangles.txt" dat<-read.table(file, header=T, na.strings=c("NA",".")) rect.area <- dat$Y sample(rect.area,5) #split the screen par(mfrow=c(2,2)) # x is our original (skewed) data x <- rect.area #x <- rchisq(2000,3) #uncomment for random skewed data hist(x,main="Original Sample") n <- 10 xbar <- vector(length=500) for(i in 1:500) { samp <- sample(x,n,replace=T) xbar[i] <- mean(samp) cat(i,":",samp," xbar=",xbar[i],"\n") #print(c(samp,xbar[i])) } hist(xbar, main="~ Sampling Dist. for Xbar") #note that the means are approx. equal mean(x) mean(xbar) #note the relationship of the SDs of the original and sampling dists sd(x) sd(x)/sqrt(n) sd(xbar) #===================================== #note that the means are approx. equal cat(" mean(x)=", mean(x) , "\n" ) cat("mean(xbar)=", mean(xbar), "\n" ) #note the relationship of the SDs of the original and sampling dists cat(" sd(x)=", sd(x) , "\n" ) cat("sd(x)/sqrt(n)=", sd(x)/sqrt(n), "\n" ) cat(" sd(xbar)=", sd(xbar) , "\n" )