Packages and Data Description and Formatting

library(pacman); p_load(haven, psych, dplyr, corrr, ggplot2, lavaan, sjmisc, specr, cowplot, ggpubr, pwr, ltm, polycor)

Variables used:

Verbal Ability

  • wordsum: a 10-item verbal IQ measure (higher = smarter)

Tolerance

  • homosex: how wrong is homosexuality (positive)
  • racmar: should racial intermarriage be outlawed (positive)
  • racdin: would respondent object to opposite race at dinner (positive)
  • racfew: would respondent object if a few children at school were opposite race (positive)
  • racmost: would respondent object if most children at school were opposite race (positive)
  • colath: should anti-religionist be allowed to teach (negative)
  • colcom: should communist teacher be fired (positive)
  • colhomo: should homosexual be allowed to teach (negative)
  • colmil: should militarist be allowed to teach (negative)
  • colmslm: should anti-American Muslim clergymen be allowed to teach (negative)
  • colrac: should racist be allowed to teach (negative)
  • libath: should anti-religious book be removed from public library (positive)
  • libcom: should communist book be removed from public library (positive)
  • libhomo: should homosexual book be removed from public library (positive)
  • libmil: should militarist book be removed from public library (positive)
  • libmslm: should anti-America Muslim clergymen book be removed from public library (positive)
  • librac: should racist book be removed from public library (positive)
  • spkath: should anti-religionist be allowed to make speech (negative)
  • spkcom: should communist be allowed to make speech (negative)
  • spkhomo: should homosexual be allowed to make speech (negative)
  • spkmil: should militarist be allowed to make speech (negative)
  • spkmslm: should anti-American Muslim clergymen be allowed to make speech (negative)
  • spkrac: should racist be allowed to make speech (negative)

Though the initial codes above were sensible, for clarity, I reverse-coded all variables where negative relationships would mean a tolerance-wordsum association.

Controls

  • sex
  • race
  • age
  • year
  • reg16: region
  • res16: rural/urban
  • mobile16: geographic mobility

Verbal ability being related to tolerance would be considered correlations that are in the direction indicated by the bracketed (positive) or (negative) notes above. Note that there is considerable attenuation because wordsum only goes 1-10; rescaling will not be granular because of this, but it will make means comparable to the typical IQ scale (mean = 100, sd = 15). The scaled sumscore is dubbed a “Wordsum IQ”. Wordsum represents a combination of general ability, g, verbal ability, specific skills, and error.

retain <- c("homosex", "racmar", "colath", "racdin", "racfew", "racmost", "colcom", "colhomo", "colmil", "colmslm", "colrac", "libath", "libcom", "libhomo", "libmil", "libmslm", "librac", "spkath", "spkcom", "spkhomo", "spkmil", "spkmslm", "spkrac", "wordsum", "sex", "race", "age", "year", "reg16", "res16", "mobile16", "degree", "polviews", "id")

data <- datafull[retain]; data <- zap_labels(data)
data$wordsum <- (scale(data$wordsum) * 15) + 100
#Remove Values

data <- subset(data, homosex <= 4 | is.na(homosex)) #1 = Always wrong, 2 = almost always wrong, 3 = sometimes wrong, 4 = not wrong at all
data <- subset(data, racmar <= 2 | is.na(racmar)) #1 = Yes, 2 = no
data <- subset(data, racdin <= 3 | is.na(racdin)) #1 = Strongly object, 2 = mildly object, 3 = not object
data <- subset(data, racfew <= 2 | is.na(racfew)) #1 = Yes, object, 2 = no
data <- subset(data, racmost <= 2 | is.na(racmost)) #1 = Yes, object, 2 = no
data <- subset(data, colath = 4:5 | is.na(colath)) #4 = Allowed, 5 = not allowed
data <- subset(data, colcom = 4:5 | is.na(colcom)) #4 = Fired, 5 = not fired
data <- subset(data, colhomo = 4:5 | is.na(colhomo)) #4 = Allowed, 5 = not allowed
data <- subset(data, colmil = 4:5 | is.na(colmil)) #4 = Allowed, 5 = not allowed
data <- subset(data, colmslm = 4:5 | is.na(colmslm)) #4 = Yes, allowed, 5 = not allowed
data <- subset(data, colrac = 4:5 | is.na(colrac)) #4 = Allowed, 5 = not allowed
data <- subset(data, libath <= 2 | is.na(libath)) #1 = Remove, 2 = not remove
data <- subset(data, libcom <= 2 | is.na(libcom)) #1 = Remove, 2 = not remove
data <- subset(data, libhomo <= 2 | is.na(libhomo)) #1 = Remove, 2 = not remove
data <- subset(data, libmil <= 2 | is.na(libmil)) #1 = Remove, 2 = not remove
data <- subset(data, libmslm <= 2 | is.na(libmslm)) #1 = Remove, 2 = not remove 
data <- subset(data, librac <= 2 | is.na(librac)) #1 = Remove, 2 = not remove
data <- subset(data, spkath <= 2 | is.na(spkath)) #1 = Allowed, 2 = not allowed
data <- subset(data, spkcom <= 2 | is.na(spkcom)) #1 = Allowed, 2 = not allowed
data <- subset(data, spkhomo <= 2 | is.na(spkhomo)) #1 = Allowed, 2 = not allowed
data <- subset(data, spkmil <= 2 | is.na(spkmil)) #1 = Allowed, 2 = not allowed
data <- subset(data, spkmslm <= 2 | is.na(spkmslm)) #1 = Yes, allowed, 2 = not allowed
data <- subset(data, spkrac <= 2 | is.na(spkrac)) #1 = Allowed, 2 = not allowed
data <- subset(data, degree <= 4 | is.na(degree)) #0 = Less than high school, 1 = high school, 2 = junior college, 3 = bachelor, 4 = graduate
data <- subset(data, polviews <= 7 | is.na(polviews)) #1 = Extremely liberal, 2 = liberal, 3 = slightly liberal, 4 = moderate, 5 = slightly conservative, 6 = conservative, 7 = extremely conservative
data$polcat <- rec(data$polviews, rec = "1,2,3 = 1; 4 = 2; 5, 6, 7 = 3")

#Recode and Create, for Logistic Regressions and Dichotomous Comparisons

data$homosexDI <- rec(data$homosex, rec = "1,2,3 = 0; 4 = 1") #Directionally Correct
data$racmar <- rec(data$racmar, rec = "1 = 0; 2 = 1") #Correct
data$racdinDI <- rec(data$racdin, rec = "1,2 = 0; 3 = 1") #Correct
data$racfew <- rec(data$racfew, rec = "1 = 0; 2 = 1") #Correct
data$racmost <- rec(data$racmost, rec = "1 = 0; 2 = 1") #Correct
data$colath <- rec(data$colath, rec = "4 = 1; 5 = 0") #Reversed
data$colcom <- rec(data$colcom, rec = "4 = 0; 5 = 1") #Correct
data$colhomo <- rec(data$colhomo, rec = "4 = 1; 5 = 0") #Reversed
data$colmil <- rec(data$colmil, rec = "4 = 1; 5 = 0") #Reversed
data$colmslm <- rec(data$colmslm, rec = "4 = 1; 5 = 0") #Reversed
data$colrac <- rec(data$colrac, rec = "4 = 1; 5 = 0") #Reversed
data$libath <- rec(data$libath, rec = "1 = 0; 2 = 1") #Correct
data$libcom <- rec(data$libcom, rec = "1 = 0; 2 = 1") #Correct
data$libhomo <- rec(data$libhomo, rec = "1 = 0; 2 = 1") #Correct
data$libmil <- rec(data$libmil, rec = "1 = 0; 2 = 1") #Correct
data$libmslm <- rec(data$libmslm, rec = "1 = 0; 2 = 1") #Correct
data$librac <- rec(data$librac, rec = "1 = 0; 2 = 1") #Correct
data$spkath <- rec(data$spkath, rec = "1 = 1; 2 = 0") #Reversed
data$spkcom <- rec(data$spkcom, rec = "1 = 1; 2 = 0") #Reversed
data$spkhomo <- rec(data$spkhomo, rec = "1 = 1; 2 = 0") #Reversed
data$spkmil <- rec(data$spkmil, rec = "1 = 1; 2 = 0") #Reversed
data$spkmslm <- rec(data$spkmslm, rec = "1 = 1; 2 = 0") #Reversed
data$spkrac <- rec(data$spkrac, rec = "1 = 1; 2 = 0") #Reversed

#Compute a Tolerance Sumscore

data$Tolerance = (scale(data$homosex) + scale(data$racmar) + scale(data$racdin) + scale(data$racfew) + scale(data$racmost) + scale(data$colath) + scale(data$colcom) + scale(data$colhomo) + scale(data$colmil) + scale(data$colrac) + scale(data$libath) + scale(data$libcom) + scale(data$libhomo) + scale(data$libmil) + scale(data$librac) + scale(data$spkath) + scale(data$spkcom) + scale(data$spkhomo) + scale(data$spkmil) + scale(data$spkrac))/20 #Muslim variables removed since they are only found in some years. Transformations not used for obvious reasons.

Analyses

Rank Correlations between Wordsum IQ and Other Variables

data %>% correlate(method = "spearman") %>% focus(wordsum)
## Warning in stats::cor(x = x, y = y, use = use, method = method): the standard
## deviation is zero

## Warning in stats::cor(x = x, y = y, use = use, method = method): the standard
## deviation is zero
## 
## Correlation method: 'spearman'
## Missing treated using: 'pairwise.complete.obs'
#What is the largest wordsum-dependent variable complete case?

dataWF <- subset(data, !is.na(wordsum))

psych::describe(dataWF)

The smallest test is with colmslm, with 4275 complete responses, and the largest is spkath with 18671 cases. This means that statistical power with an expected r of 0.072 ranges from

