# rearrange genders
$gender <- factor(survey$gender, levels = c("Male", "Female", "Non-binary"))
survey
# first ask: gender bias in feeling uncomfortable in asking a question?
$comfort_asking_rating <- as.factor(survey$comfort_asking_rating)
survey
<- MASS::polr(comfort_asking_rating ~ gender + career_3cat, data = subset(survey, !is.na(gender)))
comfort_gender
coeftest(comfort_gender)
t test of coefficients:
Estimate Std. Error t value Pr(>|t|)
genderFemale -1.26188 0.21061 -5.9917 5.006e-09 ***
genderNon-binary -1.60412 0.67979 -2.3597 0.01882 *
career_3catLate career 2.47523 0.32986 7.5038 4.829e-13 ***
career_3catMid career 1.04273 0.20670 5.0447 7.192e-07 ***
career_3catOther 0.56917 0.47113 1.2081 0.22780
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
<- MASS::polr(comfort_asking_rating ~ career_3cat, data = subset(survey, !is.na(gender)))
comfort_gender_null
<- collect_out(model = comfort_gender, null = comfort_gender_null, name = "comfort_ask_question_gender", n_factors = 4, type = "likert", save = "yes", dir = "../results/survey")
m_comfortout
%>% t() %>% kbl() %>%
m_comfortout kable_classic_2()
model_name | comfort_ask_question_gender |
AIC | 1360.136 |
n_obs | 374 |
lrt_pval | 0 |
lrt_chisq | 38.188 |
intercept_12 | -2.774 |
intercept_23 | -1.616 |
intercept_34 | -0.875 |
intercept_45 | -0.074 |
intercept_56 | 0.945 |
intercept_67 | 2.295 |
n_factors | 4 |
est_genderFemale | -1.262 |
lowerCI_genderFemale | -1.676 |
higherCI_genderFemale | -0.848 |
se_genderFemale | 0.211 |
tval_genderFemale | -5.992 |
pval_genderFemale | 0 |
est_genderNon-binary | -1.604 |
lowerCI_genderNon-binary | -2.941 |
higherCI_genderNon-binary | -0.267 |
se_genderNon-binary | 0.68 |
tval_genderNon-binary | -2.36 |
pval_genderNon-binary | 0.019 |
est_career_3catLate career | 2.475 |
lowerCI_career_3catLate career | 1.827 |
higherCI_career_3catLate career | 3.124 |
se_career_3catLate career | 0.33 |
tval_career_3catLate career | 7.504 |
pval_career_3catLate career | 0 |
est_career_3catMid career | 1.043 |
lowerCI_career_3catMid career | 0.636 |
higherCI_career_3catMid career | 1.449 |
se_career_3catMid career | 0.207 |
tval_career_3catMid career | 5.045 |
pval_career_3catMid career | 0 |
# if you're less comfortable asking a question, is it less likely you ask one?
$comfort_asking_rating <- as.numeric(as.character(survey$comfort_asking_rating))
survey
<- glm(ask_questions ~ comfort_asking_rating + gender + career_3cat,
ask_comfort family = binomial, data = subset(survey, !is.na(gender) & !is.na(career_3cat) & !is.na(comfort_asking_rating)))
<- glm(ask_questions ~ gender + career_3cat, family = binomial,
ask_comfort_null data = subset(survey, !is.na(gender) & !is.na(career_3cat) & !is.na(comfort_asking_rating)))
<- collect_out(model = ask_comfort, null = ask_comfort_null, name = "comfort_ask_question", n_factors = 5 , type="survey", save = "yes", dir = "../results/survey")
m_comfort_ask_out
%>% t() %>% kbl() %>%
m_comfort_ask_out kable_classic_2()
model_name | comfort_ask_question |
AIC | 371.653 |
n_obs | 372 |
lrt_pval | 0 |
lrt_chisq | 86.582 |
intercept_estimate | -2.781 |
intercept_estimate_prop | 0.058 |
intercept_pval | 0 |
intercept_ci_lower | -3.695 |
intercept_ci_higher | -1.866 |
n_factors | 5 |
est_comfort_asking_rating | 0.733 |
lowerCI_comfort_asking_rating | 0.555 |
higherCI_comfort_asking_rating | 0.911 |
pval_comfort_asking_rating | 0 |
zval_comfort_asking_rating | 8.07 |
est_genderFemale | 0.259 |
lowerCI_genderFemale | -0.341 |
higherCI_genderFemale | 0.86 |
pval_genderFemale | 0.397 |
zval_genderFemale | 0.846 |
est_genderNon-binary | 2.686 |
lowerCI_genderNon-binary | 0.372 |
higherCI_genderNon-binary | 4.999 |
pval_genderNon-binary | 0.023 |
zval_genderNon-binary | 2.275 |
est_career_3catLate career | 1.732 |
lowerCI_career_3catLate career | 0.414 |
higherCI_career_3catLate career | 3.05 |
pval_career_3catLate career | 0.01 |
zval_career_3catLate career | 2.575 |
est_career_3catMid career | 0.336 |
lowerCI_career_3catMid career | -0.22 |
higherCI_career_3catMid career | 0.892 |
pval_career_3catMid career | 0.237 |
zval_career_3catMid career | 1.183 |
# indeed due to gender bias in being comfortable asking questions
### isolate reasons
# take out reasons that were ticked less than 15 times
<- data.frame()
n_ticked
for (i in 1:ncol(survey)){
if (grepl("reason_question|reason_noquestion", colnames(survey)[i]) == TRUE) {
<- survey[,i]
sub <- as.data.frame(summary(as.factor(sub)))
sum <- sum["1","summary(as.factor(sub))"]
ticked <- data.frame(i = i,
row reason = colnames(survey)[i],
ticked = ticked)
<- rbind(n_ticked, row)
n_ticked
}
}
<- subset(n_ticked, ticked >= 15)
ticked_enough
# isolate questions about conditions, motivations and hesitations
<- grep("more_comfort", colnames(survey))
conditions <- c(ticked_enough$i)
reasons <- c(conditions, reasons)
reasons_conditions
# take out 'other' reasons
<- grep("_other", colnames(survey)[reasons_conditions])
other <- reasons_conditions[-other] #exclude 'other' categories
reasons_conditions
# take out not chosen
<- grep("reason_noquestion_notchosen", colnames(survey)[reasons_conditions])
notchosen <- reasons_conditions[-notchosen] #exclude
reasons_conditions
<- data.frame()
output_reasons
for (i in reasons_conditions){
## split conditions between motivation/hestitations
if (grepl("more_comfort", colnames(survey)[i]) == TRUE) {
# null model
<- as.formula(paste0(colnames(survey)[i], "~ career_3cat"))
formula_null <- MASS::polr(formula_null, data = subset(survey, !is.na(gender))) #polr for ordinal GLMs
null
# alternative model with gender
<- formula(paste0(colnames(survey)[i], "~ gender + career_3cat"))
formula_alt <- MASS::polr(formula_alt, data = subset(survey, !is.na(gender)))
model
<- as.data.frame(coeftest(model)[,])
sum <- as.data.frame(confint(model))
confint
# lrt
<- anova(null, model, test = "Chisq")
lrt <- lrt$`Pr(Chi)`[2]
lrt_pval <- lrt$`LR stat.`[2]
lrt_chisq
<- data.frame(response = colnames(survey)[i],
out lrt_chisq = lrt_chisq,
lrt_pval = lrt_pval,
coef_female = sum["genderFemale","Estimate"],
pval_female = sum["genderFemale","Pr(>|t|)"],
lower_female = confint["genderFemale","2.5 %"],
upper_female = confint["genderFemale","97.5 %"],
se_female = sum["genderFemale", "Std. Error"],
zval_tval_female = sum["genderFemale", "t value"],
coef_non_binary = sum["genderNon-binary","Estimate"],
pval_non_binary = sum["genderNon-binary","Pr(>|t|)"],
lower_non_binary = confint["genderNon-binary","2.5 %"],
upper_non_binary = confint["genderNon-binary","97.5 %"],
se_non_binary = sum["genderNon-binary", "Std. Error"],
zval_tval_non_binary = sum["genderNon-binary", "t value"],
coef_mid = sum["career_3catMid","Estimate"],
pval_mid = sum["career_3catMid","Pr(>|t|)"],
se_mid = sum["career_3catMid", "Std. Error"],
zval_tval_mid = sum["career_3catMid", "t value"],
coef_late = sum["career_3catLate","Estimate"],
pval_late = sum["career_3catLate","Pr(>|t|)"],
se_late = sum["career_3catLate", "Std. Error"],
zval_tval_late = sum["career_3catLate", "t value"],
coef_other = sum["career_3catOther","Estimate"],
pval_other = sum["career_3catOther","Pr(>|t|)"],
se_other = sum["career_3catOther", "Std. Error"],
zval_tval_other = sum["career_3catOther", "t value"])
<- rbind(output_reasons, out)
output_reasons
}if (grepl("reason", colnames(survey)[i]) == TRUE) {
# null model
<- as.formula(paste0(colnames(survey)[i], "~ career_3cat"))
formula_null <- glm(formula_null, data = subset(survey, !is.na(gender)), family = "binomial")
null # alternative model with gender
<- formula(paste0(colnames(survey)[i], "~ gender + career_3cat"))
formula_alt <- glm(formula_alt, data = survey, family = "binomial")
model <- summary(model)$coefficients
sum <- (as.data.frame(summ(model, confint=TRUE)$coeftable))
confint
# lrt
<- anova(null, model, test = "Chisq")
lrt <- lrt$`Pr(>Chi)`[2]
lrt_pval <- lrt$`Deviance`[2]
lrt_chisq
# collect all output
<- data.frame(response = colnames(survey)[i],
out lrt_chisq = lrt_chisq,
lrt_pval = lrt_pval,
coef_female = sum["genderFemale","Estimate"],
pval_female = sum["genderFemale","Pr(>|z|)"],
lower_female = confint["genderFemale","2.5%"],
upper_female = confint["genderFemale","97.5%"],
se_female = sum["genderFemale", "Std. Error"],
zval_tval_female = sum["genderFemale", "z value"],
coef_non_binary = sum["genderNon-binary","Estimate"],
pval_non_binary = sum["genderNon-binary","Pr(>|z|)"],
lower_non_binary = confint["genderNon-binary","2.5%"],
upper_non_binary = confint["genderNon-binary","97.5%"],
se_non_binary = sum["genderNon-binary", "Std. Error"],
zval_tval_non_binary = sum["genderNon-binary", "z value"],
coef_mid = sum["career_3catMid career","Estimate"],
se_mid = sum["career_3catMid career","Std. Error"],
zval_tval_mid = sum["career_3catMid career","z value"],
pval_mid = sum["career_3catMid career","Pr(>|z|)"],
coef_late = sum["career_3catLate career","Estimate"],
se_late = sum["career_3catLate career","Std. Error"],
zval_tval_late = sum["career_3catLate career","z value"],
pval_late = sum["career_3catLate career","Pr(>|z|)"],
coef_other = sum["career_3catOther","Estimate"],
se_other = sum["career_3catOther","Std. Error"],
zval_tval_other = sum["career_3catOther","z value"],
pval_other = sum["career_3catOther","Pr(>|z|)"]
)
<- rbind(output_reasons, out)
output_reasons
}}
# adjust p-values for multiple testing
$lrt_qval <- p.adjust(output_reasons$lrt_pval, method = "fdr", n = nrow(output_reasons))
output_reasons
# round to 3 digits
<- output_reasons %>% mutate_if(is.numeric, round, digits=3)
output_reasons
# save output in results
write.csv(output_reasons, file = "../results/question-asking/question_asking_why_survey_result.csv", quote=F, row.names = F)
%>% arrange(lrt_qval) %>% kbl() %>%
output_reasons kable_classic_2()
response | lrt_chisq | lrt_pval | coef_female | pval_female | lower_female | upper_female | se_female | zval_tval_female | coef_non_binary | pval_non_binary | lower_non_binary | upper_non_binary | se_non_binary | zval_tval_non_binary | coef_mid | pval_mid | se_mid | zval_tval_mid | coef_late | pval_late | se_late | zval_tval_late | coef_other | pval_other | se_other | zval_tval_other | lrt_qval |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
more_comfort_asking_owngender_speaker_rating | 36.304 | 0.000 | 1.222 | 0.000 | 0.785 | 1.673 | 0.226 | 5.402 | 2.441 | 0.000 | 1.080 | 3.781 | 0.681 | 3.583 | -0.345 | 0.104 | 0.211 | -1.631 | -0.617 | 0.062 | 0.330 | -1.869 | -0.222 | 0.657 | 0.500 | -0.444 | 0.000 |
more_comfort_asking_owngender_audience_rating | 41.061 | 0.000 | 1.327 | 0.000 | 0.903 | 1.764 | 0.219 | 6.054 | 1.902 | 0.004 | 0.585 | 3.201 | 0.659 | 2.888 | -0.114 | 0.583 | 0.208 | -0.549 | -0.453 | 0.175 | 0.333 | -1.358 | -0.161 | 0.730 | 0.466 | -0.345 | 0.000 |
more_comfort_asking_owngender_host_rating | 19.640 | 0.000 | 0.921 | 0.000 | 0.487 | 1.368 | 0.224 | 4.109 | 1.578 | 0.019 | 0.255 | 2.923 | 0.672 | 2.349 | -0.215 | 0.318 | 0.215 | -1.000 | -0.707 | 0.033 | 0.330 | -2.141 | 0.119 | 0.818 | 0.515 | 0.231 | 0.000 |
more_comfort_asking_smallaudience_rating | 15.805 | 0.000 | 0.791 | 0.000 | 0.389 | 1.196 | 0.206 | 3.843 | -0.074 | 0.913 | -1.419 | 1.250 | 0.673 | -0.109 | -0.295 | 0.145 | 0.202 | -1.460 | -0.588 | 0.058 | 0.309 | -1.901 | -0.370 | 0.445 | 0.484 | -0.765 | 0.002 |
reason_noquestion_phrasing | 11.191 | 0.004 | 0.900 | 0.002 | 0.343 | 1.458 | 0.285 | 3.164 | 1.026 | 0.205 | -0.562 | 2.614 | 0.810 | 1.266 | -0.570 | 0.024 | 0.253 | -2.251 | -1.588 | 0.002 | 0.503 | -3.156 | -0.987 | 0.141 | 0.670 | -1.474 | 0.015 |
reason_noquestion_confidence | 7.642 | 0.022 | 0.784 | 0.012 | 0.176 | 1.392 | 0.310 | 2.526 | -0.233 | 0.835 | -2.422 | 1.957 | 1.117 | -0.208 | -0.420 | 0.119 | 0.269 | -1.559 | -2.914 | 0.005 | 1.026 | -2.840 | -0.590 | 0.379 | 0.671 | -0.879 | 0.073 |
reason_noquestion_intimidated_audience | 6.270 | 0.043 | 0.760 | 0.021 | 0.115 | 1.405 | 0.329 | 2.309 | -0.107 | 0.925 | -2.326 | 2.111 | 1.132 | -0.095 | -1.211 | 0.000 | 0.322 | -3.762 | -1.197 | 0.018 | 0.505 | -2.369 | -1.075 | 0.169 | 0.781 | -1.376 | 0.124 |
reason_question_voiceheard | 5.946 | 0.051 | -0.601 | 0.193 | -1.505 | 0.304 | 0.461 | -1.302 | 1.787 | 0.057 | -0.052 | 3.626 | 0.938 | 1.904 | 0.856 | 0.094 | 0.511 | 1.673 | 0.703 | 0.334 | 0.727 | 0.967 | 1.564 | 0.072 | 0.869 | 1.800 | 0.128 |
reason_noquestion_private | 5.367 | 0.068 | 0.297 | 0.201 | -0.159 | 0.753 | 0.233 | 1.277 | -1.553 | 0.158 | -3.707 | 0.601 | 1.099 | -1.413 | -0.047 | 0.837 | 0.229 | -0.206 | -1.106 | 0.004 | 0.379 | -2.918 | 0.394 | 0.473 | 0.550 | 0.717 | 0.152 |
reason_noquestion_intimidated_setting | 4.871 | 0.088 | 0.719 | 0.126 | -0.203 | 1.641 | 0.470 | 1.528 | 2.002 | 0.036 | 0.129 | 3.876 | 0.956 | 2.094 | -0.974 | 0.044 | 0.483 | -2.016 | 0.293 | 0.563 | 0.505 | 0.579 | 0.698 | 0.315 | 0.694 | 1.006 | 0.175 |
reason_question_interest | 4.050 | 0.132 | -0.529 | 0.166 | -1.275 | 0.218 | 0.381 | -1.387 | 14.303 | 0.987 | -1753.050 | 1781.656 | 901.727 | 0.016 | -0.529 | 0.107 | 0.329 | -1.610 | 1.731 | 0.096 | 1.040 | 1.665 | 0.646 | 0.543 | 1.064 | 0.608 | 0.217 |
reason_noquestion_relevance | 3.894 | 0.143 | -0.264 | 0.255 | -0.719 | 0.190 | 0.232 | -1.139 | -1.688 | 0.125 | -3.844 | 0.469 | 1.100 | -1.534 | -0.329 | 0.160 | 0.234 | -1.403 | -0.710 | 0.051 | 0.363 | -1.955 | 0.636 | 0.248 | 0.550 | 1.156 | 0.217 |
reason_noquestion_notime | 3.771 | 0.152 | -0.403 | 0.108 | -0.895 | 0.088 | 0.251 | -1.608 | 0.620 | 0.438 | -0.948 | 2.188 | 0.800 | 0.775 | 0.554 | 0.034 | 0.262 | 2.116 | 1.204 | 0.001 | 0.353 | 3.406 | 0.374 | 0.543 | 0.615 | 0.608 | 0.217 |
reason_noquestion_introvert | 4.035 | 0.133 | 0.515 | 0.072 | -0.047 | 1.077 | 0.287 | 1.797 | -0.426 | 0.702 | -2.604 | 1.752 | 1.111 | -0.383 | -0.347 | 0.192 | 0.267 | -1.303 | -0.961 | 0.041 | 0.471 | -2.042 | -1.024 | 0.189 | 0.780 | -1.312 | 0.217 |
more_comfort_asking_know_speaker_rating | 2.759 | 0.252 | 0.304 | 0.123 | -0.081 | 0.691 | 0.197 | 1.545 | -0.187 | 0.778 | -1.512 | 1.138 | 0.665 | -0.282 | -0.334 | 0.094 | 0.199 | -1.679 | -0.836 | 0.006 | 0.304 | -2.752 | -0.776 | 0.119 | 0.497 | -1.562 | 0.318 |
reason_noquestion_clever | 2.737 | 0.254 | 0.418 | 0.107 | -0.091 | 0.928 | 0.260 | 1.610 | 0.516 | 0.523 | -1.067 | 2.099 | 0.808 | 0.639 | -0.815 | 0.001 | 0.250 | -3.258 | -1.789 | 0.000 | 0.499 | -3.584 | -0.449 | 0.432 | 0.571 | -0.787 | 0.318 |
reason_question_relevance | 1.289 | 0.525 | 0.072 | 0.753 | -0.375 | 0.518 | 0.228 | 0.314 | 0.929 | 0.280 | -0.757 | 2.615 | 0.860 | 1.080 | 0.096 | 0.673 | 0.228 | 0.422 | -0.052 | 0.875 | 0.334 | -0.157 | -1.029 | 0.088 | 0.604 | -1.705 | 0.618 |
reason_question_appreciate | 0.984 | 0.612 | -0.243 | 0.365 | -0.769 | 0.283 | 0.268 | -0.907 | -0.597 | 0.589 | -2.763 | 1.568 | 1.105 | -0.541 | 0.144 | 0.608 | 0.280 | 0.514 | 0.496 | 0.192 | 0.380 | 1.304 | 0.418 | 0.497 | 0.615 | 0.679 | 0.679 |
reason_question_understand | 0.841 | 0.657 | -0.049 | 0.849 | -0.553 | 0.455 | 0.257 | -0.190 | -0.748 | 0.348 | -2.310 | 0.814 | 0.797 | -0.938 | 0.207 | 0.426 | 0.260 | 0.796 | -0.445 | 0.204 | 0.351 | -1.271 | 0.934 | 0.230 | 0.778 | 1.200 | 0.691 |
reason_noquestion_misunderstand | 0.363 | 0.834 | 0.037 | 0.879 | -0.435 | 0.508 | 0.240 | 0.152 | 0.484 | 0.550 | -1.101 | 2.069 | 0.809 | 0.598 | -0.958 | 0.000 | 0.240 | -3.995 | -1.496 | 0.000 | 0.402 | -3.718 | 0.019 | 0.972 | 0.540 | 0.036 | 0.834 |