R 中的数值数据推断
Mine Cetinkaya-Rundel
Associate Professor of the Practice, Duke University
设在一个包含100人的随机样本中有13人是左撇子。若再抽取一个100人的随机样本,只有12人是左撇子会意外吗?15人呢?30人?或仅1人或多达90人?
量化样本均值变异性的方式:
通过自助法模拟
用中心极限定理近似
$$ \bar{x} \sim N \left( mean = \mu, SE = \frac{\sigma}{\sqrt{n}} \right) $$
使用2010年综合社会调查(数据:
gss)估计美国人在常规安排之外加班的平均天数(变量:moredays)。
使用2010年综合社会调查(数据:
gss)估计美国人在常规安排之外加班的平均天数(变量:moredays)。
t.test(gss$moredays, conf.level = 0.95)
One Sample t-test
data: gss$moredays
t = 25.628, df = 1146, p-value < 2.2e-16
alternative hypothesis: true mean is not equal to 0
95 percent confidence interval:
5.273367 6.147732
sample estimates:
mean of x
5.710549
R 中的数值数据推断