Back to Article
Logistic Regression
Download Source

Logistic Regression (predicting voter choice 2024)

predicting voter choice 2024

Authors
Affiliations

Aashia Khan

Binghamton University

Zihan Hei

Binghamton University

Jeff John

Binghamton University

Shane McCarty

Binghamton University

Promote Care & Prevent Harm

Published

February 25, 2026

Abstract

Background: Zero-sum beliefs—the perception that one group’s gains necessarily result in another group’s losses—are important predictors of political attitudes. However, the referents for zero-sum beliefs as economic or social identity remain underexplored in relation to political ideology, party affiliation, and voting behavior in contemporary elections.

Method: We conducted a comprehensive analysis examining three dimensions of zero-sum beliefs (general, economic, and social identity). Using Kruskal-Wallis tests on eleven zero-sum beliefs, we investigated how political party affiliation and racial/ethnic identity influenced endorsement of zero-sum beliefs across multiple domains. Subsequently, we examined whether these zero-sum belief patterns predicted self-reported voting for Donald Trump versus Kamala Harris in the 2024 presidential election.

Results: Political party affiliation was a significant predictor for all eight zero-sum social identity beliefs, but none of the economic or general beliefs. Republican voters and certain racial/ethnic groups demonstrated higher endorsement of zero-sum social identity beliefs. A logistic regression shows that after controlling for political ideology, a composite of zero-sum social identity beliefs explains voting behavior in the 2024 presidential election, with stronger zero-sum social identity thinking associated with Trump support and lower zero-sum social identity beliefs predicting Harris support. Other sociodemographic factors and zero-sum economic thinking were not significant predictors.

Discussion: Zero-sum social identity beliefs may represent a competitive core belief underlying contemporary political party affiliation and candidate preference. These findings affirm prior work that zero-sum thinking about economics differ from social identities, with similar levels of agreement on zero-sum economic beliefs across political parties but significantly different levels of agreement on zero-sum social identity beliefs by party affiliation. To the best of our knowledge, this study is the first to show that zero-sum thinking about social identities predicts voter preference in the 2024 election. Ultimately, future work needs to examine how to reduce zero-sum social identity thinking.

Keywords

zero sum beliefs, social identities, political affiliation, racial identity

Predicting Voting Behavior for 2024 Presidential Candidate

Factor Analysis of Zero-Sum Beliefs

In [1]:
Show the code

# Load necessary libraries
library(ggplot2)
library(dplyr)

Attaching package: 'dplyr'
The following objects are masked from 'package:stats':

    filter, lag
The following objects are masked from 'package:base':

    intersect, setdiff, setequal, union
Show the code

library(tidyr)
library(ggrain)  
Registered S3 methods overwritten by 'ggpp':
  method                  from   
  heightDetails.titleGrob ggplot2
  widthDetails.titleGrob  ggplot2
Show the code

library(rmarkdown)
library(readr)
library(dplyr, warn.conflicts = FALSE)
library(haven)
library(rempsyc)
Suggested APA citation: Thériault, R. (2023). rempsyc: Convenience functions for psychology. 
Journal of Open Source Software, 8(87), 5466. https://doi.org/10.21105/joss.05466
Show the code

library(knitr)
library(broom)
library(ggdist)
library(devtools)
Loading required package: usethis
Show the code

library(apaTables)
library(ggpubr)
library(psych)

Attaching package: 'psych'
The following objects are masked from 'package:ggplot2':

    %+%, alpha
Show the code

library(forcats)
library(corrplot)
corrplot 0.95 loaded
In [2]:
Show the code
select_data <- read.csv("/cloud/project/data/select_data.csv")
In [3]:
Show the code

library(psych)
# create data frame of ZEROSUM variables for factor analysis
df.ZEROSUM <- select_data[, c("ZEROSUM_1", "ZEROSUM_2", "ZEROSUM_3", "ZEROSUM_4", 
                                  "ZEROSUM_5", "ZEROSUM_6", "ZEROSUM_7", "ZEROSUM_8", 
                                  "ZEROSUM_9", "ZEROSUM_10", "ZEROSUM_11")]

# Or using dplyr to select variables
# zerosum_vars <- select_data %>% select(ZEROSUM_1:ZEROSUM_11)

# Check the correlation matrix first
cor_matrix <- cor(df.ZEROSUM, use = "complete.obs")
print(cor_matrix)
            ZEROSUM_1    ZEROSUM_2   ZEROSUM_3   ZEROSUM_4    ZEROSUM_5
ZEROSUM_1  1.00000000  0.386159282  0.09223868  0.46244644  0.354780151
ZEROSUM_2  0.38615928  1.000000000  0.47893466  0.01604828 -0.007056022
ZEROSUM_3  0.09223868  0.478934659  1.00000000 -0.02418897 -0.109827301
ZEROSUM_4  0.46244644  0.016048284 -0.02418897  1.00000000  0.611174045
ZEROSUM_5  0.35478015 -0.007056022 -0.10982730  0.61117404  1.000000000
ZEROSUM_6  0.36699616  0.031303525 -0.17086105  0.60219942  0.607185097
ZEROSUM_7  0.12009911 -0.098678831 -0.14396820  0.34550888  0.536331658
ZEROSUM_8  0.25942078 -0.155377765 -0.12939334  0.49740256  0.586804352
ZEROSUM_9  0.41016910  0.078257987 -0.12138304  0.56204342  0.628375488
ZEROSUM_10 0.29170352 -0.114520512 -0.18994979  0.49480889  0.683232725
ZEROSUM_11 0.27789618 -0.019381988 -0.18865010  0.46048999  0.570020242
             ZEROSUM_6   ZEROSUM_7  ZEROSUM_8   ZEROSUM_9 ZEROSUM_10
ZEROSUM_1   0.36699616  0.12009911  0.2594208  0.41016910  0.2917035
ZEROSUM_2   0.03130352 -0.09867883 -0.1553778  0.07825799 -0.1145205
ZEROSUM_3  -0.17086105 -0.14396820 -0.1293933 -0.12138304 -0.1899498
ZEROSUM_4   0.60219942  0.34550888  0.4974026  0.56204342  0.4948089
ZEROSUM_5   0.60718510  0.53633166  0.5868044  0.62837549  0.6832327
ZEROSUM_6   1.00000000  0.55401598  0.5067006  0.58654354  0.6812058
ZEROSUM_7   0.55401598  1.00000000  0.4203826  0.38964490  0.6145775
ZEROSUM_8   0.50670056  0.42038261  1.0000000  0.52719441  0.5667796
ZEROSUM_9   0.58654354  0.38964490  0.5271944  1.00000000  0.6009058
ZEROSUM_10  0.68120581  0.61457749  0.5667796  0.60090582  1.0000000
ZEROSUM_11  0.67721379  0.51776718  0.4961602  0.52655236  0.6724939
            ZEROSUM_11
ZEROSUM_1   0.27789618
ZEROSUM_2  -0.01938199
ZEROSUM_3  -0.18865010
ZEROSUM_4   0.46048999
ZEROSUM_5   0.57002024
ZEROSUM_6   0.67721379
ZEROSUM_7   0.51776718
ZEROSUM_8   0.49616017
ZEROSUM_9   0.52655236
ZEROSUM_10  0.67249386
ZEROSUM_11  1.00000000
Show the code

# Determine number of factors using scree plot and parallel analysis
scree(df.ZEROSUM)

Show the code

fa.parallel(df.ZEROSUM, fa = "fa")

Parallel analysis suggests that the number of factors =  2  and the number of components =  NA 
Show the code

# Run 2-factor factor analysis (adjust nfactors based on scree plot/parallel analysis)
fa_result <- fa(df.ZEROSUM, 
                nfactors = 2,  # adjust this number based on your analysis
                rotate = "promax",
                fm = "ml")  # maximum likelihood
Loading required namespace: GPArotation
Show the code

# View results
print(fa_result)
Factor Analysis using method =  ml
Call: fa(r = df.ZEROSUM, nfactors = 2, rotate = "promax", fm = "ml")
Standardized loadings (pattern matrix) based upon correlation matrix
             ML1   ML2   h2   u2 com
ZEROSUM_1   0.45  0.42 0.38 0.62 2.0
ZEROSUM_2   0.00  0.92 0.85 0.15 1.0
ZEROSUM_3  -0.17  0.51 0.29 0.71 1.2
ZEROSUM_4   0.69  0.06 0.48 0.52 1.0
ZEROSUM_5   0.81  0.00 0.66 0.34 1.0
ZEROSUM_6   0.82  0.03 0.67 0.33 1.0
ZEROSUM_7   0.64 -0.12 0.42 0.58 1.1
ZEROSUM_8   0.67 -0.15 0.48 0.52 1.1
ZEROSUM_9   0.74  0.09 0.56 0.44 1.0
ZEROSUM_10  0.84 -0.12 0.72 0.28 1.0
ZEROSUM_11  0.76 -0.03 0.57 0.43 1.0

                       ML1  ML2
SS loadings           4.71 1.36
Proportion Var        0.43 0.12
Cumulative Var        0.43 0.55
Proportion Explained  0.78 0.22
Cumulative Proportion 0.78 1.00

 With factor correlations of 
      ML1   ML2
ML1  1.00 -0.01
ML2 -0.01  1.00

Mean item complexity =  1.1
Test of the hypothesis that 2 factors are sufficient.

df null model =  55  with the objective function =  5.55 with Chi Square =  646.26
df of  the model are 34  and the objective function was  0.45 

The root mean square of the residuals (RMSR) is  0.04 
The df corrected root mean square of the residuals is  0.06 

The harmonic n.obs is  121 with the empirical chi square  26.71  with prob <  0.81 
The total n.obs was  122  with Likelihood Chi Square =  51.63  with prob <  0.027 

Tucker Lewis Index of factoring reliability =  0.951
RMSEA index =  0.065  and the 90 % confidence intervals are  0.023 0.1
BIC =  -111.7
Fit based upon off diagonal values = 0.99
Measures of factor score adequacy             
                                                   ML1  ML2
Correlation of (regression) scores with factors   0.96 0.93
Multiple R square of scores with factors          0.92 0.87
Minimum correlation of possible factor scores     0.84 0.73
Show the code

fa_result$loadings

Loadings:
           ML1    ML2   
ZEROSUM_1   0.448  0.424
ZEROSUM_2          0.922
ZEROSUM_3  -0.167  0.508
ZEROSUM_4   0.689       
ZEROSUM_5   0.810       
ZEROSUM_6   0.816       
ZEROSUM_7   0.639 -0.120
ZEROSUM_8   0.674 -0.149
ZEROSUM_9   0.742       
ZEROSUM_10  0.837 -0.124
ZEROSUM_11  0.757       

                 ML1   ML2
SS loadings    4.712 1.355
Proportion Var 0.428 0.123
Cumulative Var 0.428 0.551
Show the code

# Get factor scores
factor_scores <- fa_result$scores

The results of the factor analysis – an unsupervised machine learning technique – support a two factor model with a promax rotation. The first item loads equally on each factor and will not be included in the composite construction. Based on the items, we named the first factor as ZEROSUM_ECONOMIC and the second factor as ZEROSUM_IDENTITY to correspond with the two different referents of economic (e.g., wealth vs. poor) and social identity (e.g., racial minorities vs. white people), respectively.

In [4]:
Show the code

select_data <- select_data %>%
  mutate(
    ZEROSUM_ECONOMIC = (ZEROSUM_2 + ZEROSUM_3)/2,
    ZEROSUM_IDENTITY = (ZEROSUM_4 + ZEROSUM_5 + ZEROSUM_6 + ZEROSUM_7 + ZEROSUM_8 + ZEROSUM_9 + ZEROSUM_10 + ZEROSUM_11)/8
  )
In [5]:
Show the code
library(psych)
# Alpha for ZEROSUM_IDENTITY (8 items)
alpha_identity <- psych::alpha(select_data[, c("ZEROSUM_4", "ZEROSUM_5", "ZEROSUM_6", 
                                         "ZEROSUM_7", "ZEROSUM_8", "ZEROSUM_9", 
                                         "ZEROSUM_10", "ZEROSUM_11")])
print(alpha_identity)