pwr.r.test(n = 4275, r = 0.072, sig.level = 0.01, alternative = "two.sided")
## 
##      approximate correlation power calculation (arctangh transformation) 
## 
##               n = 4275
##               r = 0.072
##       sig.level = 0.01
##           power = 0.9837682
##     alternative = two.sided
pwr.r.test(n = 18671, r = 0.072, sig.level = 0.01, alternative = "two.sided")
## 
##      approximate correlation power calculation (arctangh transformation) 
## 
##               n = 18671
##               r = 0.072
##       sig.level = 0.01
##           power = 1
##     alternative = two.sided

But if we wanted to use our smallest sample at 80% power and p = 0.01, what’s the smallest correlation we could detect?

pwr.r.test(n = 4275, power = 0.8, sig.level = 0.01, alternative = "two.sided")
## 
##      approximate correlation power calculation (arctangh transformation) 
## 
##               n = 4275
##               r = 0.05220613
##       sig.level = 0.01
##           power = 0.8
##     alternative = two.sided
round(cor(data, method = "spearman", use = "pairwise.complete"), 3)
## Warning in cor(data, method = "spearman", use = "pairwise.complete"): the
## standard deviation is zero

## Warning in cor(data, method = "spearman", use = "pairwise.complete"): the
## standard deviation is zero
##           homosex racmar colath racdin racfew racmost colcom colhomo colmil
## homosex     1.000  0.265  0.328  0.189  0.064   0.065  0.299   0.412  0.289
## racmar      0.265  1.000  0.301  0.415  0.194   0.138  0.284   0.377  0.229
## colath      0.328  0.301  1.000  0.222  0.086   0.082  0.477   0.455  0.567
## racdin      0.189  0.415  0.222  1.000  0.275   0.191  0.212   0.269  0.178
## racfew      0.064  0.194  0.086  0.275  1.000      NA  0.094   0.120  0.064
## racmost     0.065  0.138  0.082  0.191     NA   1.000  0.099   0.074  0.084
## colcom      0.299  0.284  0.477  0.212  0.094   0.099  1.000   0.395  0.473
## colhomo     0.412  0.377  0.455  0.269  0.120   0.074  0.395   1.000  0.399
## colmil      0.289  0.229  0.567  0.178  0.064   0.084  0.473   0.399  1.000
## colmslm     0.228     NA  0.425     NA     NA      NA  0.400   0.238  0.499
## colrac      0.159  0.099  0.546  0.067  0.013   0.060  0.332   0.272  0.506
## libath      0.319  0.327  0.448  0.218  0.105   0.028  0.372   0.383  0.328
## libcom      0.307  0.343  0.398  0.243  0.125   0.032  0.526   0.393  0.383
## libhomo     0.399  0.350  0.376  0.241  0.106   0.042  0.380   0.567  0.337
## libmil      0.293  0.277  0.373  0.195  0.078   0.011  0.403   0.350  0.505
## libmslm     0.276     NA  0.329     NA     NA      NA  0.387   0.236  0.366
## librac      0.212  0.175  0.316  0.105  0.033  -0.006  0.300   0.250  0.302
## spkath      0.278  0.324  0.517  0.215  0.112   0.038  0.338   0.386  0.340
## spkcom      0.296  0.344  0.430  0.258  0.132   0.061  0.505   0.390  0.404
## spkhomo     0.359  0.376  0.373  0.265  0.132   0.044  0.329   0.693  0.318
## spkmil      0.282  0.265  0.397  0.206  0.076   0.041  0.359   0.343  0.619
## spkmslm     0.267     NA  0.347     NA     NA      NA  0.366   0.244  0.384
## spkrac      0.163  0.149  0.349  0.091  0.031   0.020  0.255   0.230  0.325
## wordsum     0.242  0.216  0.239  0.196  0.116  -0.056  0.233   0.255  0.201
## sex         0.027 -0.025 -0.059  0.026  0.021  -0.025 -0.058   0.015 -0.039
## race       -0.057  0.152 -0.041  0.125  0.002   0.226  0.001   0.002 -0.055
## age        -0.166 -0.264 -0.232 -0.130 -0.064  -0.011 -0.186  -0.189 -0.194
## year        0.278  0.224  0.176  0.104  0.052   0.049  0.185   0.274  0.150
## reg16      -0.058 -0.056 -0.026 -0.067 -0.020   0.026 -0.053  -0.056 -0.011
## res16       0.186  0.205  0.154  0.133  0.039  -0.008  0.142   0.198  0.112
## mobile16    0.061  0.078  0.056  0.086  0.026   0.014  0.059   0.066  0.046
## degree      0.287  0.323  0.302  0.190  0.113  -0.031  0.281   0.318  0.252
## polviews   -0.268 -0.092 -0.131 -0.100 -0.017  -0.062 -0.133  -0.138 -0.108
## id         -0.029  0.002  0.003 -0.021 -0.005   0.029  0.009   0.000  0.003
## polcat     -0.250 -0.081 -0.122 -0.092 -0.010  -0.058 -0.123  -0.126 -0.101
## homosexDI   0.886  0.210  0.289  0.154  0.056   0.076  0.263   0.350  0.259
## racdinDI    0.185  0.398  0.219  0.990  0.249   0.192  0.209   0.264  0.178
## Tolerance   0.546  0.453  0.722  0.307     NA   0.172  0.676   0.680  0.705
##           colmslm colrac libath libcom libhomo libmil libmslm librac spkath
## homosex     0.228  0.159  0.319  0.307   0.399  0.293   0.276  0.212  0.278
## racmar         NA  0.099  0.327  0.343   0.350  0.277      NA  0.175  0.324
## colath      0.425  0.546  0.448  0.398   0.376  0.373   0.329  0.316  0.517
## racdin         NA  0.067  0.218  0.243   0.241  0.195      NA  0.105  0.215
## racfew         NA  0.013  0.105  0.125   0.106  0.078      NA  0.033  0.112
## racmost        NA  0.060  0.028  0.032   0.042  0.011      NA -0.006  0.038
## colcom      0.400  0.332  0.372  0.526   0.380  0.403   0.387  0.300  0.338
## colhomo     0.238  0.272  0.383  0.393   0.567  0.350   0.236  0.250  0.386
## colmil      0.499  0.506  0.328  0.383   0.337  0.505   0.366  0.302  0.340
## colmslm     1.000  0.473  0.286  0.336   0.242  0.318   0.565  0.322  0.288
## colrac      0.473  1.000  0.262  0.255   0.221  0.263   0.278  0.401  0.295
## libath      0.286  0.262  1.000  0.628   0.554  0.561   0.450  0.589  0.509
## libcom      0.336  0.255  0.628  1.000   0.579  0.652   0.530  0.551  0.431
## libhomo     0.242  0.221  0.554  0.579   1.000  0.551   0.398  0.445  0.407
## libmil      0.318  0.263  0.561  0.652   0.551  1.000   0.505  0.522  0.385
## libmslm     0.565  0.278  0.450  0.530   0.398  0.505   1.000  0.491  0.344
## librac      0.322  0.401  0.589  0.551   0.445  0.522   0.491  1.000  0.351
## spkath      0.288  0.295  0.509  0.431   0.407  0.385   0.344  0.351  1.000
## spkcom      0.388  0.299  0.445  0.601   0.424  0.447   0.453  0.362  0.567
## spkhomo     0.218  0.215  0.403  0.409   0.573  0.361   0.260  0.277  0.499
## spkmil      0.344  0.314  0.378  0.430   0.379  0.555   0.379  0.340  0.500
## spkmslm     0.673  0.319  0.342  0.400   0.291  0.376   0.631  0.361  0.402
## spkrac      0.363  0.546  0.328  0.318   0.276  0.314   0.368  0.470  0.505
## wordsum     0.256  0.152  0.283  0.311   0.274  0.280   0.306  0.229  0.284
## sex        -0.090 -0.068 -0.048 -0.056  -0.006 -0.024  -0.071 -0.048 -0.075
## race       -0.102 -0.082 -0.083 -0.072  -0.038 -0.091  -0.119 -0.121 -0.087
## age        -0.031 -0.065 -0.169 -0.174  -0.176 -0.168  -0.027 -0.055 -0.185
## year        0.015  0.032  0.124  0.116   0.198  0.120   0.003  0.014  0.122
## reg16       0.015 -0.020 -0.048 -0.047  -0.051 -0.031   0.027 -0.038 -0.019
## res16       0.064  0.064  0.165  0.160   0.180  0.131   0.091  0.086  0.153
## mobile16    0.038  0.037  0.069  0.077   0.063  0.068   0.048  0.057  0.056
## degree      0.239  0.148  0.306  0.325   0.308  0.287   0.289  0.204  0.301
## polviews   -0.125 -0.052 -0.111 -0.105  -0.123 -0.091  -0.128 -0.063 -0.080
## id         -0.038 -0.018 -0.031 -0.029  -0.020 -0.028  -0.056 -0.036 -0.015
## polcat     -0.113 -0.050 -0.101 -0.094  -0.111 -0.083  -0.118 -0.057 -0.073
## homosexDI   0.221  0.138  0.274  0.262   0.339  0.258   0.267  0.182  0.240
## racdinDI       NA  0.070  0.212  0.236   0.234  0.192      NA  0.104  0.208
## Tolerance      NA  0.615  0.724  0.740   0.722  0.721      NA  0.664  0.687
##           spkcom spkhomo spkmil spkmslm spkrac wordsum    sex   race    age
## homosex    0.296   0.359  0.282   0.267  0.163   0.242  0.027 -0.057 -0.166
## racmar     0.344   0.376  0.265      NA  0.149   0.216 -0.025  0.152 -0.264
## colath     0.430   0.373  0.397   0.347  0.349   0.239 -0.059 -0.041 -0.232
## racdin     0.258   0.265  0.206      NA  0.091   0.196  0.026  0.125 -0.130
## racfew     0.132   0.132  0.076      NA  0.031   0.116  0.021  0.002 -0.064
## racmost    0.061   0.044  0.041      NA  0.020  -0.056 -0.025  0.226 -0.011
## colcom     0.505   0.329  0.359   0.366  0.255   0.233 -0.058  0.001 -0.186
## colhomo    0.390   0.693  0.343   0.244  0.230   0.255  0.015  0.002 -0.189
## colmil     0.404   0.318  0.619   0.384  0.325   0.201 -0.039 -0.055 -0.194
## colmslm    0.388   0.218  0.344   0.673  0.363   0.256 -0.090 -0.102 -0.031
## colrac     0.299   0.215  0.314   0.319  0.546   0.152 -0.068 -0.082 -0.065
## libath     0.445   0.403  0.378   0.342  0.328   0.283 -0.048 -0.083 -0.169
## libcom     0.601   0.409  0.430   0.400  0.318   0.311 -0.056 -0.072 -0.174
## libhomo    0.424   0.573  0.379   0.291  0.276   0.274 -0.006 -0.038 -0.176
## libmil     0.447   0.361  0.555   0.376  0.314   0.280 -0.024 -0.091 -0.168
## libmslm    0.453   0.260  0.379   0.631  0.368   0.306 -0.071 -0.119 -0.027
## librac     0.362   0.277  0.340   0.361  0.470   0.229 -0.048 -0.121 -0.055
## spkath     0.567   0.499  0.500   0.402  0.505   0.284 -0.075 -0.087 -0.185
## spkcom     1.000   0.490  0.550   0.518  0.463   0.315 -0.086 -0.062 -0.160
## spkhomo    0.490   1.000  0.435   0.289  0.333   0.275 -0.002 -0.031 -0.151
## spkmil     0.550   0.435  1.000   0.451  0.460   0.255 -0.033 -0.083 -0.177
## spkmslm    0.518   0.289  0.451   1.000  0.496   0.291 -0.123 -0.123 -0.032
## spkrac     0.463   0.333  0.460   0.496  1.000   0.205 -0.101 -0.092 -0.068
## wordsum    0.315   0.275  0.255   0.291  0.205   1.000  0.021 -0.246  0.069
## sex       -0.086  -0.002 -0.033  -0.123 -0.101   0.021  1.000  0.031  0.029
## race      -0.062  -0.031 -0.083  -0.123 -0.092  -0.246  0.031  1.000 -0.102
## age       -0.160  -0.151 -0.177  -0.032 -0.068   0.069  0.029 -0.102  1.000
## year       0.100   0.207  0.121   0.024  0.000   0.018 -0.001  0.122  0.081
## reg16     -0.032  -0.044  0.007   0.051  0.002  -0.050  0.005  0.021 -0.061
## res16      0.160   0.185  0.119   0.093  0.078   0.140  0.016  0.105 -0.119
## mobile16   0.075   0.062  0.050   0.044  0.038   0.120 -0.001  0.004  0.123
## degree     0.322   0.299  0.281   0.275  0.189   0.458 -0.034 -0.091 -0.107
## polviews  -0.101  -0.108 -0.082  -0.129 -0.047  -0.031 -0.033 -0.092  0.118
## id        -0.026  -0.016 -0.012  -0.050 -0.026  -0.058 -0.005 -0.023  0.037
## polcat    -0.091  -0.097 -0.076  -0.118 -0.043  -0.022 -0.035 -0.091  0.112
## homosexDI  0.256   0.298  0.248   0.256  0.142   0.198  0.033 -0.041 -0.140
## racdinDI   0.251   0.256  0.203      NA  0.091   0.191  0.024  0.124 -0.127
## Tolerance  0.710   0.673  0.696      NA  0.619   0.430 -0.044 -0.077 -0.312
##             year  reg16  res16 mobile16 degree polviews     id polcat homosexDI
## homosex    0.278 -0.058  0.186    0.061  0.287   -0.268 -0.029 -0.250     0.886
## racmar     0.224 -0.056  0.205    0.078  0.323   -0.092  0.002 -0.081     0.210
## colath     0.176 -0.026  0.154    0.056  0.302   -0.131  0.003 -0.122     0.289
## racdin     0.104 -0.067  0.133    0.086  0.190   -0.100 -0.021 -0.092     0.154
## racfew     0.052 -0.020  0.039    0.026  0.113   -0.017 -0.005 -0.010     0.056
## racmost    0.049  0.026 -0.008    0.014 -0.031   -0.062  0.029 -0.058     0.076
## colcom     0.185 -0.053  0.142    0.059  0.281   -0.133  0.009 -0.123     0.263
## colhomo    0.274 -0.056  0.198    0.066  0.318   -0.138  0.000 -0.126     0.350
## colmil     0.150 -0.011  0.112    0.046  0.252   -0.108  0.003 -0.101     0.259
## colmslm    0.015  0.015  0.064    0.038  0.239   -0.125 -0.038 -0.113     0.221
## colrac     0.032 -0.020  0.064    0.037  0.148   -0.052 -0.018 -0.050     0.138
## libath     0.124 -0.048  0.165    0.069  0.306   -0.111 -0.031 -0.101     0.274
## libcom     0.116 -0.047  0.160    0.077  0.325   -0.105 -0.029 -0.094     0.262
## libhomo    0.198 -0.051  0.180    0.063  0.308   -0.123 -0.020 -0.111     0.339
## libmil     0.120 -0.031  0.131    0.068  0.287   -0.091 -0.028 -0.083     0.258
## libmslm    0.003  0.027  0.091    0.048  0.289   -0.128 -0.056 -0.118     0.267
## librac     0.014 -0.038  0.086    0.057  0.204   -0.063 -0.036 -0.057     0.182
## spkath     0.122 -0.019  0.153    0.056  0.301   -0.080 -0.015 -0.073     0.240
## spkcom     0.100 -0.032  0.160    0.075  0.322   -0.101 -0.026 -0.091     0.256
## spkhomo    0.207 -0.044  0.185    0.062  0.299   -0.108 -0.016 -0.097     0.298
## spkmil     0.121  0.007  0.119    0.050  0.281   -0.082 -0.012 -0.076     0.248
## spkmslm    0.024  0.051  0.093    0.044  0.275   -0.129 -0.050 -0.118     0.256
## spkrac     0.000  0.002  0.078    0.038  0.189   -0.047 -0.026 -0.043     0.142
## wordsum    0.018 -0.050  0.140    0.120  0.458   -0.031 -0.058 -0.022     0.198
## sex       -0.001  0.005  0.016   -0.001 -0.034   -0.033 -0.005 -0.035     0.033
## race       0.122  0.021  0.105    0.004 -0.091   -0.092 -0.023 -0.091    -0.041
## age        0.081 -0.061 -0.119    0.123 -0.107    0.118  0.037  0.112    -0.140
## year       1.000  0.008  0.084    0.047  0.222    0.007  0.274  0.005     0.294
## reg16      0.008  1.000 -0.091   -0.158 -0.054    0.039  0.196  0.034    -0.039
## res16      0.084 -0.091  1.000    0.017  0.170   -0.088 -0.194 -0.082     0.164
## mobile16   0.047 -0.158  0.017    1.000  0.149   -0.002 -0.034 -0.001     0.053
## degree     0.222 -0.054  0.170    0.149  1.000   -0.028 -0.008 -0.019     0.244
## polviews   0.007  0.039 -0.088   -0.002 -0.028    1.000  0.066  0.973    -0.243
## id         0.274  0.196 -0.194   -0.034 -0.008    0.066  1.000  0.060    -0.013
## polcat     0.005  0.034 -0.082   -0.001 -0.019    0.973  0.060  1.000    -0.226
## homosexDI  0.294 -0.039  0.164    0.053  0.244   -0.243 -0.013 -0.226     1.000
## racdinDI   0.103 -0.063  0.128    0.086  0.183   -0.100 -0.019 -0.093     0.153
## Tolerance -0.006 -0.112  0.236    0.098  0.436   -0.201 -0.109 -0.186     0.433
##           racdinDI Tolerance
## homosex      0.185     0.546
## racmar       0.398     0.453
## colath       0.219     0.722
## racdin       0.990     0.307
## racfew       0.249        NA
## racmost      0.192     0.172
## colcom       0.209     0.676
## colhomo      0.264     0.680
## colmil       0.178     0.705
## colmslm         NA        NA
## colrac       0.070     0.615
## libath       0.212     0.724
## libcom       0.236     0.740
## libhomo      0.234     0.722
## libmil       0.192     0.721
## libmslm         NA        NA
## librac       0.104     0.664
## spkath       0.208     0.687
## spkcom       0.251     0.710
## spkhomo      0.256     0.673
## spkmil       0.203     0.696
## spkmslm         NA        NA
## spkrac       0.091     0.619
## wordsum      0.191     0.430
## sex          0.024    -0.044
## race         0.124    -0.077
## age         -0.127    -0.312
## year         0.103    -0.006
## reg16       -0.063    -0.112
## res16        0.128     0.236
## mobile16     0.086     0.098
## degree       0.183     0.436
## polviews    -0.100    -0.201
## id          -0.019    -0.109
## polcat      -0.093    -0.186
## homosexDI    0.153     0.433
## racdinDI     1.000     0.304
## Tolerance    0.304     1.000

