Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Dec 3, 2024
1 parent ca8872d commit fe53e13
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion R/check_collinearity.R
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ check_collinearity.zerocount <- function(x,
if (!is.null(insight::find_interactions(x)) && any(result > 10) && isTRUE(verbose)) {
insight::format_alert(
"Model has interaction terms. VIFs might be inflated.",
"You may check multicollinearity among predictors of a model without interaction terms."
"Try to center the variables used for the interaction, or check multicollinearity among predictors of a model without interaction terms." # nolint
)
}

Expand Down
6 changes: 6 additions & 0 deletions tests/testthat/test-check_collinearity.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ test_that("check_collinearity, correct order in print", {
})


test_that("check_collinearity, interaction", {
m <- lm(mpg ~ wt * cyl, data = mtcars)
expect_message(check_collinearity(m), regex = "Model has interaction terms")
})


test_that("check_collinearity", {
skip_if_not_installed("glmmTMB")
skip_if_not(getRversion() >= "4.0.0")
Expand Down

0 comments on commit fe53e13

Please sign in to comment.