Reliability analysis   
Call: psych::alpha(x = select_data[, c("ZEROSUM_4", "ZEROSUM_5", "ZEROSUM_6", 
    "ZEROSUM_7", "ZEROSUM_8", "ZEROSUM_9", "ZEROSUM_10", "ZEROSUM_11")])

  raw_alpha std.alpha G6(smc) average_r S/N   ase mean  sd median_r
      0.91      0.91    0.91      0.55  10 0.012  3.1 1.4     0.56

    95% confidence boundaries 
         lower alpha upper
Feldt     0.88  0.91  0.93
Duhachek  0.88  0.91  0.93

 Reliability if an item is dropped:
           raw_alpha std.alpha G6(smc) average_r S/N alpha se  var.r med.r
ZEROSUM_4       0.90      0.90    0.90      0.57 9.3    0.013 0.0064  0.57
ZEROSUM_5       0.89      0.89    0.89      0.54 8.2    0.015 0.0081  0.53
ZEROSUM_6       0.89      0.89    0.88      0.54 8.2    0.015 0.0077  0.54
ZEROSUM_7       0.91      0.91    0.90      0.58 9.6    0.013 0.0046  0.59
ZEROSUM_8       0.90      0.90    0.90      0.57 9.2    0.013 0.0083  0.59
ZEROSUM_9       0.90      0.90    0.89      0.56 8.8    0.014 0.0080  0.57
ZEROSUM_10      0.89      0.89    0.88      0.53 8.0    0.015 0.0066  0.54
ZEROSUM_11      0.90      0.90    0.89      0.55 8.6    0.014 0.0077  0.57

 Item statistics 
             n raw.r std.r r.cor r.drop mean  sd
ZEROSUM_4  121  0.73  0.73  0.68   0.64  3.1 1.7
ZEROSUM_5  122  0.83  0.84  0.82   0.77  2.8 1.8
ZEROSUM_6  121  0.84  0.83  0.82   0.78  3.4 2.1
ZEROSUM_7  120  0.70  0.70  0.64   0.61  3.5 1.8
ZEROSUM_8  121  0.73  0.74  0.68   0.65  2.9 1.6
ZEROSUM_9  121  0.77  0.77  0.73   0.69  2.6 1.7
ZEROSUM_10 122  0.85  0.85  0.84   0.80  3.2 1.7
ZEROSUM_11 121  0.79  0.79  0.75   0.72  3.2 1.7

Non missing response frequency for each item
              1    2    3    4    5    6    7 miss
ZEROSUM_4  0.28 0.11 0.19 0.20 0.14 0.07 0.02 0.01
ZEROSUM_5  0.36 0.09 0.20 0.16 0.07 0.09 0.02 0.00
ZEROSUM_6  0.31 0.08 0.12 0.14 0.13 0.14 0.07 0.01
ZEROSUM_7  0.21 0.12 0.11 0.22 0.22 0.06 0.06 0.02
ZEROSUM_8  0.31 0.08 0.21 0.21 0.13 0.03 0.02 0.01
ZEROSUM_9  0.43 0.12 0.14 0.13 0.11 0.04 0.02 0.01
ZEROSUM_10 0.27 0.10 0.19 0.17 0.16 0.11 0.01 0.00
ZEROSUM_11 0.25 0.16 0.15 0.21 0.11 0.11 0.02 0.01
In [6]:
Show the code

library(psych)

# Alpha for ZEROSUM_ECONOMIC (2 items)
alpha_economic <- psych::alpha(select_data[, c("ZEROSUM_2", "ZEROSUM_3")])
print(alpha_economic)

Reliability analysis   
Call: psych::alpha(x = select_data[, c("ZEROSUM_2", "ZEROSUM_3")])

  raw_alpha std.alpha G6(smc) average_r S/N   ase mean  sd median_r
      0.65      0.65    0.48      0.48 1.8 0.064  4.8 1.3     0.48

    95% confidence boundaries 
         lower alpha upper
Feldt     0.50  0.65  0.75
Duhachek  0.52  0.65  0.77

 Reliability if an item is dropped:
          raw_alpha std.alpha G6(smc) average_r  S/N alpha se var.r med.r
ZEROSUM_2      0.51      0.48    0.23      0.48 0.92       NA     0  0.48
ZEROSUM_3      0.45      0.48    0.23      0.48 0.92       NA     0  0.48

 Item statistics 
            n raw.r std.r r.cor r.drop mean  sd
ZEROSUM_2 121  0.87  0.86   0.6   0.48  4.8 1.6
ZEROSUM_3 121  0.85  0.86   0.6   0.48  4.9 1.5

Non missing response frequency for each item
             1    2    3    4    5    6    7 miss
ZEROSUM_2 0.04 0.06 0.09 0.21 0.29 0.15 0.17 0.01
ZEROSUM_3 0.02 0.06 0.06 0.21 0.29 0.19 0.17 0.01

Logistic Regression (predicting voter choice 2024)

In [7]:
Show the code

# create new variable
select_data <- select_data %>%
  mutate(TRUMPVOTE = case_when(
    VOTE2024 == 1 ~ 1,
    VOTE2024 == 2 ~ 0,
    TRUE ~ NA
  ))
select_data
    AGE EDUCATION SOCIALSTATUS            INCOME RELIGIOUS_IDENTITY  RACE
1    29         6            6 $100,000-$149,999                  1     3
2    40         2            3   $25,000-$49,999                  9     7
3    23         3            4 Prefer not to say                  9   3,7
4    35         5            6  $150,000 or more                  1     2
5    67         6            9 $100,000-$149,999                  1     7
6    45         5            7  $150,000 or more                  1     3
7    20         3            4   $50,000-$74,999                  1     7
8    34         5            3   $25,000-$49,999                  9     7
9    59         2            3 Less than $25,000                  8     7
10   40         3            4 $100,000-$149,999                  1     7
11   30         6            3 Less than $25,000                  1     7
12   41         6            5   $25,000-$49,999                  7     8
13   29         5            6   $50,000-$74,999                  1     3
14   24         5            6 $100,000-$149,999                  9   3,7
15   72         6            8   $75,000-$99,999                  1     6
16   23         2            4 Less than $25,000                  8     3
17   22         6            9   $50,000-$74,999                  1     3
18   51         5            7   $75,000-$99,999                5,9     7
19   NA         6            6 Less than $25,000                  1     3
20   36         5            4 $100,000-$149,999                  1     7
21   59         5            4   $25,000-$49,999                  8     7
22   29         5            4 $100,000-$149,999                  1     3
23   21         5            6   $75,000-$99,999                  1     3
24   36         5            4 $100,000-$149,999                  1     2
25   47         6            7 $100,000-$149,999                  1     7
26   24         3            6   $25,000-$49,999                -99     3
27   33         2            3   $25,000-$49,999                  1     4
28   27         5            6 $100,000-$149,999                  1     7
29   21         5            5   $75,000-$99,999                  1     7
30   21         3            8   $50,000-$74,999                  9     2
31   42         6            7   $50,000-$74,999                  1     3
32   22         5            5   $50,000-$74,999                  1     2
33   26         3            5   $50,000-$74,999                  1     4
34   62         4            5   $50,000-$74,999                  9   1,7
35   35         5            5  $150,000 or more                -99     2
36   29         2            1 Prefer not to say                  9     2
37   30         3            2 Less than $25,000                  9   4,7
38   20         3            5   $25,000-$49,999                  9     4
39   42         5            6 $100,000-$149,999                  9     7
40   33         5            2   $50,000-$74,999                  1     4
41   35         5            6   $50,000-$74,999                  1     7
42   33         5            6 $100,000-$149,999                  9     7
43   35         6            5   $50,000-$74,999                  1     4
44   45         3            2 Less than $25,000                  9     7
45   33         3            3   $25,000-$49,999                  1     4
46   40         5            5   $75,000-$99,999                  8     2
47   58         6            6 $100,000-$149,999                  9     2
48   36         6            5   $25,000-$49,999                  1     7
49   25         5            4   $50,000-$74,999                  9     3
50   39         5            3   $50,000-$74,999                -99     7
51   24         2            2   $50,000-$74,999                  9 3,4,7
52   42         6            7   $75,000-$99,999                  1     7
53   36         4            7   $25,000-$49,999                  1     3
54   43         6            8 $100,000-$149,999                  1     3
55   28         5            3   $25,000-$49,999                  1     3
56   30         6            6   $50,000-$74,999                  1     7
57   51         6            8 $100,000-$149,999                  1     7
58   25         5            5   $25,000-$49,999                  1     3
59   27         3            5   $25,000-$49,999                  9     4
60   30         5            5  $150,000 or more                  9     2
61   54         6            7  $150,000 or more                  1     3
62   33         6            7   $50,000-$74,999                  1     7
63   52         4            8  $150,000 or more                  9     7
64   52         6            5 $100,000-$149,999                  1     3
65   20         6            6   $50,000-$74,999                  1     3
66   22         3            1   $50,000-$74,999                  9     7
67   32         6            7   $75,000-$99,999                  1     3
68   22         3            5 Less than $25,000                  1     7
69   25         6            6 $100,000-$149,999                  9     7
70   28         5            3   $25,000-$49,999                  1     7
71   19         5            7 Less than $25,000                  1     7
72   27         5            6 Less than $25,000                  9     5
73   31         5            6 $100,000-$149,999                  1     7
74   34         6            6 $100,000-$149,999                  9     3
75   37         5            7  $150,000 or more                  9     2
76   48         5            6   $50,000-$74,999                  9     7
77   61         4            3 Less than $25,000                  1     7
78   49         6            8   $50,000-$74,999                  1     7
79   28         5            8   $25,000-$49,999                  1     7
80   24         3            3 $100,000-$149,999                  1     2
81   34         2            5 $100,000-$149,999                  1   2,3
82   32         6            6 $100,000-$149,999                  9     7
83   37         6            6   $75,000-$99,999                  9     4
84   29         4            1   $25,000-$49,999                  9     3
85   30         6            6  $150,000 or more                  1     2
86   29         6            4   $75,000-$99,999                  1     3
87   43         5            6 $100,000-$149,999                  9   2,7
88   73         6            6 $100,000-$149,999                  6     7
89   37         6            7   $75,000-$99,999                  1     3
90   21         5            5 $100,000-$149,999                  1     3
91   31         6            6 $100,000-$149,999                  1     7
92   56         3            4 Less than $25,000                  1     3
93   25         2            3   $25,000-$49,999                  9     7
94   54         5            3   $25,000-$49,999                  2     7
95   54         6            9 $100,000-$149,999                  1     3
96   37         6            6 $100,000-$149,999                  9     2
97   59         5            7  $150,000 or more                  1     4
98   30         5            5   $25,000-$49,999                  9     2
99   19         3            7   $75,000-$99,999                  1     2
100  26         4            5   $75,000-$99,999                  2     2
101  46         5            5  $150,000 or more                  9     7
102  29         5            6 $100,000-$149,999                  1   3,6
103  32         6            8  $150,000 or more                  1     7
104  20         4            5 $100,000-$149,999                  9   2,7
105  39         6            7   $50,000-$74,999                  1     2
106  38         5            4 $100,000-$149,999                  1     7
107  23         3            3   $25,000-$49,999                  9     7
108  47         6            4   $50,000-$74,999                  4     2
109  28         6            4   $25,000-$49,999                  1     3
110  27         5            4   $25,000-$49,999                  9     7
111  67         6            5 $100,000-$149,999                  9     7
112  52         3            4   $25,000-$49,999                  1     7
113  22         5            7 $100,000-$149,999                  9     2
114  27         5            6   $25,000-$49,999                  9     2
115  44         3            3   $25,000-$49,999                  9     7
116  48         6            6 $100,000-$149,999                  9     2
117  36         6            6 $100,000-$149,999                  9     2
118  28         3            7   $75,000-$99,999                  9     7
119  21         3            7 $100,000-$149,999                  4     2
120  56         5            5 Less than $25,000                  1   1,7
121  52         5            6   $75,000-$99,999                  9     3
122  38         5            8 $100,000-$149,999                  1     7
                         STREETRACE GENDER               SEXUAL_IDENTITY
