Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Oct 4, 2023
1 parent b6a118b commit c36d0d3
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/testthat/test-binned_residuals.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
test_that("binned_residuals", {
data(mtcars)
model <- glm(vs ~ wt + mpg, data = mtcars, family = "binomial")
result <- binned_residuals(model)
expect_named(
result,
c("xbar", "ybar", "n", "x.lo", "x.hi", "se", "ci_range", "CI_low", "CI_high", "group")
)
expect_equal(
result$xbar,
c(0.03786, 0.09514, 0.25911, 0.47955, 0.71109, 0.97119),
tolerance = 1e-4
)
expect_equal(
result$ybar,
c(-0.03786, -0.09514, 0.07423, -0.07955, 0.28891, -0.13786),
tolerance = 1e-4
)
})

0 comments on commit c36d0d3

Please sign in to comment.