What are the problems with the previous assignment? Anything not very clear?
Rstudio -> File -> New project …
Projects save the workspace and set working directory. You can work with several R scripts at the same time.
Using data ESS8PT.sav, answer the following questions:
stflife
) in Portugal? Is it significantly different from the middle of the scale, 5?health
)?gndr
)?domicil
)?agea
), and type of settlement (domicil
)? Build a regression model; check if all the variables have appropriate class (“numeric”, “factor”).
Try to write a single R script that works smoothly from the beginning to the end.
effects
library(effects)
eff <- effect(term = c("age*gender"), # the term to plot
mod = m1, # fitted model
se = TRUE # compute standard errors?
)
plot(x = eff, # computed predicted values
multiline = TRUE, # put several lines at the single plot?
confint=list(style="bands"), # ribbons (bands) or "lines", or "bars"?
rug = FALSE # plot density by rug bars?
)
sjPlot
library("sjPlot")
# Just coefficients with confidence intervals
plot_model(m1, type = "est")
# Interaction terms' slopes
plot_model(m1, type = "int")
# Regression diagnostic plots
plot_model(m1, type = "diag")
## [[1]]
##
## [[2]]
##
## [[3]]
##
## [[4]]