Hi all,
I have a general question I hope someone can help me out with. I thought I understood what marginal effects plots display, but I am puzzled by the results I am getting.
I am comparing two nested binomial logit models, where one includes a squared term of one of the variables (polity20). Comparing model1 (no squared term) and model2 (with squared term), the effects of several variables appear slightly bigger and more significant in model2 (matches, business_case1 and viol. detention1 - see outputs below).
However, when plotting marginal effects, from what I understand, the effects of these variables appear smaller and less significant in model 2: predprob_allsqu.pdf (7.4 KB)
than in model 1: predprob_all.pdf (7.4 KB).
I can't figure out why that would be the case, so there's something I've clearly not understood about this. I'd appreciate any help!
Thank you,
Janix
Below are a) the model outputs and b) the function I am using to plot the marginal effects:
Model 1:
Call:
glm(formula = posdev ~ polity20 + SFI + upr + aidperc + govreply +
matches + business_case + viol.detention + viol.torture +
viol.convic + viol.disciplin + viol.adminhar + issue.minor +
gender.fti, family = binomial(link = "logit"), data = FINAL.reg_all)
Deviance Residuals:
Min 1Q Median 3Q Max
-1.84455 -0.70277 -0.48751 -0.04711 2.60870
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -1.299822 0.548505 -2.370 0.017800 *
polity20 -0.005792 0.023024 -0.252 0.801385
SFI 0.016469 0.032405 0.508 0.611286
upr1 0.118892 0.337219 0.353 0.724414
aidperc 0.002852 0.036759 0.078 0.938168
govreply1 -0.197003 0.259985 -0.758 0.448600
matches -0.616109 0.136937 -4.499 6.82e-06 ***
business_case1 -1.404013 0.575701 -2.439 0.014737 *
viol.detention1 1.023834 0.305487 3.351 0.000804 ***
viol.torture1 -1.195165 0.372627 -3.207 0.001339 **
viol.convic1 0.969627 0.432383 2.243 0.024928 *
viol.disciplin1 2.702470 0.854401 3.163 0.001562 **
viol.adminhar1 -0.086265 0.703186 -0.123 0.902363
issue.minor1 -0.350260 0.311041 -1.126 0.260128
gender.fti1 0.275293 0.276196 0.997 0.318896
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 504.28 on 460 degrees of freedom
Residual deviance: 422.70 on 446 degrees of freedom
AIC: 452.7
Number of Fisher Scoring iterations: 6
Model 2:
Call:
glm(formula = posdev ~ polity20 + I(polity20^2) + SFI + upr +
aidperc + govreply + matches + business_case + viol.detention +
viol.torture + viol.convic + viol.disciplin + viol.adminhar +
issue.minor + gender.fti, family = binomial(link = "logit"),
data = FINAL.reg_all)
Deviance Residuals:
Min 1Q Median 3Q Max
-1.9606 -0.7041 -0.4755 -0.0351 2.7222
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.52176 0.62268 -0.838 0.402070
polity20 -0.33215 0.12554 -2.646 0.008148 **
I(polity20^2) 0.01609 0.00607 2.650 0.008048 **
SFI 0.02726 0.03290 0.829 0.407360
upr1 0.06896 0.33958 0.203 0.839067
aidperc 0.03174 0.03830 0.829 0.407191
govreply1 -0.07600 0.26554 -0.286 0.774703
matches -0.65265 0.13909 -4.692 2.7e-06 ***
business_case1 -1.68219 0.61241 -2.747 0.006017 **
viol.detention1 1.08664 0.31213 3.481 0.000499 ***
viol.torture1 -1.17706 0.37542 -3.135 0.001717 **
viol.convic1 0.90024 0.44022 2.045 0.040858 *
viol.disciplin1 2.50711 0.87444 2.867 0.004142 **
viol.adminhar1 0.01808 0.70736 0.026 0.979610
issue.minor1 -0.54827 0.32487 -1.688 0.091484 .
gender.fti1 0.32704 0.28008 1.168 0.242933
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 504.28 on 460 degrees of freedom
Residual deviance: 415.48 on 445 degrees of freedom
AIC: 447.48
Number of Fisher Scoring iterations: 6
predprobbinom <- function(model,xvar,xlab){
plot_model(model, terms = list(paste0(xvar)), type = "eff", title="") +
scale_y_continuous(labels = scales::label_percent(accuracy = 1), limits=c(0,1)) +
labs(x = paste0(xlab),
y = "Predicted probability\nof positive development") +
theme_bw()
}