1                             Black      2 Bisexual, pansexual, or queer
2                             White      2      Straight or heterosexual
3                              <NA>      2      Straight or heterosexual
4                    Asian American      1      Straight or heterosexual
5                             White      2      Straight or heterosexual
6                             Black      1      Straight or heterosexual
7                             White      1      Straight or heterosexual
8                             White      2      Straight or heterosexual
9                             White      1      Straight or heterosexual
10                            White      1      Straight or heterosexual
11                            White      2                Gay or lesbian
12                  Some other race      3 Bisexual, pansexual, or queer
13                            Black      1      Straight or heterosexual
14                            Black      1                Gay or lesbian
15                            White      2      Straight or heterosexual
16                            Black      1      Straight or heterosexual
17                            Black      1                Gay or lesbian
18                            White      2      Straight or heterosexual
19                            Black      1      Straight or heterosexual
20                            White      2      Straight or heterosexual
21                            White      1 Bisexual, pansexual, or queer
22                            Black      1      Straight or heterosexual
23                            Black      2      Straight or heterosexual
24                   Asian American      2 Bisexual, pansexual, or queer
25  Native American/American Indian      1      Straight or heterosexual
26                            Black      1 Bisexual, pansexual, or queer
27                           Latine      1      Straight or heterosexual
28                            White      1 Bisexual, pansexual, or queer
29                            White      1      Straight or heterosexual
30                   Asian American      2      Straight or heterosexual
31                            Black      1      Straight or heterosexual
32                   Asian American      2      Straight or heterosexual
33                            White      1      Straight or heterosexual
34                            White      1      Straight or heterosexual
35                   Asian American      2      Straight or heterosexual
36                          Mexican      3                       Asexual
37                            White      3                      Not sure
38                          Mexican      2      Straight or heterosexual
39                            White      2      Straight or heterosexual
40                          Mexican      2      Straight or heterosexual
41                            White      2      Straight or heterosexual
42                            White      2 Bisexual, pansexual, or queer
43                            White      1      Straight or heterosexual
44                            White      2      Straight or heterosexual
45                           Latine      2      Straight or heterosexual
46                   Asian American      1      Straight or heterosexual
47                   Asian American      1      Straight or heterosexual
48                            White      2      Straight or heterosexual
49                            Black      2 Bisexual, pansexual, or queer
50                            White      1 Bisexual, pansexual, or queer
51                           Latine      2      Straight or heterosexual
52                           Latine      2                Gay or lesbian
53                            Black      2      Straight or heterosexual
54                            Black      1 Bisexual, pansexual, or queer
55                            Black      1                Gay or lesbian
56                            White      3                       Asexual
57                            White      1 Bisexual, pansexual, or queer
58                            Black      1 Bisexual, pansexual, or queer
59                           Latine      2      Straight or heterosexual
60                   Asian American      1      Straight or heterosexual
61                            Black      2      Straight or heterosexual
62                            White      1      Straight or heterosexual
63                            White      1      Straight or heterosexual
64                            Black      2      Straight or heterosexual
65                            Black      2      Straight or heterosexual
66                            White      1 Bisexual, pansexual, or queer
67  Native American/American Indian      1      Straight or heterosexual
68                            White      1      Straight or heterosexual
69                            White      2                Gay or lesbian
70                            White      1      Straight or heterosexual
71                            White      1                Gay or lesbian
72                             <NA>      2      Straight or heterosexual
73                            White      2      Straight or heterosexual
74                            Black      2      Straight or heterosexual
75                   Asian American      1      Straight or heterosexual
76                            White      2      Straight or heterosexual
77                            White      1      Straight or heterosexual
78                            White      1                       Asexual
79                            White      2      Straight or heterosexual
80                   Asian American      2      Straight or heterosexual
81                            Black      2      Straight or heterosexual
82                            White      2      Straight or heterosexual
83                           Latine      2 Bisexual, pansexual, or queer
84                            Black      1 Bisexual, pansexual, or queer
85                   Asian American      1      Straight or heterosexual
86                            Black      1 Bisexual, pansexual, or queer
87                            White      2      Straight or heterosexual
88                            White      2      Straight or heterosexual
89                            Black      2      Straight or heterosexual
90                            Black      2      Straight or heterosexual
91                            White      1      Straight or heterosexual
92                            Black      1      Straight or heterosexual
93                            White      1 Bisexual, pansexual, or queer
94                            White      1                       Asexual
95                            Black      2      Straight or heterosexual
96                   Asian American      2      Straight or heterosexual
97                           Latine      1                Gay or lesbian
98                   Asian American      2 Bisexual, pansexual, or queer
99                   Asian American      2      Straight or heterosexual
100                  Asian American      1      Straight or heterosexual
101                           White      1 Bisexual, pansexual, or queer
102                           Black      2      Straight or heterosexual
103                           White      2      Straight or heterosexual
104                           White      1      Straight or heterosexual
105                  Asian American      1      Straight or heterosexual
106                           White      1      Straight or heterosexual
107                           White      1 Bisexual, pansexual, or queer
108                         Mexican      2      Straight or heterosexual
109                           Black      2      Straight or heterosexual
110                           White      2      Straight or heterosexual
111                           White      2      Straight or heterosexual
112                           White      2 Bisexual, pansexual, or queer
113                  Asian American      1 Bisexual, pansexual, or queer
114                  Asian American      1      Straight or heterosexual
115                           White      2      Straight or heterosexual
116                  Asian American      1      Straight or heterosexual
117                  Asian American      2                Gay or lesbian
118                           White      2      Straight or heterosexual
119                  Asian American      2      Straight or heterosexual
120 Native American/American Indian      1      Straight or heterosexual
121                           Black      2                Gay or lesbian
122                           White      1      Straight or heterosexual
    POLITICALBELIEFS           POLITICALAFFIL VOTE2024 SERIOUS POLITICALPARTY
1                  4         Republican Party        1     Yes     Republican
2                  5         Republican Party        1     Yes     Republican
3                  5                     <NA>        8     Yes    Independent
4                  3         Democratic Party        2     Yes       Democrat
5                  4                     <NA>        2     Yes    Independent
6                  3         Democratic Party        1     Yes       Democrat
7                  4         Republican Party        1     Yes     Republican
8                  4         Republican Party        8     Yes     Republican
9                 NA                     <NA>        8     Yes    Independent
10                 6                     <NA>        1     Yes    Independent
11                 4         Republican Party        1     Yes     Republican
12                 3         Democratic Party        2     Yes    Independent
13                 3         Democratic Party        2     Yes       Democrat
14                 1         Democratic Party        2     Yes       Democrat
15                 6       Conservative Party        1     Yes     Republican
16                 2         Democratic Party        8     Yes     Republican
17                 2         Republican Party        1     Yes     Republican
18                 2                     <NA>        2     Yes    Independent
19                 4         Republican Party        1     Yes    Independent
20                 1         Democratic Party        2    <NA>       Democrat
21                 2                     <NA>        2     Yes    Independent
22                 4        Libertarian Party       NA     Yes    Independent
23                 4         Democratic Party        2     Yes       Democrat
24                 5         Republican Party        2     Yes     Republican
25                 4         Republican Party        1     Yes     Republican
26                 2        Libertarian Party        1     Yes       Democrat
27                 6         Republican Party        1     Yes     Republican
28                 2         Democratic Party        2     Yes       Democrat
29                NA        Libertarian Party       NA     Yes       Democrat
30                 3         Democratic Party        2     Yes       Democrat
31                 3        Libertarian Party        1     Yes    Independent
32                 4        Libertarian Party        8     Yes    Independent
33                 3         Democratic Party        2     Yes       Democrat
34                 1         Democratic Party        2     Yes       Democrat
35                 4 Socialist or Green Party        8     Yes    Independent
36                 3         Democratic Party        2     Yes    Independent
37                 2         Democratic Party        2     Yes       Democrat
38                 4                     <NA>        8     Yes    Independent
39                 4        Libertarian Party        5     Yes    Independent
40                 2         Democratic Party        2     Yes       Democrat
41                 4         Democratic Party        2     Yes    Independent
42                 2         Democratic Party        2     Yes       Democrat
43                 5         Republican Party        1     Yes    Independent
44                 3         Democratic Party        8     Yes    Independent
45                 3                     <NA>        2     Yes    Independent
46                 2         Democratic Party        2     Yes       Democrat
47                 5       Conservative Party        1     Yes     Republican
48                 3         Republican Party        1     Yes     Republican
49                 3         Democratic Party        2     Yes       Democrat
50                 3         Democratic Party        2     Yes       Democrat
51                 5         Republican Party        8     Yes     Republican
52                 6       Conservative Party        1     Yes     Republican
53                 5                     <NA>        7     Yes    Independent
54                 5         Republican Party        1     Yes     Republican
55                 6         Republican Party        1     Yes     Republican
56                 5         Republican Party        1     Yes     Republican
57                 5         Republican Party        1     Yes     Republican
58                 4         Democratic Party        1     Yes       Democrat
59                 5         Republican Party        1     Yes     Republican
60                 3         Democratic Party        2     Yes       Democrat
61                 5         Republican Party        1     Yes     Republican
62                 5         Democratic Party        1     Yes       Democrat
63                 3         Democratic Party        2     Yes       Democrat
64                 5       Conservative Party        1     Yes     Republican
65                 5         Republican Party        1     Yes     Republican
66                 2         Democratic Party        2     Yes    Independent
67                 6       Conservative Party        1     Yes     Republican
68                 3         Democratic Party        2     Yes    Independent
69                 6       Conservative Party        1     Yes     Republican
70                 5       Conservative Party        1     Yes     Republican
71                 5         Republican Party        8     Yes     Republican
72                 3         Democratic Party        2     Yes       Democrat
73                 2         Democratic Party        1     Yes       Democrat
74                 5         Republican Party        1     Yes     Republican
75                 5         Republican Party        1     Yes     Republican
76                 3         Democratic Party        2     Yes       Democrat
77                 5         Republican Party        1     Yes     Republican
78                 4         Democratic Party        1     Yes     Republican
79                 2         Republican Party        1     Yes     Republican
80                 4                     <NA>        8     Yes    Independent
81                 3         Democratic Party        2     Yes    Independent
82                 6         Republican Party        1     Yes     Republican
83                 4                     <NA>        2     Yes    Independent
84                 1                     <NA>        2     Yes    Independent
85                 5         Republican Party        1     Yes     Republican
86                 3         Democratic Party        2     Yes       Democrat
87                 3         Democratic Party        2     Yes       Democrat
88                 3         Democratic Party        2     Yes       Democrat
89                 6         Democratic Party        1     Yes       Democrat
90                 4         Republican Party        1     Yes    Independent
91                 6       Conservative Party        1     Yes    Independent
92                 3         Democratic Party        2     Yes    Independent
93                 3         Democratic Party        8     Yes       Democrat
94                 1         Democratic Party        2     Yes       Democrat
95                 5         Democratic Party        1     Yes       Democrat
96                 5         Republican Party        1     Yes     Republican
97                 5         Republican Party        1     Yes     Republican
98                 3         Democratic Party        2     Yes       Democrat
99                 4                     <NA>        8     Yes    Independent
100                4                     <NA>        8     Yes    Independent
101                1         Democratic Party        2     Yes       Democrat
102                5       Conservative Party        1     Yes     Republican
103                3         Democratic Party        2     Yes       Democrat
104                2         Democratic Party        2     Yes       Democrat
105                4         Republican Party        1     Yes     Republican
106                4         Democratic Party        1     Yes    Independent
107                2         Democratic Party        2     Yes    Independent
108                3         Democratic Party        2     Yes       Democrat
109                3                     <NA>       NA     Yes    Independent
110                3         Democratic Party        2     Yes       Democrat
111                3         Democratic Party        2     Yes       Democrat
112                4                     <NA>        2     Yes    Independent
113                1         Democratic Party        2     Yes       Democrat
114                4                     <NA>        8     Yes    Independent
115                3        Libertarian Party        8     Yes    Independent
116                4                     <NA>        2     Yes    Independent
117                2         Democratic Party        2     Yes       Democrat
118                5        Libertarian Party        1     Yes    Independent
119                5         Republican Party        1     Yes     Republican
120                4                     <NA>        1     Yes    Independent
121                3         Republican Party        1     Yes       Democrat
122                2         Democratic Party        2     Yes       Democrat
       SEX   ETHNICITY   Nationality Student.status
