Skip to content

Commit

Permalink
recreated glmmTMB object for vignette, addresses #128
Browse files Browse the repository at this point in the history
  • Loading branch information
singmann committed Jun 28, 2024
1 parent c0f585e commit f3f6997
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions dev.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ load_all()

options(error = NULL)
devtools::test()
## before building, consider recreating the glmmTMB object for the vignette
devtools::build(args = "--compact-vignettes=both",
path = "development/") # R CMD build afex --compact-vignettes="gs+qpdf"
document()
Expand Down
Binary file added development/afex_1.4-1.tar.gz
Binary file not shown.
Binary file modified inst/extdata/tmb_example_fit.rda
Binary file not shown.
3 changes: 2 additions & 1 deletion vignettes/afex_plot_supported_models.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ tmb <- glmmTMB(count~spp * mined + (1|site),

```{r, eval=FALSE, include=FALSE}
library("glmmTMB")
set_sum_contrasts()
afex::set_sum_contrasts()
tmb <- glmmTMB(count~spp * mined + (1|site),
ziformula = ~spp * mined,
family=nbinom2, Salamanders)
Expand All @@ -173,6 +173,7 @@ save(tmb, file = "inst/extdata/tmb_example_fit.rda", compress = "xz")
library("glmmTMB")
data(Salamanders, package = "glmmTMB")
load(system.file("extdata/", "tmb_example_fit.rda", package = "afex"))
tmb <- up2date(tmb)
```

`afex_plot` does not automatically detect the random-effect for `site`. This means that per default all 644 data points are shown. When plotting only one variable, in which the default `data_geom` is `ggbeeswarm::geom_beeswarm`, this can lead to rather ugly plots due to the zero inflation. This is shon in panel A below. In panel B, we address this by changing the geom to a violin plot. In panel C, we address this by aggregating the data within site, but still use the beeswarm plot. Note that for panel C it is necessary to pass the data via the `data` argument as otherwise `site` cannot be found for aggregation.
Expand Down

0 comments on commit f3f6997

Please sign in to comment.