Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Sep 23, 2023
1 parent 2ea2200 commit db423cb
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion tests/testthat/test-glm.R
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ test_that("get_data", {
})

test_that("get_call", {
expect_identical(class(get_call(m1)), "call")
expect_s3_class(get_call(m1), "call")
})

test_that("find_formula", {
Expand Down Expand Up @@ -169,3 +169,30 @@ test_that("get_statistic", {
tolerance = 1e-4
)
})

test_that("model_info, bernoulli", {
skip_if_not_installed("lme4")
data(cbpp, package = "lme4")
m <- glm(
cbind(incidence, size - incidence) ~ size + period,
family = binomial(),
data = cbpp
)
info <- model_info(m)
expect_true(info$is_binomial)
expect_false(info$is_bernoulli)
expect_true(info$is_logit)
expect_identical(info$family, "binomial")

data(mtcars)
m <- glm(
am ~ cyl,
family = binomial(),
data = mtcars
)
info <- model_info(m)
expect_true(info$is_binomial)
expect_true(info$is_bernoulli)
expect_true(info$is_logit)
expect_identical(info$family, "binomial")
})

0 comments on commit db423cb

Please sign in to comment.