1     Male       Black United States            Yes
2     Male       White United States             No
3     Male Mixed/Other United States            Yes
4   Female       Asian United States             No
5     Male       White United States             No
6   Female       Black United States             No
7   Female       White United States            Yes
8     Male Mixed/Other United States   DATA_EXPIRED
9   Female       White United States   DATA_EXPIRED
10  Female       White United States            Yes
11    Male       White United States             No
12  Female Mixed/Other United States             No
13  Female       Black United States             No
14  Female Mixed/Other United States   DATA_EXPIRED
15    Male       White United States   DATA_EXPIRED
16  Female       Black United States   DATA_EXPIRED
17  Female       Black United States             No
18    Male       White United States             No
19  Female       Black United States   DATA_EXPIRED
20    Male       White United States             No
21  Female       White United States             No
22    Male       Black United States             No
23    Male       Black United States            Yes
24    Male       Asian United States             No
25  Female       White United States             No
26  Female       Black United States             No
27  Female Mixed/Other United States             No
28  Female       White United States            Yes
29  Female       White United States             No
30    Male       Asian United States   DATA_EXPIRED
31  Female       Black United States             No
32    Male       Asian United States            Yes
33  Female Mixed/Other United States             No
34  Female       White United States             No
35    Male       Asian United States   DATA_EXPIRED
36  Female       Asian United States             No
37    Male       White United States             No
38    Male       White United States             No
39    Male       White United States             No
40    Male Mixed/Other United States             No
41    Male       White United States             No
42    Male Mixed/Other United States            Yes
43  Female Mixed/Other United States            Yes
44    Male       White United States   DATA_EXPIRED
45    Male Mixed/Other United States            Yes
46  Female       Asian United States             No
47  Female       Asian United States   DATA_EXPIRED
48    Male       White United States             No
49    Male       Black United States             No
50  Female       White United States             No
51    Male Mixed/Other United States             No
52    Male       White United States            Yes
53    Male       Black United States             No
54  Female       Black United States            Yes
55  Female Mixed/Other United States             No
56    Male       White United States            Yes
57  Female       White United States             No
58  Female       Black United States             No
59    Male Mixed/Other United States             No
60  Female       Asian United States   DATA_EXPIRED
61    Male       Black United States             No
62  Female       White United States             No
63  Female       White United States             No
64    Male       Black United States   DATA_EXPIRED
65    Male       Black United States             No
66  Female Mixed/Other United States             No
67  Female       Black United States             No
68  Female       White United States            Yes
69    Male       White United States             No
70  Female       White United States            Yes
71  Female       White United States            Yes
72    Male Mixed/Other United States            Yes
73    Male       White United States             No
74    Male Mixed/Other United States   DATA_EXPIRED
75  Female       Asian United States             No
76    Male       White United States             No
77  Female       White United States             No
78  Female       White United States             No
79    Male       White United States             No
80    Male       Asian United States             No
81    Male Mixed/Other United States             No
82    Male       Asian United States             No
83    Male Mixed/Other United States             No
84  Female       Black United States            Yes
85  Female       Asian United States            Yes
86  Female Mixed/Other United States            Yes
87    Male Mixed/Other United States             No
88    Male       White United States             No
89    Male       Black United States            Yes
90    Male       Black United States             No
91  Female       White United States            Yes
92  Female       Black United States             No
93  Female       White United States             No
94  Female       White United States   DATA_EXPIRED
95    Male       Black United States             No
96    Male       Asian United States             No
97  Female Mixed/Other United States            Yes
98    Male       Asian United States             No
99    Male       Asian United States            Yes
100 Female       Asian United States   DATA_EXPIRED
101 Female       White United States             No
102   Male Mixed/Other United States   DATA_EXPIRED
103   Male       White United States             No
104 Female Mixed/Other United States            Yes
105 Female       Asian United States             No
106 Female       White United States   DATA_EXPIRED
107 Female       White United States            Yes
108   Male       Asian United States             No
109   Male       Black United States            Yes
110   Male       White United States            Yes
111   Male       White United States             No
112   Male       White United States             No
113 Female       Asian United States             No
114 Female       Asian United States             No
115   Male       White United States             No
116 Female       Asian United States             No
117   Male       Asian United States             No
118   Male       White United States             No
119   Male       Asian United States            Yes
120 Female Mixed/Other United States             No
121   Male       Black United States   DATA_EXPIRED
122 Female Mixed/Other United States            Yes
                                           Employment.status ZEROSUM_1
1                                                  Part-Time         4
2                               Unemployed (and job seeking)         5
3                                               DATA_EXPIRED         7
4                                                  Full-Time         2
5   Not in paid work (e.g. homemaker', 'retired or disabled)         1
6                                                  Full-Time         6
7                                                  Part-Time         5
8                                               DATA_EXPIRED         6
9                                               DATA_EXPIRED         6
10                                                 Full-Time         4
11                                                 Part-Time         2
12                                                 Full-Time         1
13                                                 Full-Time         4
14                                              DATA_EXPIRED         3
15                                                 Full-Time         3
16                                              DATA_EXPIRED         6
17                                                 Part-Time         2
18                                                 Full-Time         2
19                                                 Part-Time         4
20                                                 Full-Time         5
21                                              DATA_EXPIRED         1
22                                                 Full-Time         6
23                                                 Full-Time         4
24                                                 Part-Time         4
25                                                 Full-Time         2
26                                                 Full-Time         6
27  Not in paid work (e.g. homemaker', 'retired or disabled)         6
28                                                 Full-Time         4
29  Not in paid work (e.g. homemaker', 'retired or disabled)         5
30                                                 Part-Time         4
31                                                 Part-Time         6
32                                              DATA_EXPIRED         2
33                                                 Full-Time         5
34                              Unemployed (and job seeking)         4
35                                              DATA_EXPIRED         6
36                              Unemployed (and job seeking)         4
37                              Unemployed (and job seeking)         1
38                                                     Other         2
39                                                 Full-Time         5
40                                                 Full-Time         1
41                                                 Part-Time         2
42                                                 Full-Time         1
43                                                 Full-Time         5
44                                              DATA_EXPIRED         5
45                                                 Part-Time         4
46                                                 Full-Time         3
47                                                 Full-Time         5
48                                                 Part-Time         2
49                                                 Full-Time         3
50                                                 Part-Time         6
51                              Unemployed (and job seeking)         6
52                                                 Part-Time         4
53                              Unemployed (and job seeking)         1
54                                                 Part-Time         7
55                                                 Full-Time         5
56                                                 Part-Time         7
57                                                 Part-Time         5
58                                                 Full-Time         5
59                                                 Full-Time         1
60                                              DATA_EXPIRED         4
61                                                 Full-Time         5
62                                                 Part-Time         6
63  Not in paid work (e.g. homemaker', 'retired or disabled)         1
64                                                 Full-Time         3
65                                              DATA_EXPIRED         2
66  Not in paid work (e.g. homemaker', 'retired or disabled)         7
67                                                 Part-Time         7
68                                              DATA_EXPIRED         5
69                                                 Full-Time         3
70                                                 Part-Time         3
71                                                 Part-Time         5
72                                                 Part-Time         4
73                                                 Full-Time         5
74                                                 Full-Time         6
75              Due to start a new job within the next month         1
76                                                 Full-Time         6
77  Not in paid work (e.g. homemaker', 'retired or disabled)         1
78                                                 Part-Time         3
79                                                 Part-Time         5
80                              Unemployed (and job seeking)         3
81                                                 Full-Time         5
82                                                 Full-Time         5
83                                                 Full-Time         5
84                              Unemployed (and job seeking)         1
85                                                 Full-Time         6
86                                                 Part-Time         1
87                                              DATA_EXPIRED         3
88                                                     Other         4
89                              Unemployed (and job seeking)         5
90                                                 Full-Time         5
91                                                 Full-Time         5
92                                                 Part-Time         2
93                              Unemployed (and job seeking)         5
94  Not in paid work (e.g. homemaker', 'retired or disabled)         7
95                                                 Part-Time         6
96                                                 Full-Time         4
97                                                 Full-Time         4
98                                                 Full-Time         6
99  Not in paid work (e.g. homemaker', 'retired or disabled)         2
100                                             DATA_EXPIRED         4
101                                                Part-Time         1
102                                                Full-Time         5
103                                                Full-Time         3
104                                             DATA_EXPIRED         3
105                                                Part-Time         4
106                                             DATA_EXPIRED         5
107                                                    Other         1
108                                                Part-Time         6
109                                                Full-Time         5
110                                                Full-Time         1
111                                                Full-Time         1
112 Not in paid work (e.g. homemaker', 'retired or disabled)         5
113                                                Full-Time         5
114 Not in paid work (e.g. homemaker', 'retired or disabled)         1
115                                                Full-Time         2
116                                                Full-Time         3
117                                                Full-Time         4
118                                                Full-Time         3
119                             Unemployed (and job seeking)         4
120                             Unemployed (and job seeking)         3
121                                             DATA_EXPIRED         5
122                                                Full-Time         5
    ZEROSUM_2 ZEROSUM_3 ZEROSUM_4 ZEROSUM_5 ZEROSUM_6 ZEROSUM_7 ZEROSUM_8
1           3         5         4         4         5         4         5
2           7         5         4         3         6         4         4
3           5         5         7         3         7         7         3
4           7         6         1         1         1         2         2
5           5         5         1         1         1         5         1
6           5         3         5         2         5         4         2
7           5         6         4         5         5         4         5
8           7         7         4         5         7         5         7
9           6         4         4         4         4         2         1
10          5         5         4         4         7         7         3
11          3         5         4         4         4         5         1
12          5         4         1         1         1         1         1
13          5         4         2         1         4         2         3
14          6         7         2         1         1         1         2
15          3         4         3         3         4         4         4
16          7         5         1         1         7         2         1
17          6         5         3         3         3         4         4
18          5         7         2         2         1         2         1
19          4         3         4         1         5         1         4
20          7         7         1         1         1         1         1
21          7         7         1         1         1         6         1
22          1         6         5         1         1         1         5
23          4         4         4         4         4         5         5
24          4         3         5         1         1         1         1
25          5         5         1         1         1         2         6
26          6         6         5         6         6         5         6
27          4         4         6         4         7         7         4
28          4         2         4         3         3         2         1
29          7         6         3         5         2         3         3
30          4         4         3         3         4        NA         3
31          6         6         3         5         6         5         4
32          2         2         2         1         2         1         1
33          5         6         3         3         3         3         5
34          5         4         4         1         1         1         1
35          7         7         5         1         6         1         1
36          5         5         3         2         4         4         1
37          4         5         1         1         1         3         1
38          3         6         1         1         1         4         1
39          5         5         2         2         2         5         4
40          1         7         1         1         1         1         1
41          6         6         2         2         6         6         2
42          6         6         1         1         1         1         1
43          4         4         5         7         6         4         4
44          6         6         4         3         6         5         2
45          5         4         4         5         5         5         5
46          7         7         1         1         1         2         1
47          3         5         2         3         4         5         5
48          4         2         4         4         4         4         4
49          3         6         1         1         1         1         1
50          6         6         3         3         3         3         3
51          5         6         6         6         7         4         3
52          4         5         4         5         6         6         4
53          1         1         1         1         1         1         5
54          6         6         5         6         6         5         5
55          3         5         4         3         4         3         4
56          7         7         7         3         6         2         3
57          7         6         4         6         6         6         5
58          6         1         1         1         2         1         1
59          2         6         6         1         5         5         5
60          4         5         3         1         2         1         4
61          7         4         5         1         6         5         4
62          5         3         6         5         5         4         4
63          4         5         1         1         1         4         2
64          4         2         3         3         2         4         3
65          3         4         3         4         3         5         3
66          7         7         1         1         1         4         1
67          5         5         2         4         6         5         6
68          5         5         1         4         2         4         1
69          5         5         5         5         5         4         5
70          5         4         3         4         3         4         3
71          6         7         5         3         5         3         3
72          3         4         3         3         3         3         3
73          5         5         4         4         5         5         4
74          2         3         2         2         2         3         3
75          1         1         1         4         7         7         1
76          7         7         5         1         1         1         1
77          2         5         3         3         4         7         3
78          2         5         3         4         5         3         3
79          6         6         6         6         6         5         5
80          5         5         3         3         3         3         3
81          5         4         1         1         7         5         3
82          4         5         6         7         6         6         7
83          6         5         2         3         2         1         1
84          5         7         1         1         1         1         1
85          5         5         6         6         5         6         5
86          6         6         3         3         5         2         3
87          5         7         3         2         1         5         5
88          4         4         1         1         1         5         1
89          6         5         5         4         3         4         4
90          5         5         4         4         5         4         4
91          5         5         6         5         5         4         4
92         NA        NA        NA         1        NA        NA        NA
93          5         6         5         3         1         5         2
94          7         7         1         1         1         1         1
95          5         5         4         6         6         3         4
96          4         4         1         2         1         4         3
97          4         4         2         3         3         2         1
98          7         7         1         1         1         1         1
99          4         3         3         6         4         5         4
100         4         4         4         4         4         4         4
101         7         7         1         1         1         1         1
102         4         6         4         6         2         4         3
103         3         5         5         3         5         5         3
104         2         2         1         1         1         2         2
105         6         4         3         3         4         3         3
106         7         6         1         1         1         2         1
107         7         7         1         1         1         1         1
108         6         4         1         2         3         6         3
109         4         4         5         4         4         4         4
110         5         7         1         1         1         1         1
111         2         6         1         1         1         1         1
112         5         5         5         2         3         2         2
113         7         5         1         1         1         1         1
114         1         2         2         2         6         2         6
115         4         7         2         1         1         5         1
116         4         5         3         3         3         4         3
117         4         4         1         1         1         4         4
118         5         2         3         3         7         7         2
119         4         4         4         4         3         5         4
120         3         3         3         4         4         7         3
121         5         4         4         6         3         3         4
122         5         4         5         6         4         5         5
    ZEROSUM_9 ZEROSUM_10 ZEROSUM_11                 EDUCATION_LEVEL
