Hi, I am trying to plot my glm-model with clustered standard errors, and have estimated the vcov and entered into the argument se in the plot_model function. When I compare to the general standard errors, there is absolutely no difference in the plots, although the SE and CSE are different.
Any idea why this is happening? I do get the following warning/error when plotting the two:
"If standard errors are requested, no transformation is applied to estimates."
Hi, I am trying to plot my glm-model with clustered standard errors, and have estimated the vcov and entered into the argument se in the plot_model function. When I compare to the general standard errors, there is absolutely no difference in the plots, although the SE and CSE are different.
mod1 <- glm(x6_1 ~ sex + agegroup1 + lrscale1 + children1 + edu1 + employment1 + lrscale1 + marital_status1 + country, na.action = na.omit, data = df_all, family = binomial(link="logit")) summ(mod1)
Excluding country from coefficients
coi_indices <- which(!startsWith(row.names(data.frame(summary(mod1)$coefficients)), 'country'))
Normal SE
m1coeffs_std <- data.frame(summary(mod1)$coefficients) m1coeffs_std[coi_indices,]
Creating the covariance matrix
cov_mod1 <- vcovCL(mod1, cluster = ~country)
Clustered SE
m1coeffs_cl <- coeftest(mod1, vcov = cov_mod1) m1coeffs_cl[coi_indices,]
Plotting
terms <- rownames(data.frame(summary(mod1)$coefficients)[coi_indices,]) CSE <- plot_model(mod1, vline.color = "black", terms = terms, ci.lvl = NA, se = cov_mod1) + theme_classic() SSE <- plot_model(mod1, vline.color = "black", terms = terms, se = TRUE) + theme_classic() grid.arrange(CSE, SSE, ncol=2)
Any idea why this is happening? I do get the following warning/error when plotting the two: "If standard errors are requested, no transformation is applied to estimates."