What if racmost is removed from the sumscore?

data$TolTest = (scale(data$homosex) + scale(data$racmar) + scale(data$racdin) + scale(data$racfew) + scale(data$colath) + scale(data$colcom) + scale(data$colhomo) + scale(data$colmil) + scale(data$colrac) + scale(data$libath) + scale(data$libcom) + scale(data$libhomo) + scale(data$libmil) + scale(data$librac) + scale(data$spkath) + scale(data$spkcom) + scale(data$spkhomo) + scale(data$spkmil) + scale(data$spkrac))/19

cor(data$TolTest, data$wordsum, method = "spearman", use = "complete.obs")
##           [,1]
## [1,] 0.4549631

Biserial Correlations

First, the biserial correlations:

polyserial(data$wordsum, data$homosexDI)
## [1] 0.2665036
polyserial(data$wordsum, data$racmar)
## [1] 0.2986141
polyserial(data$wordsum, data$racdinDI)
## [1] 0.2651545
polyserial(data$wordsum, data$racfew)
## [1] 0.2788201
polyserial(data$wordsum, data$racmost)
## [1] -0.07194818
polyserial(data$wordsum, data$colath)
## [1] 0.2965005
polyserial(data$wordsum, data$colcom)
## [1] 0.2901009
polyserial(data$wordsum, data$colhomo)
## [1] 0.3414164
polyserial(data$wordsum, data$colmil)
## [1] 0.2472782
polyserial(data$wordsum, data$colmslm)
## [1] 0.3299984
polyserial(data$wordsum, data$colrac)
## [1] 0.1882307
polyserial(data$wordsum, data$libath)
## [1] 0.3668813
polyserial(data$wordsum, data$libcom)
## [1] 0.3987142
polyserial(data$wordsum, data$libhomo)
## [1] 0.356505
polyserial(data$wordsum, data$libmil)
## [1] 0.3531073
polyserial(data$wordsum, data$libmslm)
## [1] 0.3812085
polyserial(data$wordsum, data$librac)
## [1] 0.2879645
polyserial(data$wordsum, data$spkath)
## [1] 0.3786574
polyserial(data$wordsum, data$spkcom)
## [1] 0.4015908
polyserial(data$wordsum, data$spkhomo)
## [1] 0.3884629
polyserial(data$wordsum, data$spkmil)
## [1] 0.3211459
polyserial(data$wordsum, data$spkmslm)
## [1] 0.3669985
polyserial(data$wordsum, data$spkrac)
## [1] 0.2636467