1           3          5          5 Graduate or professional degree
2           5          4          3      High school diploma or GED
3           4          6          2     Some college, but no degree
4           1          1          2               Bachelor’s degree
5           1          1          4 Graduate or professional degree
6           6          3          4               Bachelor’s degree
7           7          5          4     Some college, but no degree
8           4          5          5               Bachelor’s degree
9           4          4          4      High school diploma or GED
10          6          5          4     Some college, but no degree
11          1          5          3 Graduate or professional degree
12          1          1          1 Graduate or professional degree
13          4          1          1               Bachelor’s degree
14          1          1          1               Bachelor’s degree
15          4          4          3 Graduate or professional degree
16          5          5          4      High school diploma or GED
17          6          6          7 Graduate or professional degree
18          1          2          2               Bachelor’s degree
19          4          1          4 Graduate or professional degree
20          1          1          4               Bachelor’s degree
21          1          1          1               Bachelor’s degree
22          1          1          1               Bachelor’s degree
23          4          4          4               Bachelor’s degree
24          1          1          5               Bachelor’s degree
25          1          1          1 Graduate or professional degree
26          2          6          5     Some college, but no degree
27          5          4          6      High school diploma or GED
28          3          4          4               Bachelor’s degree
29          3          1          1               Bachelor’s degree
30          3          4          4     Some college, but no degree
31          2          5          5 Graduate or professional degree
32          1          1          1               Bachelor’s degree
33          3          4          3     Some college, but no degree
34          1          1          1  Associates or technical degree
35          2          3          2               Bachelor’s degree
36          1          3          3      High school diploma or GED
37          1          4          1     Some college, but no degree
38          1          3          4     Some college, but no degree
39          2          3          4               Bachelor’s degree
40          1          1          1               Bachelor’s degree
41          2          2          2               Bachelor’s degree
42          1          2          1               Bachelor’s degree
43          4          5          6 Graduate or professional degree
44          1          2          1     Some college, but no degree
45          4          5          5     Some college, but no degree
46          1          3          1               Bachelor’s degree
47          3          3          4 Graduate or professional degree
48          1          4          2 Graduate or professional degree
49          1          1          1               Bachelor’s degree
50          3          3          3               Bachelor’s degree
51          5          2          5      High school diploma or GED
52          5          5          6 Graduate or professional degree
53          1          1          1  Associates or technical degree
54          5          6          6 Graduate or professional degree
55          2          6          2               Bachelor’s degree
56          2          4          6 Graduate or professional degree
57          6          7          6 Graduate or professional degree
58          1          1          1               Bachelor’s degree
59          2          5          2     Some college, but no degree
60          1          2          2               Bachelor’s degree
61          7          4          5 Graduate or professional degree
62          4          4          6 Graduate or professional degree
63          1          1          2  Associates or technical degree
64          3          3          2 Graduate or professional degree
65          4          4          2 Graduate or professional degree
66          1          1          1     Some college, but no degree
67          4          5          5 Graduate or professional degree
68          1          5          4     Some college, but no degree
69          6          5          5 Graduate or professional degree
70          3          3          4               Bachelor’s degree
71          3          3          4               Bachelor’s degree
72          1          3          2               Bachelor’s degree
73          4          4          4               Bachelor’s degree
74          5          6          4 Graduate or professional degree
75          1          6          5               Bachelor’s degree
76          1          1          1               Bachelor’s degree
77          1          5          3  Associates or technical degree
78          2          3          5 Graduate or professional degree
79          5          5          6               Bachelor’s degree
80          3          3          3     Some college, but no degree
81          1          4          7      High school diploma or GED
82          5          6          6 Graduate or professional degree
83          1          1          1 Graduate or professional degree
84          1          1          1  Associates or technical degree
85          4          6          6 Graduate or professional degree
86          1          3          6 Graduate or professional degree
87          1          3          4               Bachelor’s degree
88          1          2          4 Graduate or professional degree
89          3          4          3 Graduate or professional degree
90          2          4          2               Bachelor’s degree
91          5          6          5 Graduate or professional degree
92         NA          1         NA     Some college, but no degree
93          1          2          2      High school diploma or GED
94          1          1          1               Bachelor’s degree
95          5          4          3 Graduate or professional degree
96          2          3          1 Graduate or professional degree
97          3          3          3               Bachelor’s degree
98          1          1          1               Bachelor’s degree
99          3          2          3     Some college, but no degree
100         4          4          4  Associates or technical degree
101         1          1          1               Bachelor’s degree
102         7          6          2               Bachelor’s degree
103         3          3          3 Graduate or professional degree
104         1          2          2  Associates or technical degree
105         1          3          3 Graduate or professional degree
106         1          1          1               Bachelor’s degree
107         1          1          1     Some college, but no degree
108         2          5          4 Graduate or professional degree
109         5          3          4 Graduate or professional degree
110         1          1          1               Bachelor’s degree
111         1          1          1 Graduate or professional degree
112         2          2          2     Some college, but no degree
113         1          1          1               Bachelor’s degree
114         2          6          6               Bachelor’s degree
115         1          1          3     Some college, but no degree
116         3          3          4 Graduate or professional degree
117         1          2          2 Graduate or professional degree
118         1          5          6     Some college, but no degree
119         2          5          3     Some college, but no degree
120         3          3          3               Bachelor’s degree
121         4          4          3               Bachelor’s degree
122         5          6          4               Bachelor’s degree
          RELIGIOUS_Identity            VOTE_2024 RACIALIDENTITY.6
1                  Christian         Donald Trump            Black
2   Religiously Unaffiliated         Donald Trump            White
3   Religiously Unaffiliated DID NOT VOTE IN 2024            Mixed
4                  Christian        Kamala Harris            Asian
5                  Christian        Kamala Harris            White
6                  Christian         Donald Trump            Black
7                  Christian         Donald Trump            White
8   Religiously Unaffiliated DID NOT VOTE IN 2024            White
9                      Other DID NOT VOTE IN 2024            White
10                 Christian         Donald Trump            White
11                 Christian         Donald Trump            White
12             Folk Religion        Kamala Harris            Other
13                 Christian        Kamala Harris            Black
14  Religiously Unaffiliated        Kamala Harris            Mixed
15                 Christian         Donald Trump            Other
16                     Other DID NOT VOTE IN 2024            Black
17                 Christian         Donald Trump            Black
18                      <NA>        Kamala Harris            White
19                 Christian         Donald Trump            Black
20                 Christian        Kamala Harris            White
21                     Other        Kamala Harris            White
22                 Christian                 <NA>            Black
23                 Christian        Kamala Harris            Black
24                 Christian        Kamala Harris            Asian
25                 Christian         Donald Trump            White
26         Decline to answer         Donald Trump            Black
27                 Christian         Donald Trump           Latine
28                 Christian        Kamala Harris            White
29                 Christian                 <NA>            White
30  Religiously Unaffiliated        Kamala Harris            Asian
31                 Christian         Donald Trump            Black
32                 Christian DID NOT VOTE IN 2024            Asian
33                 Christian        Kamala Harris           Latine
34  Religiously Unaffiliated        Kamala Harris            Mixed
35         Decline to answer DID NOT VOTE IN 2024            Asian
36  Religiously Unaffiliated        Kamala Harris            Asian
37  Religiously Unaffiliated        Kamala Harris            Mixed
38  Religiously Unaffiliated DID NOT VOTE IN 2024           Latine
39  Religiously Unaffiliated         Chase Oliver            White
40                 Christian        Kamala Harris           Latine
41                 Christian        Kamala Harris            White
42  Religiously Unaffiliated        Kamala Harris            White
43                 Christian         Donald Trump           Latine
44  Religiously Unaffiliated DID NOT VOTE IN 2024            White
45                 Christian        Kamala Harris           Latine
46                     Other        Kamala Harris            Asian
47  Religiously Unaffiliated         Donald Trump            Asian
48                 Christian         Donald Trump            White
49  Religiously Unaffiliated        Kamala Harris            Black
50         Decline to answer        Kamala Harris            White
51  Religiously Unaffiliated DID NOT VOTE IN 2024            Mixed
52                 Christian         Donald Trump            White
53                 Christian          Cornel West            Black
54                 Christian         Donald Trump            Black
55                 Christian         Donald Trump            Black
56                 Christian         Donald Trump            White
57                 Christian         Donald Trump            White
58                 Christian         Donald Trump            Black
59  Religiously Unaffiliated         Donald Trump           Latine
60  Religiously Unaffiliated        Kamala Harris            Asian
61                 Christian         Donald Trump            Black
62                 Christian         Donald Trump            White
63  Religiously Unaffiliated        Kamala Harris            White
64                 Christian         Donald Trump            Black
65                 Christian         Donald Trump            Black
66  Religiously Unaffiliated        Kamala Harris            White
67                 Christian         Donald Trump            Black
68                 Christian        Kamala Harris            White
69  Religiously Unaffiliated         Donald Trump            White
70                 Christian         Donald Trump            White
71                 Christian DID NOT VOTE IN 2024            White
72  Religiously Unaffiliated        Kamala Harris            Other
73                 Christian         Donald Trump            White
74  Religiously Unaffiliated         Donald Trump            Black
75  Religiously Unaffiliated         Donald Trump            Asian
76  Religiously Unaffiliated        Kamala Harris            White
77                 Christian         Donald Trump            White
78                 Christian         Donald Trump            White
79                 Christian         Donald Trump            White
80                 Christian DID NOT VOTE IN 2024            Asian
81                 Christian        Kamala Harris            Mixed
82  Religiously Unaffiliated         Donald Trump            White
83  Religiously Unaffiliated        Kamala Harris           Latine
84  Religiously Unaffiliated        Kamala Harris            Black
85                 Christian         Donald Trump            Asian
86                 Christian        Kamala Harris            Black
87  Religiously Unaffiliated        Kamala Harris            Mixed
88                    Jewish        Kamala Harris            White
89                 Christian         Donald Trump            Black
90                 Christian         Donald Trump            Black
91                 Christian         Donald Trump            White
92                 Christian        Kamala Harris            Black
93  Religiously Unaffiliated DID NOT VOTE IN 2024            White
94                    Muslim        Kamala Harris            White
95                 Christian         Donald Trump            Black
96  Religiously Unaffiliated         Donald Trump            Asian
97                 Christian         Donald Trump           Latine
98  Religiously Unaffiliated        Kamala Harris            Asian
99                 Christian DID NOT VOTE IN 2024            Asian
100                   Muslim DID NOT VOTE IN 2024            Asian
101 Religiously Unaffiliated        Kamala Harris            White
102                Christian         Donald Trump            Mixed
103                Christian        Kamala Harris            White
104 Religiously Unaffiliated        Kamala Harris            Mixed
105                Christian         Donald Trump            Asian
106                Christian         Donald Trump            White
107 Religiously Unaffiliated        Kamala Harris            White
108                    Hindu        Kamala Harris            Asian
109                Christian                 <NA>            Black
110 Religiously Unaffiliated        Kamala Harris            White
111 Religiously Unaffiliated        Kamala Harris            White
112                Christian        Kamala Harris            White
113 Religiously Unaffiliated        Kamala Harris            Asian
114 Religiously Unaffiliated DID NOT VOTE IN 2024            Asian
115 Religiously Unaffiliated DID NOT VOTE IN 2024            White
116 Religiously Unaffiliated        Kamala Harris            Asian
117 Religiously Unaffiliated        Kamala Harris            Asian
118 Religiously Unaffiliated         Donald Trump            White
119                    Hindu         Donald Trump            Asian
120                Christian         Donald Trump            Mixed
121 Religiously Unaffiliated         Donald Trump            Black
122                Christian        Kamala Harris            White
    RACIALIDENTITY.4 RACIALIDENTITY.2 RI_White RI_Else GENDER_MALE RACE_BLACK
