sjPlot
sjPlot copied to clipboard
plot_model not plotting interaction terms for coefficient plot
At least for brms::brm-fitted zero-inflated Poisson models, I don't seem to be able to select interaction terms for the coefficient plot (type = "est"). The standard output contains all coefficients, correctly separated for the poisson and the zero-inflation part.
However, when I want to select specific terms through the terms argument, only the main effects seem to be plotted (and the same ones for both the Poisson and the zero-inflated parts). In short, the terms argument doesn't seem to be working properly for these models.
Specifically, I tried to plot all effects for which the CI of the estimate did not include 0 (significant ought to have heavy scare quotes around it below):
s <- summary(glm.orders)$fixed
n <- s %>%
as_tibble() %>%
mutate(n = 1:nrow(.)) %>%
filter(`l-95% CI` > 0 | `u-95% CI` < 0) %>%
pull(n)
significant_terms <- row.names(s)[n]
When I then plot the model:
plot_model(
glm.orders,
terms = significant_terms,
show.zeroinf = T,
show.values = T,
ci.lvl = .95)
All looks fine, except that only the 'significant' main effects are plotted, and those are the same for both components of the model. I assume this is a bug? Or is there a specific syntax to select term? Specifically, if this the vector of all 'significant' effects, only 2:6 are plotted but both the Poisson and the zero-inflated (zi) coefficients corresponding to those terms.
[1] "Intercept"
[2] "zi_Intercept"
[3] "brandB"
[4] "sourceAndroidvs.iOS"
[5] "sourcePhonevs.not"
[6] "typereturn"
[7] "brandB:sourceAndroidvs.iOS"
[8] "brandB:sourcePhonevs.not"
[9] "brandB:typereturn"
[10] "sourceAndroidvs.iOS:typereturn"
[11] "sourcePhonevs.not:typereturn"
[12] "brandB:sourceAndroidvs.iOS:typereturn"
[13] "brandB:sourcePhonevs.not:typereturn"
[14] "brandB:sourceiOSNative:typenew:COND2Reduced"
[15] "brandB:sourceAndroidNative:typereturn:COND2Reduced"
[16] "brandB:sourceumami:typereturn:COND2Reduced"
[17] "brandB:sourceAndroidNative:typenew:COND1Delivery"
[18] "brandA:sourceAndroidNative:typenew:COND1Delivery"
[19] "brandA:sourceiOSNative:typenew:COND1Delivery"
[20] "brandA:sourceAndroidNative:typereturn:COND1Delivery"
[21] "brandB:sourceiOSNative:typereturn:COND1Delivery"
[22] "brandB:sourceumami:typereturn:COND1Delivery"
[23] "brandB:sourceAndroidNative:typenew:COND1Service"
[24] "brandB:sourceiOSNative:typenew:COND1Service"
[25] "brandB:sourceiOSNative:typereturn:COND1Service"
[26] "brandA:sourceiOSNative:typereturn:COND1Service"
[27] "brandB:sourceumami:typereturn:COND1Service"
[28] "brandA:sourceiOSNative:typenew:COND2Reduced:COND1Delivery"
[29] "brandA:sourceAndroidNative:typereturn:COND2Reduced:COND1Delivery"
[30] "brandB:sourceiOSNative:typereturn:COND2Reduced:COND1Delivery"
[31] "brandB:sourceAndroidNative:typenew:COND2Reduced:COND1Service"
[32] "brandA:sourceAndroidNative:typenew:COND2Reduced:COND1Service"
[33] "brandA:sourceiOSNative:typenew:COND2Reduced:COND1Service"
[34] "brandA:sourceumami:typereturn:COND2Reduced:COND1Service"
[35] "zi_sourcePhonevs.not"
[36] "zi_typereturn"
[37] "zi_sourcePhonevs.not:typereturn"
[38] "zi_brandB:sourceiOSNative:typenew:COND2Reduced"
[39] "zi_brandA:sourceiOSNative:typereturn:COND2Reduced"
[40] "zi_brandB:sourceumami:typereturn:COND2Reduced"
[41] "zi_brandA:sourceAndroidNative:typenew:COND1Delivery"
[42] "zi_brandA:sourceiOSNative:typenew:COND1Delivery"
[43] "zi_brandB:sourceiOSNative:typenew:COND1Service"
[44] "zi_brandA:sourceiOSNative:typenew:COND2Reduced:COND1Delivery"
[45] "zi_brandB:sourceumami:typereturn:COND2Reduced:COND1Delivery"
[46] "zi_brandA:sourceAndroidNative:typenew:COND2Reduced:COND1Service"
[47] "zi_brandB:sourceiOSNative:typenew:COND2Reduced:COND1Service"
[48] "zi_brandA:sourceiOSNative:typenew:COND2Reduced:COND1Service"