Then, these are the point-biserial correlations. Note: I do not believe that tolerance is an A/B, pass/fail, yes/no question, and it is in fact artificially dichotomized for two questions, and those two questions show that intermediate tolerance levels have higher wordsum scores than lower levels, and the highest level of tolerance was in both cases even smarter, so there is some evidence against the use/interpretation of the point-biserial.

biserial.cor(data$wordsum, data$homosexDI, use = "complete.obs", level = 2)
## [1] 0.1960655
biserial.cor(data$wordsum, data$racmar, use = "complete.obs", level = 2)
## [1] 0.2110091
biserial.cor(data$wordsum, data$racdinDI, use = "complete.obs", level = 2)
## [1] 0.1889019
biserial.cor(data$wordsum, data$racfew, use = "complete.obs", level = 2)
## [1] 0.1210425
biserial.cor(data$wordsum, data$racmost, use = "complete.obs", level = 2)
## [1] -0.05651882
biserial.cor(data$wordsum, data$colath, use = "complete.obs", level = 2)
## [1] 0.2359337
biserial.cor(data$wordsum, data$colcom, use = "complete.obs", level = 2)
## [1] 0.2305561
biserial.cor(data$wordsum, data$colhomo, use = "complete.obs", level = 2)
## [1] 0.2580286
biserial.cor(data$wordsum, data$colmil, use = "complete.obs", level = 2)
## [1] 0.1972631
biserial.cor(data$wordsum, data$colmslm, use = "complete.obs", level = 2)
## [1] 0.2541915
biserial.cor(data$wordsum, data$colrac, use = "complete.obs", level = 2)
## [1] 0.1498745
biserial.cor(data$wordsum, data$libath, use = "complete.obs", level = 2)
## [1] 0.2798046
biserial.cor(data$wordsum, data$libcom, use = "complete.obs", level = 2)
## [1] 0.3084304
biserial.cor(data$wordsum, data$libhomo, use = "complete.obs", level = 2)
## [1] 0.2729094
biserial.cor(data$wordsum, data$libmil, use = "complete.obs", level = 2)
## [1] 0.2742104
biserial.cor(data$wordsum, data$libmslm, use = "complete.obs", level = 2)
## [1] 0.3041215
biserial.cor(data$wordsum, data$librac, use = "complete.obs", level = 2)
## [1] 0.2242504
biserial.cor(data$wordsum, data$spkath, use = "complete.obs", level = 2)
## [1] 0.2836143
biserial.cor(data$wordsum, data$spkcom, use = "complete.obs", level = 2)
## [1] 0.312188
biserial.cor(data$wordsum, data$spkhomo, use = "complete.obs", level = 2)
## [1] 0.277902
biserial.cor(data$wordsum, data$spkmil, use = "complete.obs", level = 2)
## [1] 0.2508111
biserial.cor(data$wordsum, data$spkmslm, use = "complete.obs", level = 2)
## [1] 0.2915239
biserial.cor(data$wordsum, data$spkrac, use = "complete.obs", level = 2)
## [1] 0.2072019

Bar Charts

Only the cumulative bar chart is used in the final paper.

HomosexD <- data %>%
  group_by(homosex) %>%
  summarise(
    n = n(),
    mean = mean(wordsum, na.rm = T),
    sd = sd(wordsum, na.rm = T)) %>%
  mutate(se = sd/sqrt(n)) %>% 
  mutate(ic = se * qt((1 - 0.05)/2 + 0.5, n - 1))

HD <- ggplot(HomosexD) + 
  geom_bar(aes(x = homosex, y = mean), stat = "identity", position = "dodge", fill = "steelblue", width = 0.9, alpha = 0.5) + 
  geom_errorbar(aes(x = homosex, ymin = mean - ic, ymax = mean + ic), width = 0.4, color = "orange", alpha = 0.9, size = 1) + 
  theme_bw() + xlab("") + ylab("") + 
  scale_x_continuous(breaks = c(1, 2, 3, 4), labels = c("AW", "AAW", "SW", "NWA")) + 
  theme(axis.title.y = element_text(vjust = 3), axis.title.x = element_text(vjust = -1)); HDD <- HD + ylab("Wordsum IQ") + xlab("Position on Homosexuality") + scale_x_continuous(breaks = c(1, 2, 3, 4), labels = c("Always Wrong", "Almost Always Wrong", "Sometimes Wrong", "Not Wrong at All")); HDD
## Scale for 'x' is already present. Adding another scale for 'x', which will
## replace the existing scale.
## Warning: Removed 1 rows containing missing values (geom_bar).

  homosexDID <- data %>%
  group_by(homosexDI) %>%
  summarise(
    n = n(),
    mean = mean(wordsum, na.rm = T),
    sd = sd(wordsum, na.rm = T)) %>%
  mutate(se = sd/sqrt(n)) %>% 
  mutate(ic = se * qt((1 - 0.05)/2 + 0.5, n - 1))

HDI <- ggplot(homosexDID) + 
  geom_bar(aes(x = homosexDI, y = mean), stat = "identity", position = "dodge", fill = "steelblue", width = 0.9, alpha = 0.5) + 
  geom_errorbar(aes(x = homosexDI, ymin = mean - ic, ymax = mean + ic), width = 0.4, color = "orange", alpha = 0.9, size = 1) + 
  theme_bw() + ylab("") + xlab("") + 
  scale_x_continuous(breaks = c(0, 1), labels = c("Wrong", "Not Wrong")) + 
  theme(axis.title.y = element_text(vjust = 3), axis.title.x = element_text(vjust = -1)); HDID <- HDI + ylab("Wordsum IQ") + xlab("Position on Homosexuality"); HDID
## Warning: Removed 1 rows containing missing values (geom_bar).

  racmarD <- data %>%
  group_by(racmar) %>%
  summarise(
    n = n(),
    mean = mean(wordsum, na.rm = T),
    sd = sd(wordsum, na.rm = T)) %>%
  mutate(se = sd/sqrt(n)) %>% 
  mutate(ic = se * qt((1 - 0.05)/2 + 0.5, n - 1))

RD <- ggplot(racmarD) + 
  geom_bar(aes(x = racmar, y = mean), stat = "identity", position = "dodge", fill = "lightgreen", width = 0.9, alpha = 0.5) + 
  geom_errorbar(aes(x = racmar, ymin = mean - ic, ymax = mean + ic), width = 0.4, color = "violet", alpha = 0.9, size = 1) + 
  theme_bw() + ylab("") + xlab("") + 
  scale_x_continuous(breaks = c(0, 1), labels = c("Support", "Oppose")) + 
  theme(axis.title.y = element_text(vjust = 3), axis.title.x = element_text(vjust = -1)); RDD <- RD + ylab("Wordsum IQ") + xlab("Position on Laws Against Racial Intermarriage"); RDD
## Warning: Removed 1 rows containing missing values (geom_bar).

  colathD <- data %>%
  group_by(colath) %>%
  summarise(
    n = n(),
    mean = mean(wordsum, na.rm = T),
    sd = sd(wordsum, na.rm = T)) %>%
  mutate(se = sd/sqrt(n)) %>% 
  mutate(ic = se * qt((1 - 0.05)/2 + 0.5, n - 1))

CA <- ggplot(colathD) + 
  geom_bar(aes(x = colath, y = mean), stat = "identity", position = "dodge", fill = "orangered", width = 0.9, alpha = 0.5) + 
  geom_errorbar(aes(x = colath, ymin = mean - ic, ymax = mean + ic), width = 0.4, color = "steelblue", alpha = 0.9, size = 1) + 
  theme_bw() + ylab("") + xlab("") + 
  scale_x_continuous(breaks = c(0, 1), labels = c("Disallow", "Allow")) + 
  theme(axis.title.y = element_text(vjust = 3), axis.title.x = element_text(vjust = -1)); CAD <- CA + ylab("Wordsum IQ") + xlab("Position on Whether Anti-Religionists Should be Allowed to Teach"); CAD