1              Black             Else        0       1           1          1
2              White            White        1       0           1          0
3        Mixed/Other             Else        0       1           1          0
4              Asian             Else        0       1           0          0
5              White            White        1       0           1          0
6              Black             Else        0       1           0          1
7              White            White        1       0           0          0
8              White            White        1       0           1          0
9              White            White        1       0           0          0
10             White            White        1       0           0          0
11             White            White        1       0           1          0
12       Mixed/Other             Else        0       1           0          0
13             Black             Else        0       1           0          1
14       Mixed/Other             Else        0       1           0          0
15       Mixed/Other             Else        0       1           1          0
16             Black             Else        0       1           0          1
17             Black             Else        0       1           0          1
18             White            White        1       0           1          0
19             Black             Else        0       1           0          1
20             White            White        1       0           1          0
21             White            White        1       0           0          0
22             Black             Else        0       1           1          1
23             Black             Else        0       1           1          1
24             Asian             Else        0       1           1          0
25             White            White        1       0           0          0
26             Black             Else        0       1           0          1
27       Mixed/Other             Else        0       1           0          0
28             White            White        1       0           0          0
29             White            White        1       0           0          0
30             Asian             Else        0       1           1          0
31             Black             Else        0       1           0          1
32             Asian             Else        0       1           1          0
33       Mixed/Other             Else        0       1           0          0
34       Mixed/Other             Else        0       1           0          0
35             Asian             Else        0       1           1          0
36             Asian             Else        0       1           0          0
37       Mixed/Other             Else        0       1           1          0
38       Mixed/Other             Else        0       1           1          0
39             White            White        1       0           1          0
40       Mixed/Other             Else        0       1           1          0
41             White            White        1       0           1          0
42             White            White        1       0           1          0
43       Mixed/Other             Else        0       1           0          0
44             White            White        1       0           1          0
45       Mixed/Other             Else        0       1           1          0
46             Asian             Else        0       1           0          0
47             Asian             Else        0       1           0          0
48             White            White        1       0           1          0
49             Black             Else        0       1           1          1
50             White            White        1       0           0          0
51       Mixed/Other             Else        0       1           1          0
52             White            White        1       0           1          0
53             Black             Else        0       1           1          1
54             Black             Else        0       1           0          1
55             Black             Else        0       1           0          1
56             White            White        1       0           1          0
57             White            White        1       0           0          0
58             Black             Else        0       1           0          1
59       Mixed/Other             Else        0       1           1          0
60             Asian             Else        0       1           0          0
61             Black             Else        0       1           1          1
62             White            White        1       0           0          0
63             White            White        1       0           0          0
64             Black             Else        0       1           1          1
65             Black             Else        0       1           1          1
66             White            White        1       0           0          0
67             Black             Else        0       1           0          1
68             White            White        1       0           0          0
69             White            White        1       0           1          0
70             White            White        1       0           0          0
71             White            White        1       0           0          0
72       Mixed/Other             Else        0       1           1          0
73             White            White        1       0           1          0
74             Black             Else        0       1           1          1
75             Asian             Else        0       1           0          0
76             White            White        1       0           1          0
77             White            White        1       0           0          0
78             White            White        1       0           0          0
79             White            White        1       0           1          0
80             Asian             Else        0       1           1          0
81       Mixed/Other             Else        0       1           1          0
82             White            White        1       0           1          0
83       Mixed/Other             Else        0       1           1          0
84             Black             Else        0       1           0          1
85             Asian             Else        0       1           0          0
86             Black             Else        0       1           0          1
87       Mixed/Other             Else        0       1           1          0
88             White            White        1       0           1          0
89             Black             Else        0       1           1          1
90             Black             Else        0       1           1          1
91             White            White        1       0           0          0
92             Black             Else        0       1           0          1
93             White            White        1       0           0          0
94             White            White        1       0           0          0
95             Black             Else        0       1           1          1
96             Asian             Else        0       1           1          0
97       Mixed/Other             Else        0       1           0          0
98             Asian             Else        0       1           1          0
99             Asian             Else        0       1           1          0
100            Asian             Else        0       1           0          0
101            White            White        1       0           0          0
102      Mixed/Other             Else        0       1           1          0
103            White            White        1       0           1          0
104      Mixed/Other             Else        0       1           0          0
105            Asian             Else        0       1           0          0
106            White            White        1       0           0          0
107            White            White        1       0           0          0
108            Asian             Else        0       1           1          0
109            Black             Else        0       1           1          1
110            White            White        1       0           1          0
111            White            White        1       0           1          0
112            White            White        1       0           1          0
113            Asian             Else        0       1           0          0
114            Asian             Else        0       1           0          0
115            White            White        1       0           1          0
116            Asian             Else        0       1           0          0
117            Asian             Else        0       1           1          0
118            White            White        1       0           1          0
119            Asian             Else        0       1           1          0
120      Mixed/Other             Else        0       1           0          0
121            Black             Else        0       1           1          1
122            White            White        1       0           0          0
    RACE_ASIAN RACE_OTHER RELIGIOUS_YES EDUCATION_HIGH ZEROSUM_ECONOMIC
1            0          0             1              1              4.0
2            0          0             0              0              6.0
3            0          1             0              0              5.0
4            1          0             1              1              6.5
5            0          0             1              1              5.0
6            0          0             1              1              4.0
7            0          0             1              0              5.5
8            0          0             0              1              7.0
9            0          0             1              0              5.0
10           0          0             1              0              5.0
11           0          0             1              1              4.0
12           0          1             1              1              4.5
13           0          0             1              1              4.5
14           0          1             0              1              6.5
15           0          1             1              1              3.5
16           0          0             1              0              6.0
17           0          0             1              1              5.5
18           0          0             1              1              6.0
19           0          0             1              1              3.5
20           0          0             1              1              7.0
21           0          0             1              1              7.0
22           0          0             1              1              3.5
23           0          0             1              1              4.0
24           1          0             1              1              3.5
25           0          0             1              1              5.0
26           0          0             0              0              6.0
27           0          1             1              0              4.0
28           0          0             1              1              3.0
29           0          0             1              1              6.5
30           1          0             0              0              4.0
31           0          0             1              1              6.0
32           1          0             1              1              2.0
33           0          1             1              0              5.5
34           0          1             0              0              4.5
35           1          0             0              1              7.0
36           1          0             0              0              5.0
37           0          1             0              0              4.5
38           0          1             0              0              4.5
39           0          0             0              1              5.0
40           0          1             1              1              4.0
41           0          0             1              1              6.0
42           0          0             0              1              6.0
43           0          1             1              1              4.0
44           0          0             0              0              6.0
45           0          1             1              0              4.5
46           1          0             1              1              7.0
47           1          0             0              1              4.0
48           0          0             1              1              3.0
49           0          0             0              1              4.5
50           0          0             0              1              6.0
51           0          1             0              0              5.5
52           0          0             1              1              4.5
53           0          0             1              0              1.0
54           0          0             1              1              6.0
55           0          0             1              1              4.0
56           0          0             1              1              7.0
57           0          0             1              1              6.5
58           0          0             1              1              3.5
59           0          1             0              0              4.0
60           1          0             0              1              4.5
61           0          0             1              1              5.5
62           0          0             1              1              4.0
63           0          0             0              0              4.5
64           0          0             1              1              3.0
65           0          0             1              1              3.5
66           0          0             0              0              7.0
67           0          0             1              1              5.0
68           0          0             1              0              5.0
69           0          0             0              1              5.0
70           0          0             1              1              4.5
71           0          0             1              1              6.5
72           0          1             0              1              3.5
73           0          0             1              1              5.0
74           0          0             0              1              2.5
75           1          0             0              1              1.0
76           0          0             0              1              7.0
77           0          0             1              0              3.5
78           0          0             1              1              3.5
79           0          0             1              1              6.0
80           1          0             1              0              5.0
81           0          1             1              0              4.5
82           0          0             0              1              4.5
83           0          1             0              1              5.5
84           0          0             0              0              6.0
85           1          0             1              1              5.0
86           0          0             1              1              6.0
87           0          1             0              1              6.0
88           0          0             1              1              4.0
89           0          0             1              1              5.5
90           0          0             1              1              5.0
91           0          0             1              1              5.0
92           0          0             1              0               NA
93           0          0             0              0              5.5
94           0          0             1              1              7.0
95           0          0             1              1              5.0
96           1          0             0              1              4.0
97           0          1             1              1              4.0
98           1          0             0              1              7.0
99           1          0             1              0              3.5
100          1          0             1              0              4.0
101          0          0             0              1              7.0
102          0          1             1              1              5.0
103          0          0             1              1              4.0
104          0          1             0              0              2.0
105          1          0             1              1              5.0
106          0          0             1              1              6.5
107          0          0             0              0              7.0
108          1          0             1              1              5.0
109          0          0             1              1              4.0
110          0          0             0              1              6.0
111          0          0             0              1              4.0
112          0          0             1              0              5.0
113          1          0             0              1              6.0
114          1          0             0              1              1.5
115          0          0             0              0              5.5
116          1          0             0              1              4.5
117          1          0             0              1              4.0
118          0          0             0              0              3.5
119          1          0             1              0              4.0
120          0          1             1              1              3.0
121          0          0             0              1              4.5
122          0          0             1              1              4.5
    ZEROSUM_IDENTITY TRUMPVOTE
