简体   繁体   中英

Marginal effect plot not corresponding to incidence rate ratio in R

Im trying to plot the marginal effect of a specific variable in a poisson regression and then correlate that graphic with its corresponding incidence rate ratio.

I've achieved this for most of my plots. However for one of them, the incidence rate ratio signals an overall positive association of my variable of interest and the plot shows a clearly negative association. From my understanding, there should be something wrong with this.

Could you help me? :) I might be understanding something wrong in my analysis...

I am first creating the Poisson model:

model3<- glm(y ~ x1*x2 + x3 + x4 + x5, data=data, family = poisson)

From which I get the following IRRs

poissonirr(y ~ x1*x2 + x3 + x4 + x5, data=data)

Incidence-Rate Ratio:
                         IRR  Std. Err.        z     P>|z|    
x1                 1.03404133 0.00471847   7.3359 2.202e-13 ***
x2                 1.16795382 0.01235611  14.6752 < 2.2e-16 ***
x3                 0.63214010 0.00817795 -35.4523 < 2.2e-16 ***
x4                 1.00468920 0.00095329   4.9305 8.204e-07 ***
x5                 0.98118299 0.00267124  -6.9776 3.003e-12 ***
x1:x2              0.99382845 0.00073716  -8.3462 < 2.2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Then I plot the marginal effect of the first variable in the model (x1) and I get the following plot:

plot_model(model3, type = "eff", terms = c("x1"))

x1 vs y Poisson Regression plot (with negative association)

which clearly shows an apparent negative association between x1 and y

thank you in advance !!

(I am using the mfx package to calculate IRRs and sjPlot::plot_model for the plotting)

Since an interaction is involved, you can't actually just interprete the main effect alone, but need to take the effect of the interaction into account. Thus, I would recommend plotting the following:

plot_model(model3, type = "eff", terms = c("x1", "x2"))

The effect of x1 is different for different values / levels of x2 . Thus, your plot that only considers x1 is misleading (and so is the coefficent of x1 , when you don't also look at the coefficient for x1:x2 ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM