As per usual, we first need to load our data. This time, we also wrangle some variables at the beginning. So please execute the following R commands.
library(dplyr)
library(haven)
allbus_2021_cda_2 <-
read_spss("./data/allbus_2021/ZA5280_v1-0-0.sav") %>%
mutate(
trust_parliament = as.numeric(pt03),
party = pv01,
political_orientation = as.numeric(pa01),
satisfaction_democracy = ifelse(as.numeric(ps03) <= 2, 1, 0)
)
## Converting atomic to factors. Please wait...
In case you have not done so yet, please also install the
performance
package for this set of exercises.
if (!require(performance)) install.packages("performance")
In the following exercise, we will cover/repeat some of the basics of
regression analysis in R
.
trust_parliament
) as the outcome
variable and choice of party (party
) and political
orientation (political_orientation
) as predictors.
summary()
again.
glm()
function in which you need to
specify a link function. The name of the outcome variable is
satisfaction_democracy
.
?family
to see how you can
include a cauchit link.
test = "LRT"
in the function we need for this to perform a
likelihood ratio test. What’s your interpretation?
performance
package provides a function for comparing
the performance of different models in terms of their fit.