1              4.375         1
2              4.125         1
3              4.875        NA
4              1.375         0
5              1.875         0
6              3.875         1
7              4.875         1
8              5.250        NA
9              3.375        NA
10             5.000         1
11             3.375         1
12             1.000         0
13             2.250         0
14             1.250         0
15             3.625         1
16             3.250        NA
17             4.500         1
18             1.625         0
19             3.000         1
20             1.375         0
21             1.625         0
22             2.000        NA
23             4.250         0
24             2.000         0
25             1.750         1
26             5.125         1
27             5.375         1
28             3.000         0
29             2.625        NA
30                NA         0
31             4.375         1
32             1.250        NA
33             3.375         0
34             1.375         0
35             2.625        NA
36             2.625         0
37             1.625         0
38             2.000        NA
39             3.000        NA
40             1.000         0
41             3.000         0
42             1.125         0
43             5.125         1
44             3.000        NA
45             4.750         0
46             1.375         0
47             3.625         1
48             3.375         1
49             1.000         0
50             3.000         0
51             4.750        NA
52             5.125         1
53             1.500        NA
54             5.500         1
55             3.500         1
56             4.125         1
57             5.750         1
58             1.125         1
59             3.875         1
60             2.000         0
61             4.625         1
62             4.750         1
63             1.625         0
64             2.875         1
65             3.500         1
66             1.375         0
67             4.625         1
68             2.750         0
69             5.000         1
70             3.375         1
71             3.625        NA
72             2.625         0
73             4.250         1
74             3.375         1
75             4.000         1
76             1.500         0
77             3.625         1
78             3.500         1
79             5.500         1
80             3.000        NA
81             3.625         0
82             6.125         1
83             1.500         0
84             1.000         0
85             5.500         1
86             3.250         0
87             3.000         0
88             2.000         0
89             3.750         1
90             3.625         1
91             5.000         1
92                NA         0
93             2.625        NA
94             1.000         0
95             4.375         1
96             2.125         1
97             2.500         1
98             1.000         0
99             3.750        NA
100            4.000        NA
101            1.000         0
102            4.250         1
103            3.750         0
104            1.500         0
105            2.875         1
106            1.125         1
107            1.000         0
108            3.250         0
109            4.125        NA
110            1.000         0
111            1.000         0
112            2.500         0
113            1.000         0
114            4.000        NA
115            1.875        NA
116            3.250         0
117            2.000         0
118            4.250         1
119            3.750         1
120            3.750         1
121            3.875         1
122            5.000         0
In [8]:
Show the code

# Fit the logistic regression model
logregmodel.v1 <- glm(TRUMPVOTE ~ POLITICALBELIEFS + AGE + SOCIALSTATUS + ZEROSUM_IDENTITY + ZEROSUM_ECONOMIC + ZEROSUM_1,
             data = select_data, 
             family = binomial)

# View the results
summary(logregmodel.v1)

Call:
glm(formula = TRUMPVOTE ~ POLITICALBELIEFS + AGE + SOCIALSTATUS + 
    ZEROSUM_IDENTITY + ZEROSUM_ECONOMIC + ZEROSUM_1, family = binomial, 
    data = select_data)

Coefficients:
                  Estimate Std. Error z value Pr(>|z|)    
(Intercept)      -11.61362    3.90845  -2.971 0.002964 ** 
POLITICALBELIEFS   1.78884    0.49287   3.629 0.000284 ***
AGE               -0.01637    0.03194  -0.512 0.608355    
SOCIALSTATUS       0.36552    0.23201   1.575 0.115151    
ZEROSUM_IDENTITY   1.13959    0.35467   3.213 0.001313 ** 
ZEROSUM_ECONOMIC  -0.12804    0.38379  -0.334 0.738667    
ZEROSUM_1          0.23032    0.25305   0.910 0.362740    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(Dispersion parameter for binomial family taken to be 1)

    Null deviance: 135.816  on 97  degrees of freedom
Residual deviance:  53.035  on 91  degrees of freedom
  (24 observations deleted due to missingness)
AIC: 67.035

Number of Fisher Scoring iterations: 7
In [9]:
Show the code

# Fit the logistic regression model
logregmodel.v1 <- glm(TRUMPVOTE ~ POLITICALBELIEFS + AGE + SOCIALSTATUS + ZEROSUM_IDENTITY + ZEROSUM_ECONOMIC + ZEROSUM_1,
             data = select_data, 
             family = binomial)

# Tidy model output
logit_table <- broom::tidy(logregmodel.v1, conf.int = TRUE) %>%
  rename(Predictor = term,
         B = estimate,
         SE = std.error,
         z = statistic,
         p = p.value,
         CI_lower = conf.low,
         CI_upper = conf.high)

# Display APA-style table
nice_table(logit_table, 
           title = c("Table 12", "Logistic Regression Predicting Trump Vote"), 
           highlight = 0.05, 
           stars = TRUE)

Table 12

Logistic Regression Predicting Trump Vote

Predictor

b*

SE

z

p

95% CI

(Intercept)

-11.61

3.91

-2.97

.003**

[-20.66, -5.07]

POLITICALBELIEFS

1.79

0.49

3.63

< .001***

[0.96, 2.94]

AGE

-0.02

0.03

-0.51

.608

[-0.08, 0.05]

SOCIALSTATUS

0.37

0.23

1.58

.115

[-0.07, 0.85]

ZEROSUM_IDENTITY

1.14

0.35

3.21

.001**

[0.51, 1.93]

ZEROSUM_ECONOMIC

-0.13

0.38

-0.33

.739

[-0.89, 0.64]

ZEROSUM_1

0.23

0.25

0.91

.363

[-0.25, 0.76]

In [10]:
Show the code

# Fit the logistic regression model
logregmodel.v2 <- glm(TRUMPVOTE ~ POLITICALBELIEFS + ZEROSUM_ECONOMIC + ZEROSUM_IDENTITY + ZEROSUM_1 + GENDER_MALE +
                  RELIGIOUS_YES + RACE_BLACK + RACE_ASIAN + RACE_OTHER + EDUCATION_HIGH + SOCIALSTATUS,
             data = select_data, 
             family = binomial)

# View the results
summary(logregmodel.v2)

Call:
glm(formula = TRUMPVOTE ~ POLITICALBELIEFS + ZEROSUM_ECONOMIC + 
    ZEROSUM_IDENTITY + ZEROSUM_1 + GENDER_MALE + RELIGIOUS_YES + 
    RACE_BLACK + RACE_ASIAN + RACE_OTHER + EDUCATION_HIGH + SOCIALSTATUS, 
    family = binomial, data = select_data)

Coefficients:
                  Estimate Std. Error z value Pr(>|z|)    
(Intercept)      -13.80408    5.15793  -2.676 0.007444 ** 
POLITICALBELIEFS   2.38565    0.68386   3.489 0.000486 ***
ZEROSUM_ECONOMIC  -0.24044    0.43674  -0.551 0.581957    
ZEROSUM_IDENTITY   1.42782    0.46280   3.085 0.002034 ** 
ZEROSUM_1          0.33148    0.29006   1.143 0.253123    
GENDER_MALE       -1.34865    0.88445  -1.525 0.127297    
RELIGIOUS_YES     -0.08909    0.97063  -0.092 0.926867    
RACE_BLACK         0.42955    1.04054   0.413 0.679744    
RACE_ASIAN        -2.34440    1.38848  -1.688 0.091323 .  
RACE_OTHER        -1.63962    1.43818  -1.140 0.254259    
EDUCATION_HIGH     1.09411    1.12389   0.974 0.330305    
SOCIALSTATUS       0.22134    0.26677   0.830 0.406722    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(Dispersion parameter for binomial family taken to be 1)

    Null deviance: 137.152  on 98  degrees of freedom
Residual deviance:  43.097  on 87  degrees of freedom
  (23 observations deleted due to missingness)
AIC: 67.097

Number of Fisher Scoring iterations: 7
In [11]:
Show the code

# Fit the logistic regression model
logregmodel.v2 <- glm(TRUMPVOTE ~ POLITICALBELIEFS + ZEROSUM_ECONOMIC + ZEROSUM_IDENTITY + ZEROSUM_1 + GENDER_MALE +
    RELIGIOUS_YES + RACE_BLACK + RACE_ASIAN + RACE_OTHER + EDUCATION_HIGH + SOCIALSTATUS,
             data = select_data, 
             family = binomial)

# Tidy model output
logit_table <- broom::tidy(logregmodel.v2, conf.int = TRUE) %>%
  rename(Predictor = term,
         B = estimate,
         SE = std.error,
         z = statistic,
         p = p.value,
         CI_lower = conf.low,
         CI_upper = conf.high)

# Display APA-style table
nice_table(logit_table, 
           title = c("Table 12", "Logistic Regression Predicting Trump Vote"), 
           highlight = 0.05, 
           stars = TRUE)

Table 12

Logistic Regression Predicting Trump Vote

Predictor

b*

SE

z

p

95% CI

(Intercept)

-13.80

5.16

-2.68

.007**

[-26.36, -5.47]

POLITICALBELIEFS

2.39

0.68

3.49

< .001***

[1.29, 4.06]

ZEROSUM_ECONOMIC

-0.24

0.44

-0.55

.582

[-1.12, 0.63]

ZEROSUM_IDENTITY

1.43

0.46

3.09

.002**

[0.63, 2.51]

ZEROSUM_1

0.33

0.29

1.14

.253

[-0.21, 0.96]

GENDER_MALE

-1.35

0.88

-1.52

.127

[-3.27, 0.30]

RELIGIOUS_YES

-0.09

0.97

-0.09

.927

[-2.07, 1.84]

RACE_BLACK

0.43

1.04

0.41

.680

[-1.63, 2.56]

RACE_ASIAN

-2.34

1.39

-1.69

.091

[-5.36, 0.20]

RACE_OTHER

-1.64

1.44

-1.14

.254

[-4.94, 0.96]

EDUCATION_HIGH

1.09

1.12

0.97

.330

[-1.05, 3.50]

SOCIALSTATUS

0.22

0.27

0.83

.407

[-0.30, 0.77]

In [12]:
Show the code

# Create prediction data for one variable (holding others at mean)
pred_data <- with(select_data, 
  data.frame(
    POLITICALBELIEFS = seq(min(POLITICALBELIEFS, na.rm = TRUE), 
                          max(POLITICALBELIEFS, na.rm = TRUE), length = 100),
    AGE = mean(AGE, na.rm = TRUE),
    SOCIALSTATUS = mean(SOCIALSTATUS, na.rm = TRUE),
    ZEROSUM_IDENTITY = mean(ZEROSUM_IDENTITY, na.rm = TRUE),
    ZEROSUM_ECONOMIC = mean(ZEROSUM_ECONOMIC, na.rm = TRUE),
    ZEROSUM_1 = mean(ZEROSUM_1, na.rm = TRUE)
  ))

# Get predictions with standard errors
predictions <- predict(logregmodel.v1, pred_data, type = "link", se.fit = TRUE)

# Convert to probabilities and calculate confidence intervals
pred_data$predicted_prob <- plogis(predictions$fit)
pred_data$lower_ci <- plogis(predictions$fit - 1.96 * predictions$se.fit)
pred_data$upper_ci <- plogis(predictions$fit + 1.96 * predictions$se.fit)

# Plot with confidence intervals and proper labels
plot.TRUMPVOTE.POLITICIALBELIEFS <- ggplot(pred_data, aes(x = POLITICALBELIEFS, y = predicted_prob)) +
  geom_ribbon(aes(ymin = lower_ci, ymax = upper_ci), alpha = 0.3, fill = "purple") +
  geom_line(color = "purple", size = 1) +
  scale_x_continuous(
    breaks = 1:7,
    labels = c("Far Left /\nLeftist", "Very Liberal", "Liberal", "Moderate", 
               "Conservative", "Very\nConservative", "Alt-Right /\nFar-Right")
  ) +
  labs(title = "Predicted Probability of Trump Vote by Political Beliefs",
       subtitle = "With 95% Confidence Intervals",
       x = "Political Beliefs", y = "Predicted Probability") +
  theme_minimal() +
  theme(axis.text.x = element_text(angle = 45, hjust = 1, size = 9))
Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
ℹ Please use `linewidth` instead.
Show the code

# Print and save the plots
print(plot.TRUMPVOTE.POLITICIALBELIEFS)

Show the code

ggsave("plot12:TRUMPVOTE.POLITICIALBELIEFS.png", 
       plot = plot.TRUMPVOTE.POLITICIALBELIEFS, 
       width = 10, 
       height = 8, 
       dpi = 300)
In [13]:
Show the code

# Create prediction data for ZEROSUM_IDENTITY (holding others at mean)
pred_data_identity <- with(select_data, 
  data.frame(
    ZEROSUM_IDENTITY = seq(min(ZEROSUM_IDENTITY, na.rm = TRUE), 
                          max(ZEROSUM_IDENTITY, na.rm = TRUE), length = 100),
    POLITICALBELIEFS = mean(POLITICALBELIEFS, na.rm = TRUE),
    AGE = mean(AGE, na.rm = TRUE),
    SOCIALSTATUS = mean(SOCIALSTATUS, na.rm = TRUE),
    ZEROSUM_ECONOMIC = mean(ZEROSUM_ECONOMIC, na.rm = TRUE),
    ZEROSUM_1 = mean(ZEROSUM_1, na.rm = TRUE)
  ))

