In this section, we’ll use the
acs data to calculate an estimate of average wage/salary income among employed individuals in the United States. We’ll test the null hypothesis that the mean income in the United States is $50,000 as well as report the standard error of our estimate of mean income, as well as corresponding p-values, t-statistics, and 95% confidence interval. Finally, we’ll report a table of summary statistics using the
modelsummary package separately by college graduates relative to non-college graduates.
This clearly exceeds 1.96 (or any common critical value) which implies that we would reject the null hypothesis that mean income is equal to $50,000.
The p-value is essentially equal to 0. This is expected given the value of the t-statistic that we calculated earlier.
library(modelsummary) library(dplyr) # create a factor variable for going to college acs$col <- ifelse(acs$educ >= 16, "college", "non-college") acs$col <- as.factor(acs$col) acs$female <- 1*(acs$sex==2) acs$incwage <- acs$incwage/1000 datasummary_balance(~ col, data=dplyr::select(acs, incwage, female, age, col), fmt=2)
|Mean||Std. Dev.||Mean||Std. Dev.||Diff. in Means||Std. Error|