Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
seananderson committed Mar 19, 2024
2 parents 8e2782f + 54c57e5 commit b8eeb6d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions R/check.R
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ sanity <- function(object, big_sd_log10 = 2, gradient_thresh = 0.001, silent = F
g <- object$gradients
np <- names(object$model$par)
for (i in seq_along(g)) {
if (g[i] > gradient_thresh) {
if (abs(g[i]) > gradient_thresh) {
if (!silent) {
cli::cli_alert_danger(c(
"`", np[i],
Expand All @@ -104,7 +104,7 @@ sanity <- function(object, big_sd_log10 = 2, gradient_thresh = 0.001, silent = F
}
}

if (all(g <= gradient_thresh)) {
if (all(abs(g) <= gradient_thresh)) {
msg <- "No gradients with respect to fixed effects are >= "
if (!silent) cli::cli_alert_success(paste0(msg, gradient_thresh))
gradients_ok <- TRUE
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-5-residuals.R
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ test_that("Pearson residuals work", {
m1 <- glmmTMB::glmmTMB(prop ~ 1, data = dat, family = gaussian())
r <- residuals(m, type = "pearson")
r1 <- residuals(m1, type = "pearson")
expect_equal(as.numeric(r), as.numeric(r1))
expect_equal(as.numeric(r), as.numeric(r1), tolerance = 1e-6)

# gamma
set.seed(1)
Expand Down

0 comments on commit b8eeb6d

Please sign in to comment.