这段代码是否演示了中心极限定理?这不是家庭作业!相反,我是一名教非统计学学生一些方法的教师。
library(tidyverse)
#Make fake data
population<-rnorm(1000000, mean=100, sd=10)
#Draw 100 samples of size 5
map(1:100, ~sample(population, size=5)) %>%
#calculate their mean
map(., mean) %>%
#unlist
unlist() %>%
#draw histogram of sample means
hist(, xlim=c(80,120))
#Repeat but with sample size 500
map(1:100, ~sample(population, size=500)) %>%
map(., mean) %>%
unlist() %>%
hist(., xlim=c(80,120))
#Repeat but with sample size 1000
map(1:100, ~sample(population, size=1000)) %>%
map(., mean) %>%
unlist() %>%
hist(., xlim=c(80,120))


