You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -78,17 +78,26 @@ Finally, run specific checks on the simulated residuals:
78
78
check_residuals(simulated_residuals)
79
79
```
80
80
81
-
Or check the entire model.
81
+
Further implemented checks are tests for overdispersion, outliers and zero-inflation.
82
82
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"}
85
96
check_model(simulated_residuals)
86
97
```
87
98
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).
89
100
90
101
```{r}
91
102
str(simulated_residuals, max.level = 1)
92
103
```
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