tests/testthat/test-r2_tjur.R

test_that("r2_tjur", {
  model <- glm(vs ~ wt + mpg, data = mtcars, family = "binomial")
  expect_equal(r2_tjur(model), c(`Tjur's R2` = 0.477692621360749), tolerance = 1e-3)
})

test_that("r2_tjur", {
  model <- lm(mpg ~ wt + cyl, data = mtcars)
  expect_error(r2_tjur(model))
})

Try the performance package in your browser

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

performance documentation built on Oct. 19, 2024, 1:07 a.m.