library(tidyverse)
library(haven)
library(survey)
library(srvyr)
library(labelled)
library(sjmisc)
library(sjPlot)
library(gmodels)
library(gtsummary)
library(ggblanket)
Appendix A — Skill Assignment 2: Defining your research question, dataset, & variables
Find the sample assignment here.
A.1 Research Question
To what extent do socio-economic and other factors explain support or opposition to the 2022 Dobbs decision?
A.2 Dataset Selected
2022 ANES Pilot Study
A.3 Variables Selected for Initial Study
Purpose of Variable | Variable Name & Description | Level of Measurement |
---|---|---|
Dependent | roe- favor or oppose overturning Roe v. Wade | nominal |
Independent | urbanicity2 - urban-rural status | ordinal |
pid3 — party identification of respondent | ordinal | |
ideo5 — ideology of respondent | ordinal | |
gender — Gender of respondent | nominal | |
educ — education level of respondent | ordinal | |
pew_religimp — Importance of religion in your life | ordinal | |
follow - Do you follow what’s going on in government and public affairs? | ordinal | |
A.3.1 Load packages
A.3.2 Load the correct dataset
Need help? Go to chapter x in the webbook.
load("anes_pilot.RData")
A.3.3 Using the dataset you have loaded, select your variables, and save your new smaller dataset
Need help? Go to chapter 4 in the webbook.
<- anes_pilot |>
anes_pilot_smaller select(roe, urbanicity2, pid3, ideo5, gender, pew_religimp, follow, caseid, weight)
A.3.4 Run variable frequencies on your new smaller dataset
Need help? Go to chapter x in the webbook.
|>
anes_pilot_smaller select(-caseid, -weight) |>
frq()
Favor/oppose - overturn Roe v. Wade (roe) <numeric>
# total N=1585 valid N=1585 mean=1.85 sd=0.71
Value | Label | N | Raw % | Valid % | Cum. %
-----------------------------------------------------------------
1 | Favor | 526 | 33.19 | 33.19 | 33.19
2 | Oppose | 764 | 48.20 | 48.20 | 81.39
3 | Neither favor nor oppose | 295 | 18.61 | 18.61 | 100.00
<NA> | <NA> | 0 | 0.00 | <NA> | <NA>
Profile: Urban-rural status (urbanicity2) <numeric>
# total N=1585 valid N=1585 mean=2.92 sd=1.33
Value | Label | N | Raw % | Valid % | Cum. %
------------------------------------------------------
1 | Big city | 317 | 20.00 | 20.00 | 20.00
2 | Smaller city | 244 | 15.39 | 15.39 | 35.39
3 | Suburban area | 549 | 34.64 | 34.64 | 70.03
4 | Small town | 201 | 12.68 | 12.68 | 82.71
5 | Rural area | 274 | 17.29 | 17.29 | 100.00
<NA> | <NA> | 0 | 0.00 | <NA> | <NA>
Profile: 3 point Party ID (pid3) <numeric>
# total N=1585 valid N=1522 mean=2.21 sd=1.13
Value | Label | N | Raw % | Valid % | Cum. %
----------------------------------------------------
1 | Democrat | 508 | 32.05 | 33.38 | 33.38
2 | Republican | 430 | 27.13 | 28.25 | 61.63
3 | Independent | 428 | 27.00 | 28.12 | 89.75
4 | Other | 66 | 4.16 | 4.34 | 94.09
5 | Not sure | 90 | 5.68 | 5.91 | 100.00
<NA> | <NA> | 63 | 3.97 | <NA> | <NA>
Profile: Ideology (ideo5) <numeric>
# total N=1585 valid N=1584 mean=3.34 sd=1.40
Value | Label | N | Raw % | Valid % | Cum. %
----------------------------------------------------------
1 | Very liberal | 171 | 10.79 | 10.80 | 10.80
2 | Liberal | 253 | 15.96 | 15.97 | 26.77
3 | Moderate | 486 | 30.66 | 30.68 | 57.45
4 | Conservative | 342 | 21.58 | 21.59 | 79.04
5 | Very conservative | 198 | 12.49 | 12.50 | 91.54
6 | Not sure | 134 | 8.45 | 8.46 | 100.00
<NA> | <NA> | 1 | 0.06 | <NA> | <NA>
Profile: Gender (gender) <numeric>
# total N=1585 valid N=1585 mean=1.55 sd=0.50
Value | Label | N | Raw % | Valid % | Cum. %
-----------------------------------------------
1 | Male | 707 | 44.61 | 44.61 | 44.61
2 | Female | 878 | 55.39 | 55.39 | 100.00
<NA> | <NA> | 0 | 0.00 | <NA> | <NA>
Profile: Importance of religion (Pew version) (pew_religimp) <numeric>
# total N=1585 valid N=1585 mean=2.24 sd=1.17
Value | Label | N | Raw % | Valid % | Cum. %
-------------------------------------------------------------
1 | Very important | 580 | 36.59 | 36.59 | 36.59
2 | Somewhat important | 416 | 26.25 | 26.25 | 62.84
3 | Not too important | 222 | 14.01 | 14.01 | 76.85
4 | Not at all important | 367 | 23.15 | 23.15 | 100.00
<NA> | <NA> | 0 | 0.00 | <NA> | <NA>
Follow what’s going on in government and public affairs (follow) <numeric>
# total N=1585 valid N=1585 mean=1.82 sd=0.97
Value | Label | N | Raw % | Valid % | Cum. %
----------------------------------------------------------
1 | Most of the time | 773 | 48.77 | 48.77 | 48.77
2 | Some of the time | 460 | 29.02 | 29.02 | 77.79
3 | Only now and then | 217 | 13.69 | 13.69 | 91.48
4 | Hardly at all | 135 | 8.52 | 8.52 | 100.00
<NA> | <NA> | 0 | 0.00 | <NA> | <NA>