## Warning: Removed 1 rows containing missing values (geom_bar).

  colcomD <- data %>%
  group_by(colcom) %>%
  summarise(
    n = n(),
    mean = mean(wordsum, na.rm = T),
    sd = sd(wordsum, na.rm = T)) %>%
  mutate(se = sd/sqrt(n)) %>% 
  mutate(ic = se * qt((1 - 0.05)/2 + 0.5, n - 1))

CC <- ggplot(colcomD) + 
  geom_bar(aes(x = colcom, y = mean), stat = "identity", position = "dodge", fill = "orangered", width = 0.9, alpha = 0.5) + 
  geom_errorbar(aes(x = colcom, ymin = mean - ic, ymax = mean + ic), width = 0.4, color = "steelblue", alpha = 0.9, size = 1) + 
  theme_bw() + ylab("") + xlab("") + 
  scale_x_continuous(breaks = c(0, 1), labels = c("Fire", "Do Not Fire")) + 
  theme(axis.title.y = element_text(vjust = 3), axis.title.x = element_text(vjust = -1)); CCD <- CC + ylab("Wordsum IQ") + xlab("Position on Whether Communists Should be Allowed to Teach")
  
  colhomoD <- data %>%
  group_by(colhomo) %>%
  summarise(
    n = n(),
    mean = mean(wordsum, na.rm = T),
    sd = sd(wordsum, na.rm = T)) %>%
  mutate(se = sd/sqrt(n)) %>% 
  mutate(ic = se * qt((1 - 0.05)/2 + 0.5, n - 1))

CH <- ggplot(colhomoD) + 
  geom_bar(aes(x = colhomo, y = mean), stat = "identity", position = "dodge", fill = "orangered", width = 0.9, alpha = 0.5) + 
  geom_errorbar(aes(x = colhomo, ymin = mean - ic, ymax = mean + ic), width = 0.4, color = "steelblue", alpha = 0.9, size = 1) + 
  theme_bw() + ylab("") + xlab("") + 
  scale_x_continuous(breaks = c(0, 1), labels = c("Disallow", "Allow")) + 
  theme(axis.title.y = element_text(vjust = 3), axis.title.x = element_text(vjust = -1)); CHD <- CH + ylab("Wordsum IQ") + xlab("Position on Whether Homosexuals Should be Allowed to Teach"); CHD
## Warning: Removed 1 rows containing missing values (geom_bar).

  colmilD <- data %>%
  group_by(colmil) %>%
  summarise(
    n = n(),
    mean = mean(wordsum, na.rm = T),
    sd = sd(wordsum, na.rm = T)) %>%
  mutate(se = sd/sqrt(n)) %>% 
  mutate(ic = se * qt((1 - 0.05)/2 + 0.5, n - 1))

CM <- ggplot(colmilD) + 
  geom_bar(aes(x = colmil, y = mean), stat = "identity", position = "dodge", fill = "orangered", width = 0.9, alpha = 0.5) + 
  geom_errorbar(aes(x = colmil, ymin = mean - ic, ymax = mean + ic), width = 0.4, color = "steelblue", alpha = 0.9, size = 1) + 
  theme_bw() + ylab("") + xlab("") + 
  scale_x_continuous(breaks = c(0, 1), labels = c("Disallow", "Allow")) + 
  theme(axis.title.y = element_text(vjust = 3), axis.title.x = element_text(vjust = -1)); CMD <- CM + ylab("Wordsum IQ") + xlab("Position on Whether Militarists Should be Allowed to Teach"); CMD
## Warning: Removed 1 rows containing missing values (geom_bar).

  colmslmD <- data %>%
  group_by(colmslm) %>%
  summarise(
    n = n(),
    mean = mean(wordsum, na.rm = T),
    sd = sd(wordsum, na.rm = T)) %>%
  mutate(se = sd/sqrt(n)) %>% 
  mutate(ic = se * qt((1 - 0.05)/2 + 0.5, n - 1))

CU <- ggplot(colmslmD) + 
  geom_bar(aes(x = colmslm, y = mean), stat = "identity", position = "dodge", fill = "orangered", width = 0.9, alpha = 0.5) + 
  geom_errorbar(aes(x = colmslm, ymin = mean - ic, ymax = mean + ic), width = 0.4, color = "steelblue", alpha = 0.9, size = 1) + 
  theme_bw() + ylab("") + xlab("") + 
  scale_x_continuous(breaks = c(0, 1), labels = c("Disallow", "Allow")) + 
  theme(axis.title.y = element_text(vjust = 3), axis.title.x = element_text(vjust = -1)); CUD <- CU + ylab("Wordsum IQ") + xlab("Position on Whether Anti-American Muslim Clerics Should be Allowed to Teach"); CUD 
## Warning: Removed 1 rows containing missing values (geom_bar).

  colracD <- data %>%
  group_by(colrac) %>%
  summarise(
    n = n(),
    mean = mean(wordsum, na.rm = T),
    sd = sd(wordsum, na.rm = T)) %>%
  mutate(se = sd/sqrt(n)) %>% 
  mutate(ic = se * qt((1 - 0.05)/2 + 0.5, n - 1))

CR <- ggplot(colracD) + 
  geom_bar(aes(x = colrac, y = mean), stat = "identity", position = "dodge", fill = "orangered", width = 0.9, alpha = 0.5) + 
  geom_errorbar(aes(x = colrac, ymin = mean - ic, ymax = mean + ic), width = 0.4, color = "steelblue", alpha = 0.9, size = 1) + 
  theme_bw() + ylab("") + xlab("") + 
  scale_x_continuous(breaks = c(0, 1), labels = c("Disallow", "Allow")) + 
  theme(axis.title.y = element_text(vjust = 3), axis.title.x = element_text(vjust = -1)); CRD <- CR + ylab("Wordsum IQ") + xlab("Position on Whether Racists Should be Allowed to Teach"); CRD
## Warning: Removed 1 rows containing missing values (geom_bar).

  racdinD <- data %>%
  group_by(racdin) %>%
  summarise(
    n = n(),
    mean = mean(wordsum, na.rm = T),
    sd = sd(wordsum, na.rm = T)) %>%
  mutate(se = sd/sqrt(n)) %>% 
  mutate(ic = se * qt((1 - 0.05)/2 + 0.5, n - 1))

CRA <- ggplot(racdinD) + 
  geom_bar(aes(x = racdin, y = mean), stat = "identity", position = "dodge", fill = "gold", width = 0.9, alpha = 0.5) + 
  geom_errorbar(aes(x = racdin, ymin = mean - ic, ymax = mean + ic), width = 0.4, color = "steelblue", alpha = 0.9, size = 1) + 
  theme_bw() + ylab("") + xlab("") + 
  scale_x_continuous(breaks = c(1, 2, 3), labels = c("Strongly Object", "Mildly Object", "Not Object")) + 
  theme(axis.title.y = element_text(vjust = 3), axis.title.x = element_text(vjust = -1)); CRAD <- CRA + ylab("Wordsum IQ") + xlab("If Respondent would Object to a Member of Another Race at Dinner"); CRAD
## Warning: Removed 1 rows containing missing values (geom_bar).

  racdinDID <- data %>%
  group_by(racdinDI) %>%
  summarise(
    n = n(),
    mean = mean(wordsum, na.rm = T),
    sd = sd(wordsum, na.rm = T)) %>%
  mutate(se = sd/sqrt(n)) %>% 
  mutate(ic = se * qt((1 - 0.05)/2 + 0.5, n - 1))

CRD <- ggplot(racdinDID) + 
  geom_bar(aes(x = racdinDI, y = mean), stat = "identity", position = "dodge", fill = "gold", width = 0.9, alpha = 0.5) + 
  geom_errorbar(aes(x = racdinDI, ymin = mean - ic, ymax = mean + ic), width = 0.4, color = "steelblue", alpha = 0.9, size = 1) + 
  theme_bw() + ylab("") + xlab("") + 
  scale_x_continuous(breaks = c(0, 1), labels = c("Object", "Not Object")) + 
  theme(axis.title.y = element_text(vjust = 3), axis.title.x = element_text(vjust = -1)); CRDD <- CRD + ylab("Wordsum IQ") + xlab("If Respondent would Object to a Member of Another Race at Dinner"); CRDD
## Warning: Removed 1 rows containing missing values (geom_bar).

  racfewD <- data %>%
  group_by(racfew) %>%
  summarise(
    n = n(),
    mean = mean(wordsum, na.rm = T),
    sd = sd(wordsum, na.rm = T)) %>%
  mutate(se = sd/sqrt(n)) %>% 
  mutate(ic = se * qt((1 - 0.05)/2 + 0.5, n - 1))

RF <- ggplot(racfewD) + 
  geom_bar(aes(x = racfew, y = mean), stat = "identity", position = "dodge", fill = "indianred4", width = 0.9, alpha = 0.5) + 
  geom_errorbar(aes(x = racfew, ymin = mean - ic, ymax = mean + ic), width = 0.4, color = "snow4", alpha = 0.9, size = 1) + 
  theme_bw() + ylab("") + xlab("") + 
  scale_x_continuous(breaks = c(0, 1), labels = c("Yes, Object", "Do not Object")) + 
  theme(axis.title.y = element_text(vjust = 3), axis.title.x = element_text(vjust = -1)); RFD <- RF + ylab("Wordsum IQ") + xlab("If Respondent would Object to Sending their Children to School with a Few Members of Other Races"); RFD
## Warning: Removed 1 rows containing missing values (geom_bar).

  racmostD <- data %>%
  group_by(racmost) %>%
  summarise(
    n = n(),
    mean = mean(wordsum, na.rm = T),
    sd = sd(wordsum, na.rm = T)) %>%
  mutate(se = sd/sqrt(n)) %>% 
  mutate(ic = se * qt((1 - 0.05)/2 + 0.5, n - 1))

