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 年 General Social Survey(資料:
gss)估計美國人超出平常排班加班的平均天數(變數:moredays)。
使用 2010 年 General Social Survey(資料:
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 數值資料推論