#cLass demo 9/18 load("euroweight.rda") hist(w,20, prob=T) n=length(w) m = mean(w) v = var(w) s = sqrt(v) z = seq(7.2,7.7,.01) phat = dnorm(z,m,s) lines(z,phat) qqnorm(w) mm = rep(0,1000) vv = rep(0,1000) md = rep(0,1000) for (i in 1:1000){ z = rnorm(n,m,s) mm[i] = mean(z) md[i]=median(z) vv[i]= var(z) } mean(mm) mean(md) sd(mm) sd(md) par(mfrow=c(2,1)) #figure with two rows and one column hist(mm) hist(md)