# Get predictions with standard errors
predictions_identity <- predict(logregmodel.v1, pred_data_identity, type = "link", se.fit = TRUE)

# Convert to probabilities and calculate confidence intervals
pred_data_identity$predicted_prob <- plogis(predictions_identity$fit)
pred_data_identity$lower_ci <- plogis(predictions_identity$fit - 1.96 * predictions_identity$se.fit)
pred_data_identity$upper_ci <- plogis(predictions_identity$fit + 1.96 * predictions_identity$se.fit)

# Plot with confidence intervals and proper labels
plot.TRUMPVOTE.ZEROSUM_IDENTITY <- ggplot(pred_data_identity, aes(x = ZEROSUM_IDENTITY, y = predicted_prob)) +
  geom_ribbon(aes(ymin = lower_ci, ymax = upper_ci), alpha = 0.3, fill = "red") +
  geom_line(color = "red", size = 1) +
  scale_x_continuous(
    breaks = 1:7,
    labels = c("Strongly\nDisbelieve", "Disbelieve", "Somewhat\nDisbelieve", 
               "Neither\nDisbelieve\nnor Believe", "Somewhat\nBelieve", 
               "Believe", "Strongly\nBelieve")
  ) +
  labs(title = "Predicted Probability of Trump Vote by Zero-Sum IDENTITY Beliefs",
       subtitle = "With 95% Confidence Intervals",
       x = "Zero-Sum IDENTITY Beliefs", y = "Predicted Probability") +
  theme_minimal() +
  theme(axis.text.x = element_text(angle = 45, hjust = 1, size = 9))

# Print and save the plots
print(plot.TRUMPVOTE.ZEROSUM_IDENTITY)

Show the code

ggsave("plot13:TRUMPVOTE.ZEROSUM_IDENTITY.png", 
       plot = plot.TRUMPVOTE.ZEROSUM_IDENTITY, 
       width = 10, 
       height = 8, 
       dpi = 300)
In [14]:
Show the code

# Create prediction data for ZEROSUM_ECONOMIC (holding others at mean)
pred_data_econ <- with(select_data, 
  data.frame(
    ZEROSUM_ECONOMIC = seq(min(ZEROSUM_ECONOMIC, na.rm = TRUE), 
                          max(ZEROSUM_ECONOMIC, na.rm = TRUE), length = 100),
    POLITICALBELIEFS = mean(POLITICALBELIEFS, na.rm = TRUE),
    AGE = mean(AGE, na.rm = TRUE),
    SOCIALSTATUS = mean(SOCIALSTATUS, na.rm = TRUE),
    ZEROSUM_IDENTITY = mean(ZEROSUM_IDENTITY, na.rm = TRUE),
    ZEROSUM_1 = mean(ZEROSUM_1, na.rm = TRUE)
  ))

# Get predictions with standard errors
predictions_econ <- predict(logregmodel.v1, pred_data_econ, type = "link", se.fit = TRUE)

# Convert to probabilities and calculate confidence intervals
pred_data_econ$predicted_prob <- plogis(predictions_econ$fit)
pred_data_econ$lower_ci <- plogis(predictions_econ$fit - 1.96 * predictions_econ$se.fit)
pred_data_econ$upper_ci <- plogis(predictions_econ$fit + 1.96 * predictions_econ$se.fit)

# Plot with confidence intervals and proper labels
plot.TRUMPVOTE.ZEROSUM_ECONOMIC <- ggplot(pred_data_econ, aes(x = ZEROSUM_ECONOMIC, y = predicted_prob)) +
  geom_ribbon(aes(ymin = lower_ci, ymax = upper_ci), alpha = 0.3, fill = "blue") +
  geom_line(color = "blue", size = 1) +
  scale_x_continuous(
    breaks = 1:7,
    labels = c("Strongly\nDisbelieve", "Disbelieve", "Somewhat\nDisbelieve", 
               "Neither\nDisbelieve\nnor Believe", "Somewhat\nBelieve", 
               "Believe", "Strongly\nBelieve")
  ) +
  labs(title = "Predicted Probability of Trump Vote by Zero-Sum Economic Beliefs",
       subtitle = "With 95% Confidence Intervals",
       x = "Zero-Sum Economic Beliefs", y = "Predicted Probability") +
  theme_minimal() +
  theme(axis.text.x = element_text(angle = 45, hjust = 1, size = 9))

# Print and save the plots
print(plot.TRUMPVOTE.ZEROSUM_ECONOMIC)

Show the code

ggsave("plot13:TRUMPVOTE.ZEROSUM_ECONOMIC.png", 
       plot = plot.TRUMPVOTE.ZEROSUM_ECONOMIC, 
       width = 10, 
       height = 8, 
       dpi = 300)

\[ \begin{aligned} \log\left(\frac{\hat{P}(\text{TRUMPVOTE})}{1 - \hat{P}(\text{TRUMPVOTE})}\right) &= \beta_0 + \beta_1 \cdot \text{POLITICALBELIEFS} + \beta_2 \cdot \text{AGE} \\ &\quad + \beta_3 \cdot \text{SOCIALSTATUS} + \beta_4 \cdot \text{ZEROSUM_ECONOMIC} \\ &\quad + \beta_5 \cdot \text{ZEROSUM_IDENTITY} + \beta_6 \cdot \text{ZEROSUM_1} \end{aligned} \] {#eq-logistic-regression-v1}

In [15]:
Show the code

library(corrplot)

# Select the variables for correlation matrix
cor_vars <- select_data %>%
  select(TRUMPVOTE, ZEROSUM_ECONOMIC, ZEROSUM_IDENTITY, ZEROSUM_1:ZEROSUM_11, POLITICALBELIEFS)

# Create correlation matrix (using complete observations)
cor_matrix <- cor(cor_vars, use = "complete.obs")

# Print the correlation matrix
print(cor_matrix)
                  TRUMPVOTE ZEROSUM_ECONOMIC ZEROSUM_IDENTITY   ZEROSUM_1
TRUMPVOTE         1.0000000      -0.29443392        0.6645678  0.26684045
ZEROSUM_ECONOMIC -0.2944339       1.00000000       -0.2182459  0.16970954
ZEROSUM_IDENTITY  0.6645678      -0.21824585        1.0000000  0.39857268
ZEROSUM_1         0.2668405       0.16970954        0.3985727  1.00000000
ZEROSUM_2        -0.1785834       0.85295649       -0.1307305  0.32010700
ZEROSUM_3        -0.3226406       0.83869977       -0.2408674 -0.04061298
ZEROSUM_4         0.5051574      -0.10800251        0.7650183  0.40217687
ZEROSUM_5         0.5920304      -0.15720985        0.8575787  0.37374664
ZEROSUM_6         0.6017971      -0.21244885        0.8676032  0.33262793
ZEROSUM_7         0.4568984      -0.27365916        0.7350147  0.10608067
ZEROSUM_8         0.5434336      -0.12379091        0.7841355  0.33860212
ZEROSUM_9         0.5540062      -0.09715141        0.7680997  0.39383153
ZEROSUM_10        0.6067448      -0.25736994        0.8799499  0.30802828
ZEROSUM_11        0.4389971      -0.16942436        0.8121808  0.33687045
POLITICALBELIEFS  0.6853457      -0.36686352        0.5952205  0.21232665
                   ZEROSUM_2   ZEROSUM_3   ZEROSUM_4  ZEROSUM_5   ZEROSUM_6
TRUMPVOTE        -0.17858345 -0.32264062  0.50515742  0.5920304  0.60179713
ZEROSUM_ECONOMIC  0.85295649  0.83869977 -0.10800251 -0.1572099 -0.21244885
ZEROSUM_IDENTITY -0.13073053 -0.24086736  0.76501827  0.8575787  0.86760323
ZEROSUM_1         0.32010700 -0.04061298  0.40217687  0.3737466  0.33262793
ZEROSUM_2         1.00000000  0.43110610 -0.04974671 -0.1104710 -0.09945176
ZEROSUM_3         0.43110610  1.00000000 -0.13479206 -0.1564973 -0.26348039
ZEROSUM_4        -0.04974671 -0.13479206  1.00000000  0.6486473  0.64286876
ZEROSUM_5        -0.11047099 -0.15649735  0.64864730  1.0000000  0.66706375
ZEROSUM_6        -0.09945176 -0.26348039  0.64286876  0.6670637  1.00000000
ZEROSUM_7        -0.20630881 -0.25780284  0.35640498  0.5531920  0.64388024
ZEROSUM_8        -0.10909799 -0.10016163  0.59059841  0.6468318  0.60073100
ZEROSUM_9        -0.00848579 -0.15908313  0.60005307  0.6331487  0.57959140
ZEROSUM_10       -0.20938975 -0.22643079  0.57925060  0.7927089  0.70009657
ZEROSUM_11       -0.05131959 -0.23932523  0.56045860  0.6182847  0.73658196
POLITICALBELIEFS -0.29211943 -0.32938856  0.47105958  0.4736381  0.54621147
                  ZEROSUM_7  ZEROSUM_8   ZEROSUM_9 ZEROSUM_10  ZEROSUM_11
TRUMPVOTE         0.4568984  0.5434336  0.55400621  0.6067448  0.43899706
ZEROSUM_ECONOMIC -0.2736592 -0.1237909 -0.09715141 -0.2573699 -0.16942436
ZEROSUM_IDENTITY  0.7350147  0.7841355  0.76809965  0.8799499  0.81218083
ZEROSUM_1         0.1060807  0.3386021  0.39383153  0.3080283  0.33687045
ZEROSUM_2        -0.2063088 -0.1090980 -0.00848579 -0.2093897 -0.05131959
ZEROSUM_3        -0.2578028 -0.1001616 -0.15908313 -0.2264308 -0.23932523
ZEROSUM_4         0.3564050  0.5905984  0.60005307  0.5792506  0.56045860
ZEROSUM_5         0.5531920  0.6468318  0.63314866  0.7927089  0.61828468
ZEROSUM_6         0.6438802  0.6007310  0.57959140  0.7000966  0.73658196
ZEROSUM_7         1.0000000  0.4956272  0.42194526  0.6812108  0.57277207
ZEROSUM_8         0.4956272  1.0000000  0.60251070  0.6431855  0.54297395
ZEROSUM_9         0.4219453  0.6025107  1.00000000  0.6170646  0.52703812
ZEROSUM_10        0.6812108  0.6431855  0.61706458  1.0000000  0.67940523
ZEROSUM_11        0.5727721  0.5429740  0.52703812  0.6794052  1.00000000
POLITICALBELIEFS  0.4788481  0.4544180  0.48540276  0.5139258  0.42161590
                 POLITICALBELIEFS
TRUMPVOTE               0.6853457
ZEROSUM_ECONOMIC       -0.3668635
ZEROSUM_IDENTITY        0.5952205
ZEROSUM_1               0.2123266
ZEROSUM_2              -0.2921194
ZEROSUM_3              -0.3293886
ZEROSUM_4               0.4710596
ZEROSUM_5               0.4736381
ZEROSUM_6               0.5462115
ZEROSUM_7               0.4788481
ZEROSUM_8               0.4544180
ZEROSUM_9               0.4854028
ZEROSUM_10              0.5139258
ZEROSUM_11              0.4216159
POLITICALBELIEFS        1.0000000
Show the code

# Visualize with corrplot
corrplot(cor_matrix, 
         method = "color",
         type = "upper",
         order = "hclust",
         tl.cex = 0.8,
         tl.col = "black",
         tl.srt = 45,
         addCoef.col = "black",
         number.cex = 0.7)

Show the code

# Alternative visualization with different style
corrplot(cor_matrix, 
         method = "circle",
         type = "full",
         order = "original",
         tl.cex = 0.8,
         tl.col = "black",
         tl.srt = 45,
         col = colorRampPalette(c("blue", "white", "red"))(100))