RM <- ggplot(racmostD) + 
  geom_bar(aes(x = racmost, y = mean), stat = "identity", position = "dodge", fill = "indianred4", width = 0.9, alpha = 0.5) + 
  geom_errorbar(aes(x = racmost, ymin = mean - ic, ymax = mean + ic), width = 0.4, color = "snow4", alpha = 0.9, size = 1) + 
  theme_bw() + ylab("") + xlab("") + 
  scale_x_continuous(breaks = c(0, 1), labels = c("Yes, Object", "Do not Object")) + 
  theme(axis.title.y = element_text(vjust = 3), axis.title.x = element_text(vjust = -1)); RMD <- RM + ylab("Wordsum IQ") + xlab("If Respondent would Object to Sending their Children to a School that is Mostly Racially Different"); RMD
## Warning: Removed 1 rows containing missing values (geom_bar).

  libathD <- data %>%
  group_by(libath) %>%
  summarise(
    n = n(),
    mean = mean(wordsum, na.rm = T),
    sd = sd(wordsum, na.rm = T)) %>%
  mutate(se = sd/sqrt(n)) %>% 
  mutate(ic = se * qt((1 - 0.05)/2 + 0.5, n - 1))

LA <- ggplot(libathD) + 
  geom_bar(aes(x = libath, y = mean), stat = "identity", position = "dodge", fill = "#cc6699", width = 0.9, alpha = 0.5) + 
  geom_errorbar(aes(x = libath, ymin = mean - ic, ymax = mean + ic), width = 0.4, color = "#3399ff", alpha = 0.9, size = 1) + 
  theme_bw() + ylab("") + xlab("") + 
  scale_x_continuous(breaks = c(0, 1), labels = c("Remove", "Do not Remove")) + 
  theme(axis.title.y = element_text(vjust = 3), axis.title.x = element_text(vjust = -1)); LAD <- LA + ylab("Wordsum IQ") + xlab("Position on if Anti-Religious Books should remain in Public Libraries"); LAD
## Warning: Removed 1 rows containing missing values (geom_bar).

  libcomD <- data %>%
  group_by(libcom) %>%
  summarise(
    n = n(),
    mean = mean(wordsum, na.rm = T),
    sd = sd(wordsum, na.rm = T)) %>%
  mutate(se = sd/sqrt(n)) %>% 
  mutate(ic = se * qt((1 - 0.05)/2 + 0.5, n - 1))

LC <- ggplot(libcomD) + 
  geom_bar(aes(x = libcom, y = mean), stat = "identity", position = "dodge", fill = "#cc6699", width = 0.9, alpha = 0.5) + 
  geom_errorbar(aes(x = libcom, ymin = mean - ic, ymax = mean + ic), width = 0.4, color = "#3399ff", alpha = 0.9, size = 1) + 
  theme_bw() + ylab("") + xlab("") + 
  scale_x_continuous(breaks = c(0, 1), labels = c("Remove", "Do not Remove")) + 
  theme(axis.title.y = element_text(vjust = 3), axis.title.x = element_text(vjust = -1)); LCD <- LC + ylab("Wordsum IQ") + xlab("Position on if Communisted-authored Books should remain in Public Libraries"); LCD
## Warning: Removed 1 rows containing missing values (geom_bar).

  libhomoD <- data %>%
  group_by(libhomo) %>%
  summarise(
    n = n(),
    mean = mean(wordsum, na.rm = T),
    sd = sd(wordsum, na.rm = T)) %>%
  mutate(se = sd/sqrt(n)) %>% 
  mutate(ic = se * qt((1 - 0.05)/2 + 0.5, n - 1))

LH <- ggplot(libhomoD) + 
  geom_bar(aes(x = libhomo, y = mean), stat = "identity", position = "dodge", fill = "#cc6699", width = 0.9, alpha = 0.5) + 
  geom_errorbar(aes(x = libhomo, ymin = mean - ic, ymax = mean + ic), width = 0.4, color = "#3399ff", alpha = 0.9, size = 1) + 
  theme_bw() + ylab("") + xlab("") + 
  scale_x_continuous(breaks = c(0, 1), labels = c("Remove", "Do not Remove")) + 
  theme(axis.title.y = element_text(vjust = 3), axis.title.x = element_text(vjust = -1)); LHD <- LH + ylab("Wordsum IQ") + xlab("Position on if Pro-Homosexual Books should remain in Public Libraries"); LHD
## Warning: Removed 1 rows containing missing values (geom_bar).

  libmilD <- data %>%
  group_by(libmil) %>%
  summarise(
    n = n(),
    mean = mean(wordsum, na.rm = T),
    sd = sd(wordsum, na.rm = T)) %>%
  mutate(se = sd/sqrt(n)) %>% 
  mutate(ic = se * qt((1 - 0.05)/2 + 0.5, n - 1))

LM <- ggplot(libmilD) + 
  geom_bar(aes(x = libmil, y = mean), stat = "identity", position = "dodge", fill = "#cc6699", width = 0.9, alpha = 0.5) + 
  geom_errorbar(aes(x = libmil, ymin = mean - ic, ymax = mean + ic), width = 0.4, color = "#3399ff", alpha = 0.9, size = 1) + 
  theme_bw() + ylab("") + xlab("") + 
  scale_x_continuous(breaks = c(0, 1), labels = c("Remove", "Do not Remove")) + 
  theme(axis.title.y = element_text(vjust = 3), axis.title.x = element_text(vjust = -1)); LMD <- LM + ylab("Wordsum IQ") + xlab("Position on if Militarist Books should remain in Public Libraries"); LMD
## Warning: Removed 1 rows containing missing values (geom_bar).

  libmslmD <- data %>%
  group_by(libmslm) %>%
  summarise(
    n = n(),
    mean = mean(wordsum, na.rm = T),
    sd = sd(wordsum, na.rm = T)) %>%
  mutate(se = sd/sqrt(n)) %>% 
  mutate(ic = se * qt((1 - 0.05)/2 + 0.5, n - 1))

LU <- ggplot(libmslmD) + 
  geom_bar(aes(x = libmslm, y = mean), stat = "identity", position = "dodge", fill = "#cc6699", width = 0.9, alpha = 0.5) + 
  geom_errorbar(aes(x = libmslm, ymin = mean - ic, ymax = mean + ic), width = 0.4, color = "#3399ff", alpha = 0.9, size = 1) + 
  theme_bw() + ylab("") + xlab("") + 
  scale_x_continuous(breaks = c(0, 1), labels = c("Remove", "Do not Remove")) + 
  theme(axis.title.y = element_text(vjust = 3), axis.title.x = element_text(vjust = -1)); LUD <- LU + ylab("Wordsum IQ") + xlab("Position on if Anti-American Muslim Clergyman Books should remain in Public Libraries"); LUD
## Warning: Removed 1 rows containing missing values (geom_bar).

  libracD <- data %>%
  group_by(librac) %>%
  summarise(
    n = n(),
    mean = mean(wordsum, na.rm = T),
    sd = sd(wordsum, na.rm = T)) %>%
  mutate(se = sd/sqrt(n)) %>% 
  mutate(ic = se * qt((1 - 0.05)/2 + 0.5, n - 1))

LR <- ggplot(libracD) + 
  geom_bar(aes(x = librac, y = mean), stat = "identity", position = "dodge", fill = "#cc6699", width = 0.9, alpha = 0.5) + 
  geom_errorbar(aes(x = librac, ymin = mean - ic, ymax = mean + ic), width = 0.4, color = "#3399ff", alpha = 0.9, size = 1) + 
  theme_bw() + ylab("") + xlab("") + 
  scale_x_continuous(breaks = c(0, 1), labels = c("Remove", "Do not Remove")) + 
  theme(axis.title.y = element_text(vjust = 3), axis.title.x = element_text(vjust = -1)); LRD <- LR + ylab("Wordsum IQ") + xlab("Position on if Racist Books should remain in Public Libraries"); LRD
## Warning: Removed 1 rows containing missing values (geom_bar).

  spkathD <- data %>%
  group_by(spkath) %>%
  summarise(
    n = n(),
    mean = mean(wordsum, na.rm = T),
    sd = sd(wordsum, na.rm = T)) %>%
  mutate(se = sd/sqrt(n)) %>% 
  mutate(ic = se * qt((1 - 0.05)/2 + 0.5, n - 1))

SA <- ggplot(spkathD) + 
  geom_bar(aes(x = spkath, y = mean), stat = "identity", position = "dodge", fill = "#009999", width = 0.9, alpha = 0.5) + 
  geom_errorbar(aes(x = spkath, ymin = mean - ic, ymax = mean + ic), width = 0.4, color = "#666699", alpha = 0.9, size = 1) + 
  theme_bw() + ylab("") + xlab("") + 
  scale_x_continuous(breaks = c(0, 1), labels = c("Disallowed", "Allowed")) + 
  theme(axis.title.y = element_text(vjust = 3), axis.title.x = element_text(vjust = -1)); SAD <- SA + ylab("Wordsum IQ") + xlab("Position on if Anti-Religious Speakers should be Allowed to make a Public Speech"); SAD
## Warning: Removed 1 rows containing missing values (geom_bar).

  spkcomD <- data %>%
  group_by(spkcom) %>%
  summarise(
    n = n(),
    mean = mean(wordsum, na.rm = T),
    sd = sd(wordsum, na.rm = T)) %>%
  mutate(se = sd/sqrt(n)) %>% 
  mutate(ic = se * qt((1 - 0.05)/2 + 0.5, n - 1))

SC <- ggplot(spkcomD) + 
  geom_bar(aes(x = spkcom, y = mean), stat = "identity", position = "dodge", fill = "#009999", width = 0.9, alpha = 0.5) + 
  geom_errorbar(aes(x = spkcom, ymin = mean - ic, ymax = mean + ic), width = 0.4, color = "#666699", alpha = 0.9, size = 1) + 
  theme_bw() + ylab("") + xlab("") + 
  scale_x_continuous(breaks = c(0, 1), labels = c("Disallowed", "Allowed")) + 
  theme(axis.title.y = element_text(vjust = 3), axis.title.x = element_text(vjust = -1)); SCD <- SC + ylab("Wordsum IQ") + xlab("Position on if Communist Speakers should be Allowed to make a Public Speech"); SCD
