Let’s move on to your challenge: You want to test the relationship between satisfaction with democracy and the variables trstprl, trstlgl, stfeco, and agea. Try using ggpairs()!
Try it out before looking at the other tabs!
oneSolution <- ggpairs(
pss,
columns = c(
"stfdem",
"trstprl",
"trstlgl",
"stfeco"
),
lower = list(
continuous = wrap(
"points",
position = position_jitter(width = 0.5)
),
combo = wrap(
"facethist",
binwidth = 1
)
),
upper = list(
continuous = "cor",
combo = "box_no_facet"
),
diag = list(
continuous = wrap("densityDiag", bw = 1),
discrete = "barDiag"
)
)
oneSolution
library("psych")
pairs.panels(
pss[c(
"stfdem",
"trstprl",
"trstlgl",
"stfeco"
)
],
method = "pearson",
jiggle = TRUE, # für pseudometrische Daten
stars = TRUE # Konvention für Signifikanzen
)
cor <- corr.test(
pss[c(
"stfdem",
"trstprl",
"trstlgl",
"stfeco"
)
],
method = "pearson",
use = "complete.obs"
)
library("corrplot")
corrplot(
cor$r,
p.mat = cor$p, # Matrix mit p-Werten
insig = "blank", # nicht signifikante = leer
type = "upper", # auch lower möglich
method = "circle" # verschiedene Optionen möglich
)
On the next page, you can explore a ggplot alternative to corrplot, or you can skip ahead to comparing means!