Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Oct 4, 2023
1 parent ee95065 commit 8467a76
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions tests/testthat/test-check_distribution.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
test_that("check_distribution", {
skip_if_not_installed("lme4")
skip_if_not_installed("randomForest")
data(sleepstudy, package = "lme4")
model <<- lme4::lmer(Reaction ~ Days + (Days | Subject), sleepstudy)
out <- check_distribution(model)

expect_identical(
out$Distribution,
c(
"bernoulli", "beta", "beta-binomial", "binomial", "cauchy",
"chi", "exponential", "F", "gamma", "half-cauchy", "inverse-gamma",
"lognormal", "neg. binomial (zero-infl.)", "negative binomial",
"normal", "pareto", "poisson", "poisson (zero-infl.)", "tweedie",
"uniform", "weibull"
)
)
expect_equal(
out$p_Residuals,
c(
0, 0, 0, 0, 0.9375, 0, 0, 0, 0, 0, 0, 0.03125, 0, 0, 0, 0,
0, 0, 0, 0, 0.03125
),
tolerance = 1e-4
)
expect_equal(
out$p_Response,
c(
0, 0, 0.03125, 0, 0, 0, 0, 0, 0.4375, 0.03125, 0, 0.46875,
0.03125, 0, 0, 0, 0, 0, 0, 0, 0
),
tolerance = 1e-4
)
})

0 comments on commit 8467a76

Please sign in to comment.