Get startedGet started for free

Calculating group-wise margins of error

One way to reduce margins of error in an ACS analysis is to combine estimates when appropriate. This can be accomplished using tidyverse group-wise data analysis tools. In this exercise, you'll combine estimates for male and female elderly poverty in Vermont, and use the moe_sum() function as part of this group-wise analysis. While you may lose some detail with this type of approach, your estimates will be more reliable relative to their margins of error than before you combined them.

This exercise is part of the course

Analyzing US Census Data in R

View Course

Exercise instructions

  • Group the vt_eldpov dataset by the GEOID column.
  • In the summarize() call, use the moe_sum() function to calculate a derived margin of error.
  • Check the proportion of rows with margins of error that exceed their estimates.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# 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)
Edit and Run Code