#Katelyn Burton

library(dplyr) library(ggplot2)

#What type is this variable? What values does it have? #This is a categorical variable. #[1] “Administrative” “Clerical” “Other”
#[4] “Professional” “Technical”

lm(sal ~ patco, data = opm94) %>% summary()

#a) What is the reference group? #The reference group is patco Administrative.

#b) Interpret the intercept: #The expected salary for the occuption in Administration is 49808.2. #c) Interpret the coefficient on patcoClerical: #The coefficent for patcoClerical is -27546.1 which means that a person with an occupation as a Clerical [job] when compared to Administration can expect to have a salary that is less by -27546.1 #d) Interpret the coefficient of patcoProfessional: #The cofficent for patcoProfessional is 3076.2 which means that a person with an occupation as a Professional [job] when compared to Administration can expect to have a salary that is more by 3076.2

lm(sal ~ minority + grade, data = opm94) %>% summary()

#a) What is the reference group? #The reference group in this regression is Asian. #b) Interpret the intercept: #The expected salary for the minority Asian is -4643.83. #c) Interpret the coefficient on minority: #The coefficent, in the sample, minority (0) make -862.87 less than minority (10) of the same grade.
#d) Interpret the coefficient on grade: #The coefficent, in this sample, as grade increases, the expected salary of the same minority increases by 4752.52.

lm(sal ~ minority, data = opm94) %>% summary()

#a) Interpret the intercept: #The expected salary for minority is 43294.

#b) Interpret the coefficient on minority: #The coefficient, minority, on average makes -9250 less than in salary. #c) Why is the coefficient on minority different in this regression compared to the previous one (with grade included)?

lm(sal ~ grade, data = opm94) %>% summary()

#Grade is not held constant, which effects the regression because grade has a strong impact on salary as noted above in the adjusted r-squared of .83 which is a strong predictor of salary.