tests/testthat/test-back_select.R

test_that("back_select works", {
  set.seed(123)
  x = rnorm(10)
  x2 = rnorm(10)
  y = rnorm(10)
  df = data.frame(y, x, x2)
  expect_equal(back_select(y~x*x2, data = df)$removed_vars, c("x", "x:x2"))
  expect_equal(back_select(y~x, data = df)$removed_vars, c("x"))
  expect_error(back_select(y+x ~ x2,data = df), regexp = NULL)
  expect_error(back_select(y ~ 1,data = df), regexp = NULL)
})
EvanWie/regSel documentation built on Nov. 26, 2019, 2:11 a.m.