# Sample Reading Data -- ACS # This is an example for only illustrate to use the ACS without considering the weights on the individual personal record # Heavy modifications are necessary to use as an actual research # Ideas from Tom Bales (2021 Winter Class) rm(list = ls()) acs2018_pop_il <- read_csv("http://bigblue.depaul.edu/jlee141/econdata/acs_data/acs2018_pop_il.csv") str(acs2018_pop_il) library(dplyr) # Select only variables you need here to be used for the project. # Find the variables you are interested in from see PUMS_DATA_Dictionary_2018.pdf after page 30 # Here is an example to include 8 variables and only BA or higher education attainment: acs2018_pop_il2 <- acs2018_pop_il %>% select(ST,SCHL,AGEP,CIT,FOD1P,WAGP,SEX,OCCP) acs2018_pop_il2$SEX <- as.factor(acs2018_pop_il2$SEX) acs2018_pop_il2$CIT <- as.factor(acs2018_pop_il2$CIT) acs2018_pop_il2$SCHL <- as.factor(acs2018_pop_il2$SCHL) # Filter out the Non-college / Graduate school degrees attained # # Select only people has Associate and Bachelor Degree - see PUMS_DATA_Dictionary_2018.pdf Page 42 acs2018_pop_il2 <- filter(acs2018_pop_il2,SCHL %in% c("21","22","23","24")) # Degrees from FOD1P. Check the full list in the dictionary. Dummy for Business Major acs2018_pop_il2 <- acs2018_pop_il2 %>% mutate(Degree= case_when( FOD1P %in% c(6200,6201,6202,6203,6204,6205,6206,6207,6209,6210,6211,6212,6299) ~ "BUSINESS" , FOD1P %in% c(2100,2101,2102,2105,2106,2107,3700,3701,3702,4005) ~ "COMP_MATH", TRUE ~ "A.OTHERS" )) acs2018_pop_il2$Degree <- as.factor(acs2018_pop_il2$Degree) acs2018_pop_il2$OLDER <- ifelse(acs2018_pop_il2$AGEP >55,1,0) # A Dummy for Older than 55 years old # Let's find if the degree matter to the wage income lm1 <- lm(WAGP~SEX+SCHL+AGEP+OLDER+CIT+Degree, data=acs2018_pop_il2) summary(lm1)