Skip to content

Commit

Permalink
fixes #413 note on color-option in vignette + fix help plotResiduals
Browse files Browse the repository at this point in the history
  • Loading branch information
melina-leite committed Oct 22, 2024
1 parent e166466 commit 53172bb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion DHARMa/R/plots.R
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ plotQQunif <- function(simulationOutput, testUniformity = TRUE, testOutliers = T
#'
#' @note If nObs > 10000, the scatter plot is replaced by graphics::smoothScatter
#'
#' #' @note The color for highlighting outliers and quantile lines/splines with significant tests can be changed by setting \code{options(DHARMaSignalColor = "red")} to a different color. See \code{getOption("DHARMaSignalColor")} for the current setting. This is convenient for a color-blind friendly display, since red and black are difficult for some people to separate.
#' @note The color for highlighting outliers and quantile lines/splines with significant tests can be changed by setting \code{options(DHARMaSignalColor = "red")} to a different color. See \code{getOption("DHARMaSignalColor")} for the current setting. This is convenient for a color-blind friendly display, since red and black are difficult for some people to distinguish.
#'
#' @return If quantile tests are performed, the function returns them invisibly.
#'
Expand Down
2 changes: 1 addition & 1 deletion DHARMa/man/plotResiduals.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions DHARMa/vignettes/DHARMa.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ DHARMa aims at solving these problems by creating readily interpretable residual

These steps are visualized in the following figure

<img src="ECDFmotivation.png" width="400" class="center"/>
<img src="ECDFmotivation.png" class="center" width="400"/>

The key advantage of this definition is that the so-defined residuals always have the same, known distribution, independent of the model that is fit, if the model is correctly specified. To see this, note that, if the observed data was created from the same data-generating process that we simulate from, all values of the cumulative distribution should appear with equal probability. That means we expect the distribution of the residuals to be flat, regardless of the model structure (Poisson, binomial, random effects and so on).

Expand Down Expand Up @@ -189,7 +189,9 @@ If the predictor is a factor, or if there is just a small number of observations
plotResiduals(simulationOutput, form = testData$group)
```

See ?plotResiduas for details, but very shortly: under H0 (perfect model), we would expect those boxes to range homogeneously from 0.25-0.75. To see whether there are deviations from this expecation, the plot calculates a test for uniformity per box, and a test for homogeneity of variances between boxes. A positive test will be highlighted in red.
See ?plotResiduas for details, but very shortly: under H0 (perfect model), we would expect those boxes to range homogeneously from 0.25-0.75. To see whether there are deviations from this expecation, the plot calculates a test for uniformity per box, and a test for homogeneity of variances between boxes. A positive test will be highlighted in red. \
\
**NOTE on plots**: The default color for highlighting outliers and significant tests is **red**. However, it can be changed by setting \code{options(DHARMaSignalColor = "red")} to a different color. This is convenient for a color-blind friendly display, since red and black are difficult for some people to disentangle.

## Goodness-of-fit tests on the scaled residuals

Expand Down Expand Up @@ -351,7 +353,7 @@ IMPORTANT INFO: we have made extensive simulations, which have shown that the va

As support for these statements, here results of the simulation, which compares the uniform (KS) test with the standard simuation-based test (conditional and unconditional) and the Pearson-chi2 test (two-sided and greater) for an n=200 Poisson GLMM with 30 RE levels.

<img src="dispersion.png" width="700" class="center"/>
<img src="dispersion.png" class="center" width="700"/>

Thus, my current recommendation is: for most users, use the default DHARMa test, but create simulations conditionally.

Expand Down

0 comments on commit 53172bb

Please sign in to comment.