library(tidyverse)
library(haven)
library(survey)
library(srvyr)
library(labelled)
library(sjmisc)
library(sjPlot)
library(gmodels)
library(gtsummary)
library(ggblanket)
## Function for picking a country
<- function(country_to_filter) {
pick_a_country read_sav("WVS_Cross-National_Wave_7_spss_v5_0.sav", user_na = FALSE) |>
filter(B_COUNTRY_ALPHA == country_to_filter) |>
drop_unused_value_labels()
}
Appendix B — Skill Assignment 2: Defining your research question, dataset, & variables
Find the sample assignment here.
B.1 Research Question
To what extent do socioeconomic variables and feelings about the honesty of politics explain how much confidence Australians have in their government?
B.2 Dataset Selected
World Values Survey — Australia
B.3 Variables Selected for Initial Study
Purpose of Variable | Variable Name & Description | Level of Measurement |
---|---|---|
Dependent | Q71 - How much confidence do you have in the government? | ordinal |
Independent | Q262 - age of the respondent | interval |
X003R - recoded age | ordinal | |
X003R2 - recoded age, fewer categories | ordinal | |
Q112 - how much corruption is in the country? | interval | |
Q113 - belief that state authorities are corrupt | ordinal | |
Q199 - interest in politics | ordinal | |
Q234 - does R think elections are honest | ordinal | |
Q235 - want a strong leader with few checks? | ordinal | |
Q260 - sex of R | nominal | |
Q275R - recoded education | ordinal |
B.3.1 Load packages and run function for selecting a country
B.3.2 Select a country to study, select variables, and save your new smaller dataset (link to help)
Need help? Go to chapter x in the webbook.
# 1) Select a country from the master dataset. Replace ""3 letter code here" with the three letter code for your country in capital letters inside parentheses. Ex. "AUS" for Australia
<- pick_a_country("AUS")
australia
# 2) Select variables in a country
<- australia |>
australia_small select(Q71, Q112, Q113, Q199, Q234, Q235, Q260, Q275R, X003R, X003R2, W_WEIGHT)
# 3) Save original and smaller dataset
save(australia_small, file = "australia_small.RData")
B.3.3 Run variable frequencies on your new smaller dataset
Need help? Go to chapter x in the webbook.
|>
australia_small select(-W_WEIGHT) |>
frq()
Confidence: The Government (Q71) <numeric>
# total N=1813 valid N=1796 mean=2.82 sd=0.75
Value | Label | N | Raw % | Valid % | Cum. %
------------------------------------------------------
1 | A great deal | 69 | 3.81 | 3.84 | 3.84
2 | Quite a lot | 493 | 27.19 | 27.45 | 31.29
3 | Not very much | 931 | 51.35 | 51.84 | 83.13
4 | None at all | 303 | 16.71 | 16.87 | 100.00
<NA> | <NA> | 17 | 0.94 | <NA> | <NA>
Perceptions of corruption in the country (Q112) <numeric>
# total N=1813 valid N=1794 mean=6.65 sd=2.28
Value | Label | N | Raw % | Valid % | Cum. %
--------------------------------------------------------------------------------------
1 | 1 There is no corruption in my country | 14 | 0.77 | 0.78 | 0.78
2 | 2 | 52 | 2.87 | 2.90 | 3.68
3 | 3 | 137 | 7.56 | 7.64 | 11.32
4 | 4 | 135 | 7.45 | 7.53 | 18.84
5 | 5 | 235 | 12.96 | 13.10 | 31.94
6 | 6 | 208 | 11.47 | 11.59 | 43.53
7 | 7 | 328 | 18.09 | 18.28 | 61.82
8 | 8 | 282 | 15.55 | 15.72 | 77.54
9 | 9 | 151 | 8.33 | 8.42 | 85.95
10 | 10 There is abundant corruption in my country | 252 | 13.90 | 14.05 | 100.00
<NA> | <NA> | 19 | 1.05 | <NA> | <NA>
Involved in corruption: State authorities (Q113) <numeric>
# total N=1813 valid N=1775 mean=2.19 sd=0.57
Value | Label | N | Raw % | Valid % | Cum. %
------------------------------------------------------
1 | None of them | 90 | 4.96 | 5.07 | 5.07
2 | Few of them | 1324 | 73.03 | 74.59 | 79.66
3 | Most of them | 302 | 16.66 | 17.01 | 96.68
4 | All of them | 59 | 3.25 | 3.32 | 100.00
<NA> | <NA> | 38 | 2.10 | <NA> | <NA>
Interest in politics (Q199) <numeric>
# total N=1813 valid N=1802 mean=2.35 sd=0.89
Value | Label | N | Raw % | Valid % | Cum. %
--------------------------------------------------------------
1 | Very interested | 293 | 16.16 | 16.26 | 16.26
2 | Somewhat interested | 805 | 44.40 | 44.67 | 60.93
3 | Not very interested | 486 | 26.81 | 26.97 | 87.90
4 | Not at all interested | 218 | 12.02 | 12.10 | 100.00
<NA> | <NA> | 11 | 0.61 | <NA> | <NA>
Some people think that having honest elections makes a lot of difference in their lives; other people think that it doesn’t matter much (Q234) <numeric>
# total N=1813 valid N=1797 mean=1.25 sd=0.57
Value | Label | N | Raw % | Valid % | Cum. %
--------------------------------------------------------------
1 | Very important | 1450 | 79.98 | 80.69 | 80.69
2 | Rather important | 266 | 14.67 | 14.80 | 95.49
3 | Not very important | 61 | 3.36 | 3.39 | 98.89
4 | Not at all important | 20 | 1.10 | 1.11 | 100.00
<NA> | <NA> | 16 | 0.88 | <NA> | <NA>
Political system: Having a strong leader who does not have to bother with parliament and elections (Q235) <numeric>
# total N=1813 valid N=1744 mean=3.16 sd=0.97
Value | Label | N | Raw % | Valid % | Cum. %
----------------------------------------------------
1 | Very good | 124 | 6.84 | 7.11 | 7.11
2 | Fairly good | 328 | 18.09 | 18.81 | 25.92
3 | Fairly Bad | 430 | 23.72 | 24.66 | 50.57
4 | Very bad | 862 | 47.55 | 49.43 | 100.00
<NA> | <NA> | 69 | 3.81 | <NA> | <NA>
Sex (Q260) <numeric>
# total N=1813 valid N=1799 mean=1.61 sd=0.49
Value | Label | N | Raw % | Valid % | Cum. %
------------------------------------------------
1 | Male | 704 | 38.83 | 39.13 | 39.13
2 | Female | 1095 | 60.40 | 60.87 | 100.00
<NA> | <NA> | 14 | 0.77 | <NA> | <NA>
Highest educational level: Respondent (recoded into 3 groups) (Q275R) <numeric>
# total N=1813 valid N=1743 mean=2.36 sd=0.64
Value | Label | N | Raw % | Valid % | Cum. %
-----------------------------------------------
1 | Lower | 152 | 8.38 | 8.72 | 8.72
2 | Middle | 807 | 44.51 | 46.30 | 55.02
3 | Higher | 784 | 43.24 | 44.98 | 100.00
<NA> | <NA> | 70 | 3.86 | <NA> | <NA>
Age recoded (6 intervals) (X003R) <numeric>
# total N=1813 valid N=1795 mean=4.33 sd=1.55
Value | Label | N | Raw % | Valid % | Cum. %
----------------------------------------------------------
1 | 16-24 | 77 | 4.25 | 4.29 | 4.29
2 | 25-34 | 228 | 12.58 | 12.70 | 16.99
3 | 35-44 | 250 | 13.79 | 13.93 | 30.92
4 | 45-54 | 276 | 15.22 | 15.38 | 46.30
5 | 55-64 | 392 | 21.62 | 21.84 | 68.13
6 | 65 and more years | 572 | 31.55 | 31.87 | 100.00
<NA> | <NA> | 18 | 0.99 | <NA> | <NA>
Age recoded (3 intervals) (X003R2) <numeric>
# total N=1813 valid N=1795 mean=2.51 sd=0.67
Value | Label | N | Raw % | Valid % | Cum. %
-----------------------------------------------------------
1 | 16-29 years | 179 | 9.87 | 9.97 | 9.97
2 | 30-49 years | 513 | 28.30 | 28.58 | 38.55
3 | 50 and more years | 1103 | 60.84 | 61.45 | 100.00
<NA> | <NA> | 18 | 0.99 | <NA> | <NA>