tests/testthat/test-ale.R

test_that("ale() is consistent with feature_effects()", {
  fit <- lm(Sepal.Length ~ ., data = iris)
  v <- c("Sepal.Width", "Species")
  suppressMessages(
    ale <- ale(fit, v = v, data = iris, w = 1:150)
  )
  suppressMessages(
    marg <- feature_effects(
      fit, v = v, data = iris, calc_pred = FALSE, pd_n = 0, w = 1:150
    )
  )
  expect_equal(ale, marg)
})

Try the effectplots package in your browser

Any scripts or data that you put into this service are public.

effectplots documentation built on April 12, 2025, 2:13 a.m.