Average commute time of Americans
Each year since 2005, the US Census Bureau surveys about 3.5 million households with The American Community Survey (ACS). Data collected from the ACS have been crucial in government and policy decisions, helping to determine the allocation of federal and state funds each year. Data from the 2012 ACS is available in the acs12
dataset.
When given one argument, t.test()
tests whether the population mean of its input is different than 0. That is \(H_0: \mu_{diff} = 0\) and \(H_A: \mu_{diff} \ne 0\). It also provides a 95% confidence interval.
This exercise is part of the course
Inference for Numerical Data in R
Exercise instructions
- Filter the
acs12
dataset for individuals whose employment status is"employed"
, and save this new dataset asacs12_emp
. - Use a t-test to construct a 95% confidence interval for the average commute time of Americans.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Filter for employed respondents
acs12_emp <- acs12 %>%
___
# Construct 95% CI for avg time_to_work
t.test(___)