## Warning: Removed 1 rows containing missing values (geom_bar).

  spkhomoD <- data %>%
  group_by(spkhomo) %>%
  summarise(
    n = n(),
    mean = mean(wordsum, na.rm = T),
    sd = sd(wordsum, na.rm = T)) %>%
  mutate(se = sd/sqrt(n)) %>% 
  mutate(ic = se * qt((1 - 0.05)/2 + 0.5, n - 1))

SH <- ggplot(spkhomoD) + 
  geom_bar(aes(x = spkhomo, y = mean), stat = "identity", position = "dodge", fill = "#009999", width = 0.9, alpha = 0.5) + 
  geom_errorbar(aes(x = spkhomo, ymin = mean - ic, ymax = mean + ic), width = 0.4, color = "#666699", alpha = 0.9, size = 1) + 
  theme_bw() + ylab("") + xlab("") + 
  scale_x_continuous(breaks = c(0, 1), labels = c("Disallowed", "Allowed")) + 
  theme(axis.title.y = element_text(vjust = 3), axis.title.x = element_text(vjust = -1)); SHD <- SH + ylab("Wordsum IQ") + xlab("Position on if Pro-Homosexual Speakers should be Allowed to make a Public Speech"); SHD
## Warning: Removed 1 rows containing missing values (geom_bar).

  spkmilD <- data %>%
  group_by(spkmil) %>%
  summarise(
    n = n(),
    mean = mean(wordsum, na.rm = T),
    sd = sd(wordsum, na.rm = T)) %>%
  mutate(se = sd/sqrt(n)) %>% 
  mutate(ic = se * qt((1 - 0.05)/2 + 0.5, n - 1))

SM <- ggplot(spkmilD) + 
  geom_bar(aes(x = spkmil, y = mean), stat = "identity", position = "dodge", fill = "#009999", width = 0.9, alpha = 0.5) + 
  geom_errorbar(aes(x = spkmil, ymin = mean - ic, ymax = mean + ic), width = 0.4, color = "#666699", alpha = 0.9, size = 1) + 
  theme_bw() + ylab("") + xlab("") + 
  scale_x_continuous(breaks = c(0, 1), labels = c("Disallowed", "Allowed")) + 
  theme(axis.title.y = element_text(vjust = 3), axis.title.x = element_text(vjust = -1)); SMD <- SM + ylab("Wordsum IQ") + xlab("Position on if Militarist Speakers should be Allowed to make a Public Speech"); SMD
## Warning: Removed 1 rows containing missing values (geom_bar).

  spkmslmD <- data %>%
  group_by(spkmslm) %>%
  summarise(
    n = n(),
    mean = mean(wordsum, na.rm = T),
    sd = sd(wordsum, na.rm = T)) %>%
  mutate(se = sd/sqrt(n)) %>% 
  mutate(ic = se * qt((1 - 0.05)/2 + 0.5, n - 1))

SU <- ggplot(spkmslmD) + 
  geom_bar(aes(x = spkmslm, y = mean), stat = "identity", position = "dodge", fill = "#009999", width = 0.9, alpha = 0.5) + 
  geom_errorbar(aes(x = spkmslm, ymin = mean - ic, ymax = mean + ic), width = 0.4, color = "#666699", alpha = 0.9, size = 1) + 
  theme_bw() + ylab("") + xlab("") + 
  scale_x_continuous(breaks = c(0, 1), labels = c("Disallowed", "Allowed")) + 
  theme(axis.title.y = element_text(vjust = 3), axis.title.x = element_text(vjust = -1)); SUD <- SU + ylab("Wordsum IQ") + xlab("Position on if Anti-American Muslim Clergyman Speakers should be Allowed to make a Public Speech"); SUD
## Warning: Removed 1 rows containing missing values (geom_bar).

  spkracD <- data %>%
  group_by(spkrac) %>%
  summarise(
    n = n(),
    mean = mean(wordsum, na.rm = T),
    sd = sd(wordsum, na.rm = T)) %>%
  mutate(se = sd/sqrt(n)) %>% 
  mutate(ic = se * qt((1 - 0.05)/2 + 0.5, n - 1))

SR <- ggplot(spkracD) + 
  geom_bar(aes(x = spkrac, y = mean), stat = "identity", position = "dodge", fill = "#009999", width = 0.9, alpha = 0.5) + 
  geom_errorbar(aes(x = spkrac, ymin = mean - ic, ymax = mean + ic), width = 0.4, color = "#666699", alpha = 0.9, size = 1) + 
  theme_bw() + ylab("") + xlab("") + 
  scale_x_continuous(breaks = c(0, 1), labels = c("Disallowed", "Allowed")) + 
  theme(axis.title.y = element_text(vjust = 3), axis.title.x = element_text(vjust = -1)); SRD <- SR + ylab("Wordsum IQ") + xlab("Position on if Racist Speakers should be Allowed to make a Public Speech"); SRD
## Warning: Removed 1 rows containing missing values (geom_bar).

ggarrange(HD, HDI, RD, CA, CC, CH, CM, CU, CR, CRA , CRD, RF, RM, LA, LC, LH, LM, LU, LR, SA, SC, SH, SM, SU, SR)
## Warning: Removed 1 rows containing missing values (geom_bar).

## Warning: Removed 1 rows containing missing values (geom_bar).

## Warning: Removed 1 rows containing missing values (geom_bar).

## Warning: Removed 1 rows containing missing values (geom_bar).

## Warning: Removed 1 rows containing missing values (geom_bar).

## Warning: Removed 1 rows containing missing values (geom_bar).

## Warning: Removed 1 rows containing missing values (geom_bar).

## Warning: Removed 1 rows containing missing values (geom_bar).

## Warning: Removed 1 rows containing missing values (geom_bar).

## Warning: Removed 1 rows containing missing values (geom_bar).

## Warning: Removed 1 rows containing missing values (geom_bar).

## Warning: Removed 1 rows containing missing values (geom_bar).

## Warning: Removed 1 rows containing missing values (geom_bar).

## Warning: Removed 1 rows containing missing values (geom_bar).

## Warning: Removed 1 rows containing missing values (geom_bar).

## Warning: Removed 1 rows containing missing values (geom_bar).

## Warning: Removed 1 rows containing missing values (geom_bar).

## Warning: Removed 1 rows containing missing values (geom_bar).

## Warning: Removed 1 rows containing missing values (geom_bar).

## Warning: Removed 1 rows containing missing values (geom_bar).

## Warning: Removed 1 rows containing missing values (geom_bar).

## Warning: Removed 1 rows containing missing values (geom_bar).

## Warning: Removed 1 rows containing missing values (geom_bar).

## Warning: Removed 1 rows containing missing values (geom_bar).

## Warning: Removed 1 rows containing missing values (geom_bar).

Wordsum Differences by Tolerance

psych::cohen.d(data$wordsum, data$homosexDI)$cohen.d[,2]
##    effect 
## 0.4598247
psych::cohen.d(data$wordsum, data$racmar)$cohen.d[,2]
##    effect 
## 0.5311738
psych::cohen.d(data$wordsum, data$racdinDI)$cohen.d[,2]
##    effect 
## 0.4669406
psych::cohen.d(data$wordsum, data$racfew)$cohen.d[,2]
##    effect 
## 0.6338781
psych::cohen.d(data$wordsum, data$racmost)$cohen.d[,2]
##     effect 
## -0.1163406
psych::cohen.d(data$wordsum, data$colath)$cohen.d[,2]
##    effect 
## 0.4878822
psych::cohen.d(data$wordsum, data$colcom)$cohen.d[,2]
##    effect 
## 0.4771611
psych::cohen.d(data$wordsum, data$colhomo)$cohen.d[,2]
##    effect 
## 0.5867238
psych::cohen.d(data$wordsum, data$colmil)$cohen.d[,2]
##    effect 
## 0.4025638
psych::cohen.d(data$wordsum, data$colmslm)$cohen.d[,2]
##    effect 
## 0.5588219
psych::cohen.d(data$wordsum, data$colrac)$cohen.d[,2]
##   effect 
## 0.304279
psych::cohen.d(data$wordsum, data$libath)$cohen.d[,2]
##    effect 
## 0.6303764
psych::cohen.d(data$wordsum, data$libcom)$cohen.d[,2]
##    effect 
## 0.6843602
psych::cohen.d(data$wordsum, data$libhomo)$cohen.d[,2]
##    effect 
## 0.6096453
psych::cohen.d(data$wordsum, data$libmil)$cohen.d[,2]
##    effect 
## 0.5978203
psych::cohen.d(data$wordsum, data$libmslm)$cohen.d[,2]
##    effect 
## 0.6386289
psych::cohen.d(data$wordsum, data$librac)$cohen.d[,2]
##    effect 
## 0.4801116
psych::cohen.d(data$wordsum, data$spkath)$cohen.d[,2]
##    effect 
## 0.6597864
psych::cohen.d(data$wordsum, data$spkcom)$cohen.d[,2]
##    effect 
## 0.6877138
psych::cohen.d(data$wordsum, data$spkhomo)$cohen.d[,2]
##    effect 
## 0.6973724
psych::cohen.d(data$wordsum, data$spkmil)$cohen.d[,2]
##    effect 
## 0.5378884
psych::cohen.d(data$wordsum, data$spkmslm)$cohen.d[,2]
##    effect 
## 0.6142829
psych::cohen.d(data$wordsum, data$spkrac)$cohen.d[,2]
##    effect 
## 0.4349318

Verbal IQ and a Tolerance Sumscore

