tests/testthat/test-lmtest.R

skip_if_not_installed("lmtest")
data("Mandible", package = "lmtest")
m <- lm(length ~ age, data = Mandible, subset = (age <= 28))
ct1 <- lmtest::coeftest(m)
ct2 <- lmtest::coeftest(m, df = Inf)

test_that("find_statistic", {
  expect_equal(find_statistic(ct1), "t-statistic")
  expect_equal(find_statistic(ct2), "z-statistic")
})
test_that("get_statistic", {
  expect_equal(get_statistic(ct1)$Statistic, c(-12.24446, 37.16067), tolerance = 1e-3)
  expect_equal(get_statistic(ct2)$Statistic, c(-12.24446, 37.16067), tolerance = 1e-3)
})

Try the insight package in your browser

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

insight documentation built on Nov. 26, 2023, 5:08 p.m.