repeat.samples=function(population,sample.size,M){ #this function draws M simple random samples from a given #population of responses. #all samples have the same size, given in ``sample.size'' ybars=NULL for(i in 1:M){ resp=sample(population,sample.size) ybars[i]=mean(resp) } return(ybars) }