開始使用免費開始

計算分組的誤差範圍

在 ACS 分析中,降低誤差範圍的一種方法是在合適的情況下合併估計值。這可以透過 tidyverse 的分組資料分析工具來完成。在這個練習中,你會把佛蒙特州男性與女性高齡貧窮的估計值合併,並在分組分析中使用 moe_sum() 函式。雖然這種做法可能會犧牲一些細節,但相較於合併前,你的估計值相對於其誤差範圍會更可靠。

本練習屬於課程

在 R 中分析美國人口普查資料

檢視課程

練習說明

  • 以 GEOID 欄位對 vt_eldpov 資料集進行分組。
  • summarize() 中,使用 moe_sum() 函式計算衍生的誤差範圍。
  • 檢查有多少列的誤差範圍大於其估計值的比例。

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# Group the dataset and calculate a derived margin of error
vt_eldpov2 <- vt_eldpov %>%
  ___(___) %>%
  summarize(
    estmf = sum(estimate), 
    moemf = ___(___ = moe, estimate = estimate)
  )

# Filter rows where newly-derived margin of error exceeds newly-derived estimate
moe_check2 <- filter(vt_eldpov2, ___ > estmf)

# Check proportion of rows where margin of error exceeds estimate
nrow(moe_check2) / ___(vt_eldpov2)
編輯並執行程式碼