I'm using the "margins" package to obtain the average marginal effects of a logistic regression. When I try to plot these marginal effects, the results from the plot are different from the results I obtain from the "margins" function. I have no idea why this is happening D:
The formula I'm using for the regression is the following:
mod_7 <- glm(ID_izq_WV7 ~ sex_7 + edad_7 + edusup_7 + ingresos_7 + indiv_eco_7 +
interv_gob_7 + lib_ind_WV7 + prefdem_7 + postmat_WV7 + confgob_WV7 +
agnostic_7, family = binomial)
Then, I'm using the "margins" function to obtain the average marginal effects:
summary(margins(mod_7, type = "link"))
From this code, I obtain the following results: Results: Average Marginal Effects
Then, I create a plot for the same regression formula, using this code:
par(mar = c(8, 5, 4, 3))
plot(margins(mod_7), las = 2)
From this code, I get the following plot: Plot: Average Marginal Effects
The results shown in the plot do not match the results I get from "summary.margins". Does anybody know why this is happening? Thanks so much for your help!