library(psre)
library(ggeffects)
library(multcomp)
library(dplyr)
library(ggplot2)
data(wvs)
wvs$civ <- with(wvs, case_when(
civ == 4 ~ "Islamic",
civ == 6 ~ "Latin American",
civ == 7 ~ "Orthodox",
civ == 8 ~ "Sinic",
civ == 9 ~ "Western",
TRUE ~ "Other"))
wvs$civ = factor(wvs$civ, levels=c("Western",
"Sinic",
"Islamic",
"Latin American",
"Orthodox",
"Other"))
mod <- lm(resemaval ~ civ + gdp_cap +
pct_secondary + pct_univ_degree +
pct_high_rel_imp, data=wvs)
eff <- ggpredict(mod,
"civ",
ci.lvl = .95)
pwc <- summary(glht(mod, linfct=mcp(civ = "Tukey")),
test=adjusted(type="none"))
cld1 <- cld(pwc)
lmat <- cld1$mcletters$LetterMatrix
eff$x <- reorder(eff$x, eff$predicted, mean)
letter_plot(eff, lmat) +
labs(x="Predicted Emancipative Values\n(95% Confidence Interval)")
Run the code above in your browser using DataLab