Created
February 17, 2015 20:13
-
-
Save fgregg/cc594b644a7ba1768bb8 to your computer and use it in GitHub Desktop.
Our running analysis of income gender inequality in Illinois.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pums <- read.csv("small_pums.csv") | |
| hist(pums$WAGP) | |
| male_income <- pums$WAGP[pums$SEX=="male"] | |
| female_income <- pums$WAGP[pums$SEX=="female"] | |
| plot(WAGP ~ SEX, data=pums) | |
| summary(lm(WAGP ~ 1,data=pums)) | |
| model_1 <- lm(WAGP ~ SEX, data=pums) | |
| summary(model_1) | |
| pums$ESR <- factor(pums$ESR, | |
| labels=c("civilian employed, at work", | |
| "civilian employed, with a job but not at work", | |
| "unemployed", | |
| "armed forces, at work", | |
| "not in labor force")) | |
| mean(pums$WAGP,na.rm = TRUE) | |
| sum(is.na(pums$WAGP)) | |
| summary(pums$ESR) | |
| model.2 <- lm(WAGP ~ SEX, | |
| data=pums[pums$ESR=="civilian employed, at work",]) | |
| plot(WAGP ~ SEX, | |
| data=pums[pums$ESR=="civilian employed, at work",]) | |
| summary(model.2) | |
| pums$DIS | |
| pums$disability = factor(pums$DIS, labels = c("with disability", "without disabiltiy")) | |
| plot(disability ~ SEX, data=pums) | |
| pums$college <- factor(pums$SCHL > 17, labels=c("no college", "some college")) | |
| model.2 = lm(WAGP ~ SEX, | |
| data=pums[pums$ESR=="civilian employed, at work",]) | |
| summary(model.2) | |
| model.3 = lm(WAGP ~ SEX + college, | |
| data=pums[pums$ESR=="civilian employed, at work",]) | |
| summary(model.3) | |
| pums$FOD1P | |
| #2300 gen ed, 2308 science + comp teacher educ, 1401 arch | |
| FOD1P = ifelse(pums$FOD1P==2300, | |
| "gen ed", | |
| ifelse(pums$FOD1P==2308, | |
| "science teach", | |
| ifelse(pums$FOD1P==1401, | |
| "arch", | |
| "other"))) | |
| FOD1P[is.na(FOD1P)] <- "no bachelors" | |
| summary(factor(FOD1P)) | |
| sum(pums$FOD1P==2300, na.rm=TRUE) | |
| pums$FOD1P.simple=factor(FOD1P) | |
| lm(WAGP ~ SEX + FOD1P.simple, | |
| data=pums[pums$ESR=="civilian employed, at work",]) | |
| levels(pums$FOD1P.simple) | |
| employed <- pums[pums$ESR=="civilian employed, at work",] | |
| aggregate(data=employed, WAGP~SEX+FOD1P.simple, mean) | |
| pums$FOD.all=pums$FOD1P | |
| pums$FOD.all[is.na(pums$FOD.all)]="no bachelors" | |
| employed <- pums[pums$ESR=="civilian employed, at work",] | |
| lm(WAGP ~ SEX + factor(FOD.all), employed) | |
| lm(WAGP ~ AGEP, employed) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment