# Creating variables based on text descriptiongroup <-rep(c('Full Sample', 'Democrats', 'Republicans'), 2)type <-c('Core anti-intellectualism', 'Core anti-intellectualism', 'Core anti-intellectualism', 'Indignant anti-intellectualism', 'Indignant anti-intellectualism', 'Indignant anti-intellectualism')cors <-c(-.57, -.64, -.38, -.34, -.44, 0.01)# combining into single dataframef2.1<-data.frame(group, type, cors)f2.1$group <-factor(f2.1$group, levels =c('Full Sample', 'Democrats', 'Republicans'))# Plottingf2.1%>%ggplot(aes(x = type, y = cors, fill = group)) +geom_col(color ='black', position ='dodge') +geom_text(aes(label =paste(cors), vjust =ifelse(cors >=0, -0.3, 1.3)), position =position_dodge(width =0.9)) +scale_fill_grey(start =0.3, end =0.8) +labs(fill ='Sample',x ='', y ='Pearson\'s Correlation') +david_func()
Chapter #3
Figure 3.1
To provide a broader and more precise picture of the partisan Diploma Divide, we performed a series of statistical regression analyses using the 2022 survey data that we described in Chapter 2. We examined differences between (a) non-college graduates, (b) bachelor’s degree holders, and (c) advanced degree holders in their relative propensities of identifying as either a Democrat, a Republican, or a “pure” Independent (who has no partisan leaning), while simultaneously accounting for the influence of other demographic characteristics (race, gender, age, household income, and church attendance).
As Figure 3-1 shows, the relative probability of identifying as a Democrat/Democratic leaner or a Republican/Republican leaner nil among those whose formal educational attainment capped out with an associate’s degree or less
Show the code
# Creating outcomesdata <- data %>%mutate(pidfac_d =case_when(pid3lean01 ==0~1, T ~0),pidfac_i =case_when(pid3lean01 ==0.5~1, T ~0),pidfac_r =case_when(pid3lean01 ==1~1, T ~0))# survey design to include weights and cluster SEs by statemydesign <-svydesign(ids =~inputstate, weights =~weight, data = data)# ModelsR <-svyglm(pidfac_r ~ justbachelorsdegree + graddegree + black + hispanic + male + age01 + faminc_missmedsub01 + churchatt601, design = mydesign, family =quasibinomial(link ="probit"))I <-svyglm(pidfac_i ~ justbachelorsdegree + graddegree + black + hispanic + male + age01 + faminc_missmedsub01 + churchatt601, design = mydesign, family =quasibinomial(link ="probit"))D <-svyglm(pidfac_d ~ justbachelorsdegree + graddegree + black + hispanic + male + age01 + faminc_missmedsub01 + churchatt601, design = mydesign, family =quasibinomial(link ="probit"))# Function to extract predicted probabilitiespred_func <-function(reg, bach, grad, pid, educ) { predict_data <-data.frame(# desired levels of educationjustbachelorsdegree = bach,graddegree = grad,# covariates fixed at their menasblack =weighted.mean(data$black, na.rm =TRUE, w = data$weight),hispanic =weighted.mean(data$hispanic, na.rm =TRUE, w = data$weight),male =weighted.mean(data$male, na.rm =TRUE), w = data$weight,age01 =weighted.mean(data$age01, na.rm =TRUE, w = data$weight),faminc_missmedsub01 =weighted.mean(data$faminc_missmedsub01, na.rm =TRUE, w = data$weight),churchatt601 =weighted.mean(data$churchatt601, na.rm =TRUE, w = data$weight) )# tidying preds <-predict(reg, newdata = predict_data, type ="response") preds <-as.data.frame(preds) preds$pid <- pid preds$educ <- educreturn(preds)}# Creating dataframe of predictionsd1 <-pred_func(D, 0, 0, 'Democrat', 'Associates degree or less') d2 <-pred_func(D, 1, 0, 'Democrat', 'Bachelor\'s degree') d3 <-pred_func(D, 1, 1, 'Democrat', 'Graduate degree') i1 <-pred_func(I, 0, 0, 'Independent', 'Associates degree or less') i2 <-pred_func(I, 1, 0, 'Independent', 'Bachelor\'s degree') i3 <-pred_func(I, 1, 1, 'Independent', 'Graduate degree') r1 <-pred_func(R, 0, 0, 'Republican', 'Associates degree or less') r2 <-pred_func(R, 1, 0, 'Republican', 'Bachelor\'s degree') r3 <-pred_func(R, 1, 1, 'Republican', 'Graduate degree') f3.1<-bind_rows(d1, d2, d3, i1, i2, i3, r1, r2, r3)f3.1<- f3.1%>%mutate(ymax = response + SE,ymin = response - SE)# Plotf3.1%>%ggplot(., aes(x = pid, y = response, ymin = ymin, ymax = ymax)) +geom_col(color ='black', position ='dodge', fill ='grey60') +geom_errorbar(position =position_dodge(width =0.9), width =0.2) +david_func() +facet_wrap(~educ) +labs(x ='Party identification', y ='Probability of PID') +theme(axis.text.x =element_text(angle =45, hjust =1)) +scale_y_continuous(labels = scales::percent)
Figure 3.2
Given those numbers, we asked our survey respondents to indicate the name and location of the last college or university they had attended (if they had), and then scored those responses on a five-point scale ranging from “zero” (online for-profit university with universal admissions) to “four” (top 100 university or liberal arts college, based on the 2022 US News and World Report rankings). We then added that measure of “college elitism” to our regression model.
So, to get a better sense of the degree to which authentic intellectual identity, rather than the rudimentary indicators of educational attainment and/or educational elitism, correspond to Democratic partisanship, we added the nine-item intellectual identity index that we described in Chapter 2 to the regression model predicting partisan differences.