Skip to content

Commit 3680678

Browse files
committed
update vignette
1 parent 2da0eb3 commit 3680678

File tree

2 files changed

+31
-7
lines changed

2 files changed

+31
-7
lines changed

_pkgdown.yaml

+15
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,18 @@ reference:
4444
- title: "Sample Data"
4545
contents:
4646
- classify_distribution
47+
48+
articles:
49+
- title: Checking model assumptions and data properties
50+
navbar: ~
51+
contents:
52+
- check_model
53+
- chek_outliers
54+
- simulate_residuals
55+
56+
articles:
57+
- title: Model comparison and testing
58+
navbar: ~
59+
contents:
60+
- compare
61+
- r2

vignettes/simulate_residuals.Rmd

+16-7
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ knitr::opts_chunk$set(
2727
)
2828
options(digits = 2)
2929
30-
pkgs <- c("DHARMa", "glmmTMB")
30+
pkgs <- c("DHARMa", "glmmTMB", "see")
3131
successfully_loaded <- vapply(pkgs, requireNamespace, FUN.VALUE = logical(1L), quietly = TRUE)
3232
can_evaluate <- all(successfully_loaded)
3333
@@ -78,17 +78,26 @@ Finally, run specific checks on the simulated residuals:
7878
check_residuals(simulated_residuals)
7979
```
8080

81-
Or check the entire model.
81+
Further implemented checks are tests for overdispersion, outliers and zero-inflation.
8282

83-
```{r, eval=FALSE}
84-
# TODO (not implemented)
83+
```{r}
84+
check_overdispersion(simulated_residuals)
85+
86+
check_zeroinflation(simulated_residuals)
87+
88+
check_outliers(simulated_residuals)
89+
```
90+
91+
The above three functions internally call `simulate_residuals()` for more complex models automatically, so you don't need to call `simulate_residuals()` yourself. Simulated residuals are usually more reliable than the standard residuals, especially for complex models.
92+
93+
Finally, you can even perform a visual check for the entire model, either by passing the model object directly, or the object returned from `simulate_residuals()`.
94+
95+
```{r, eval=packageVersion("see") > "0.8.2"}
8596
check_model(simulated_residuals)
8697
```
8798

88-
The `check_model()` function is the main reason we don't want to prematurely extract the residuals in `simulate_residuals()`, because if we do then the `simulated_residuals` won't contain the model fit (`fittedModel` in the output below), so we won't be able to do all of the checks we would want to do using the model (e.g., posterior predictive checks).
99+
The `check_model()` function is the main reason we don't want to prematurely extract the residuals in `simulate_residuals()`, because if we do then the simulated residual won't contain the model fit (`fittedModel` in the output below), so we won't be able to do all of the checks we would want to do using the model (e.g., posterior predictive checks).
89100

90101
```{r}
91102
str(simulated_residuals, max.level = 1)
92103
```
93-
94-
It would also mean we would need to reimplement some of the tests from DHARMa (e.g., `DHARMa::testOutliers()`) if we're planning to include those checks as well. We probably don't want to do that, since some of them are fairly involved rather than just being wrappers for tests supplied in base R (e.g., <https://github.com/florianhartig/DHARMa/blob/a04bdfeec75338279152dbc00c3a1825958a226a/DHARMa/R/tests.R#L172>) .

0 commit comments

Comments
 (0)