tests/testthat/test-best-subsets-output.R

test_that("output from best subsets regression is as expected", {
  model <- lm(mpg ~ disp + hp + wt + qsec, data = mtcars)
  expect_snapshot(ols_step_best_subset(model))
})

test_that("output from best subsets regression is as expected when using different metric", {
  model <- lm(mpg ~ disp + hp + wt + qsec, data = mtcars)
  expect_snapshot(ols_step_best_subset(model, metric = "aic"))
})

Try the olsrr package in your browser

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

olsrr documentation built on May 29, 2024, 12:35 p.m.