Comments (1)
Thanks for reporting this issue. This was indeed unclear. I revised test_predictions()
, and you should now be able to compute contrasts / comparisons for the different model components of zero-inflation-models.
This is how it looks like:
library(ggeffects)
data(Salamanders, package = "glmmTMB")
m <- glmmTMB::glmmTMB(
count ~ mined + (1 | site),
ziformula = ~mined,
family = poisson(),
data = Salamanders
)
# count-model
pr <- predict_response(m, "mined")
pr
#> # Predicted counts of count
#>
#> mined | Predicted | 95% CI
#> ------------------------------
#> yes | 1.09 | 0.69, 1.72
#> no | 3.42 | 2.86, 4.09
#>
#> Adjusted for:
#> * site = NA (population-level)
test_predictions(pr)
#> # Pairwise comparisons
#>
#> mined | Contrast | 95% CI | p
#> -----------------------------------------
#> yes-no | -2.39 | -3.18, -1.60 | < .001
#>
#> Contrasts are presented as conditional means.
# full model (count and zero-inflation)
pr <- predict_response(m, "mined", type = "zero_inflated")
pr
#> # Predicted counts of count
#>
#> mined | Predicted | 95% CI
#> ------------------------------
#> yes | 0.26 | 0.12, 0.41
#> no | 2.21 | 1.77, 2.64
#>
#> Adjusted for:
#> * site = NA (population-level)
test_predictions(pr)
#> # Pairwise comparisons
#>
#> mined | Contrast | 95% CI | p
#> -----------------------------------------
#> yes-no | -1.99 | -2.41, -1.58 | < .001
#>
#> Contrasts are presented as counts.
# zero-inflation-probabilities
pr <- predict_response(m, "mined", type = "zi_prob")
pr
#> # Predicted zero-inflation probabilities of count
#>
#> mined | Predicted | 95% CI
#> ------------------------------
#> yes | 0.76 | 0.66, 0.83
#> no | 0.36 | 0.30, 0.41
#>
#> Adjusted for:
#> * site = NA (population-level)
# no CIs for default engine
test_predictions(pr)
#> # Pairwise comparisons
#>
#> mined | Contrast | 95% CI | p
#> ------------------------------
#> yes-no | 0.40 | |
#>
#> Contrasts are presented as probabilities.
# use "ggeffects" for CI
test_predictions(pr, engine = "ggeffects")
#> # Pairwise comparisons
#>
#> mined | Contrast | 95% CI | p
#> ---------------------------------------
#> yes-no | 0.40 | 0.30, 0.50 | < .001
#>
#> Contrasts are presented as probabilities.
Created on 2024-06-04 with reprex v2.1.0
from ggeffects.
Related Issues (20)
- how does test_predictions deal with categorical non-focal terms? HOT 7
- ggeffects capabilities with spatail regression model objects HOT 2
- Error when specifying focal terms in ggeffect() HOT 2
- Wrong labels for `test_prediction()` with `margin`. HOT 1
- Fix printing issue with cleaning values
- r ggeffect random sample linear spline HOT 1
- Bug in order of comparisons / labels when character vector is used in model
- Plotting ordinal logistic predicted effects on latent scale of ordinal outcome? HOT 3
- test_predictions not working with gamm4 model output HOT 4
- predict_response removes unobserved dv levels from clmm? HOT 3
- earth (MARS) support HOT 1
- reference issue in "Introduction_randomeffects.Rmd"
- plot add data=TRUE not making sense HOT 6
- Error: Objects of class `ggeffects` are not yet supported. HOT 5
- "Could not find model object to extract residuals." fails with a pipe HOT 4
- Curvilinear interaction is significant, then how do I get the significances of the linear term and quadratic term of the focal variable at the +1SD, mean, -SD points of moderator? HOT 7
- Problems with predictions from "robustbase" package ("hypothesis_test") HOT 1
- predict_response() vs ggeffect() HOT 3
- Clustered SEs with margin=marginalmeans HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ggeffects.