ggplot(data, aes(x = Tolerance, y = wordsum)) + geom_point(color = "#cc6699", alpha = 0.9, position = "jitter") + 
  geom_smooth(method = "gam", color = "#3399ff") + 
  geom_smooth(method = "lm", color = "orangered", formula = "y ~ x") + 
  geom_smooth(method = "loess", color = "gold") + 
  theme_bw() + 
  ylab("Wordsum IQ") + xlab("Tolerance") + 
  theme(axis.title.y = element_text(vjust = 3), axis.title.x = element_text(vjust = -1))
## `geom_smooth()` using formula 'y ~ s(x, bs = "cs")'
## Warning: Removed 63707 rows containing non-finite values (stat_smooth).

## Warning: Removed 63707 rows containing non-finite values (stat_smooth).
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 63707 rows containing non-finite values (stat_smooth).
## Warning: Removed 63707 rows containing missing values (geom_point).

Specification Curve Analysis

Linear models - not admissible. Political views had to be trichotomized because analyses were not possible with all seven categories, regardless of whether they were used for subsetting (as is best) or a continuous control. This is unfortunate, but a reality required to conduct estimation, and it should provide asymptotically very similar results regardless. Even more unfortunately, the trichotomized political views variable, polcat, had to be used as a control rather than for subsetting, lest estimation with it become impossible.

ControlSet <- run_specs(df = data,
                        y = c("homosex", "racmar", "colath", "racdin", "racfew", "racmost", "colcom", "colhomo", "colmil", "colmslm", "colrac", "libcom", "libhomo", "libmil", "libmslm", "librac", "spkath", "spkcom", "spkhomo", "spkmil", "spkmslm", "spkrac"),
                        x = c("wordsum"),
                        model = c("glm"),
                        controls = c("age", "year", "reg16", "res16", "mobile16", "degree", "polcat"),
                        subsets = list(sex = unique(data$sex),
                                       race = unique(data$race)))

head(ControlSet)
plot_specs(ControlSet, choices = c("x", "y", "controls", "subsets"))

pc <- plot_curve(ControlSet,
                 ci = T,
                 ribbon = F) + 
  geom_hline(yintercept = 0,
             linetype = "dashed",
             color = "black") +
  labs(x = "", y = "Unstandardized Beta Coefficient") + 
  theme_half_open()

pcr <- plot_curve(ControlSet,
                 ci = F,
                 ribbon = T) + 
  geom_hline(yintercept = 0,
             linetype = "dashed",
             color = "black") +
  labs(x = "", y = "Unstandardized Beta Coefficient") + 
  theme_half_open()

pcc <- plot_choices(ControlSet,
                    choices = c("x", "y", "controls", "subsets")) + 
  labs(x = "Ranked Specifications") + 
  theme_half_open() + 
  theme(strip.text.x = element_blank())

ph <- plot_samplesizes(ControlSet) + 
  labs(y = "Sample Size") + 
  theme_half_open()

plot_grid(pc, pcc, ph, ncol = 1, align = "v", rel_heights = c(1.5, 2, 0.8), axis = "rbl")

plot_grid(pcr, ph, ncol = 1, align = "v", rel_heights = c(1.5, 0.6), axis = "rbl")

Ordinal logistic models.

I did not run these yet, since specr does not want to take them via polr(). It is hard to imagine the results will differ much and I can do them by hand if really necessary.

Binomial logistic models.

BinomialGLM = function(formula, data){
  glm(formula = formula, data = data, family = "binomial")}

BControlSet <- run_specs(df = data,
                        y = c("homosexDI", "racmar", "colath", "racdinDI", "racfew", "racmost", "colcom", "colhomo", "colmil", "colmslm", "colrac", "libcom", "libhomo", "libmil", "libmslm", "librac", "spkath", "spkcom", "spkhomo", "spkmil", "spkmslm", "spkrac"),
                        x = c("wordsum"),
                        model = c("BinomialGLM"),
                        controls = c("age", "year", "reg16", "res16", "mobile16", "degree", "polcat"),
                        subsets = list(sex = unique(data$sex),
                                       race = unique(data$race)))
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
head(BControlSet)
plot_specs(BControlSet, choices = c("x", "y", "controls", "subsets"))

pc <- plot_curve(BControlSet,
                 ci = T,
                 ribbon = F) + 
  geom_hline(yintercept = 0,
             linetype = "dashed",
             color = "black") +
  labs(x = "", y = "Unstandardized Beta Coefficient") + 
  theme_half_open()

pcr <- plot_curve(BControlSet,
                 ci = F,
                 ribbon = T) + 
  geom_hline(yintercept = 0,
             linetype = "dashed",
             color = "black") +
  labs(x = "", y = "Unstandardized Beta Coefficient") + 
  theme_half_open()

pcc <- plot_choices(BControlSet,
                    choices = c("x", "y", "controls", "subsets")) + 
  labs(x = "Ranked Specifications") + 
  theme_half_open() + 
  theme(strip.text.x = element_blank())

ph <- plot_samplesizes(BControlSet) + 
  labs(y = "Sample Size") + 
  theme_half_open()

plot_grid(pc, pcc, ph, ncol = 1, align = "v", rel_heights = c(1.5, 2, 0.8), axis = "rbl")

plot_grid(pcr, ph, ncol = 1, align = "v", rel_heights = c(1.5, 0.6), axis = "rbl")

Assessing Moderation of the Wordsum-Tolerance Relationship by Sex and Race

list(
  summary(lm(racmost ~ wordsum, data)),
  summary(lm(racmost ~ wordsum + as.factor(sex), data)),
  summary(lm(racmost ~ wordsum * as.factor(sex), data)),
  summary(lm(racmost ~ wordsum + as.factor(race), data)),
  summary(lm(racmost ~ wordsum * as.factor(race), data))) %>% 
  print() 
## [[1]]
## 
## Call:
## lm(formula = racmost ~ wordsum, data = data)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -0.6928 -0.6031  0.3585  0.3841  0.4354 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.7963515  0.0340579  23.382  < 2e-16 ***
## wordsum     -0.0018042  0.0003351  -5.384 7.46e-08 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.4859 on 9046 degrees of freedom
##   (55684 observations deleted due to missingness)
## Multiple R-squared:  0.003194,   Adjusted R-squared:  0.003084 
## F-statistic: 28.99 on 1 and 9046 DF,  p-value: 7.462e-08
## 
## 
## [[2]]
## 
## Call:
## lm(formula = racmost ~ wordsum + as.factor(sex), data = data)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -0.7023 -0.6005  0.3613  0.3917  0.4426 
## 
## Coefficients:
##                   Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      0.8052027  0.0344480  23.374  < 2e-16 ***
## wordsum         -0.0017924  0.0003351  -5.348 9.09e-08 ***
## as.factor(sex)2 -0.0175887  0.0103202  -1.704   0.0884 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.4858 on 9045 degrees of freedom
##   (55684 observations deleted due to missingness)
## Multiple R-squared:  0.003514,   Adjusted R-squared:  0.003294 
## F-statistic: 15.95 on 2 and 9045 DF,  p-value: 1.217e-07
## 
## 
## [[3]]
## 
## Call:
## lm(formula = racmost ~ wordsum * as.factor(sex), data = data)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -0.7268 -0.6091  0.3624  0.3821  0.4694 
## 
## Coefficients:
##                           Estimate Std. Error t value Pr(>|t|)    
## (Intercept)              0.6810371  0.0512318  13.293  < 2e-16 ***
## wordsum                 -0.0005523  0.0005057  -1.092  0.27484    
## as.factor(sex)2          0.2042197  0.0685528   2.979  0.00290 ** 
## wordsum:as.factor(sex)2 -0.0022092  0.0006750  -3.273  0.00107 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.4855 on 9044 degrees of freedom
##   (55684 observations deleted due to missingness)
## Multiple R-squared:  0.004693,   Adjusted R-squared:  0.004363 
## F-statistic: 14.22 on 3 and 9044 DF,  p-value: 3.07e-09
## 
## 
## [[4]]
## 
## Call:
## lm(formula = racmost ~ wordsum + as.factor(race), data = data)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -0.8804 -0.5635  0.1249  0.4365  0.4405 
## 
## Coefficients:
##                   Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      5.541e-01  3.498e-02  15.842  < 2e-16 ***
## wordsum          9.351e-05  3.378e-04   0.277    0.782    
## as.factor(race)2 3.143e-01  1.458e-02  21.554  < 2e-16 ***
## as.factor(race)3 2.006e-01  2.992e-02   6.704 2.15e-11 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.4733 on 9044 degrees of freedom
##   (55684 observations deleted due to missingness)
## Multiple R-squared:  0.05409,    Adjusted R-squared:  0.05377 
## F-statistic: 172.4 on 3 and 9044 DF,  p-value: < 2.2e-16
## 
## 
## [[5]]
## 
## Call:
## lm(formula = racmost ~ wordsum * as.factor(race), data = data)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -0.9261 -0.5630  0.1449  0.4370  0.4497 
## 
## Coefficients:
##                            Estimate Std. Error t value Pr(>|t|)    
## (Intercept)               0.5331598  0.0382645  13.934  < 2e-16 ***
## wordsum                   0.0002982  0.0003703   0.805   0.4206    
## as.factor(race)2          0.4748966  0.0949093   5.004 5.73e-07 ***
## as.factor(race)3          0.1523598  0.1689113   0.902   0.3671    
## wordsum:as.factor(race)2 -0.0017260  0.0010060  -1.716   0.0863 .  
## wordsum:as.factor(race)3  0.0005388  0.0017799   0.303   0.7621    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.4733 on 9042 degrees of freedom
##   (55684 observations deleted due to missingness)
## Multiple R-squared:  0.05442,    Adjusted R-squared:  0.05389 
## F-statistic: 104.1 on 5 and 9042 DF,  p-value: < 2.2e-16