tests/testthat/test-stepwise.R

context("stepwise")

test_that("stepwise selection output matches the expected result", {
  model <- lm(y ~ x1 + x2 + x3 + x4, data = cement)
  k <- ols_step_both_p(model, pent = 0.15, prem = 0.155)
  expect_equivalent(k$orders, c("x4", "x1", "x2", "x4"))
  expect_equivalent(k$method, c("addition", "addition", "addition", "removal"))
  expect_equal(k$steps, 4)
  expect_equivalent(k$predictors, c("x1", "x2"))
})

Try the olsrr package in your browser

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

olsrr documentation built on Feb. 10, 2020, 5:07 p.m.