Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Feb 7, 2024
1 parent b5b24a5 commit 48144ad
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions tests/testthat/test-model_parameters.aov.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ test_that("model_parameters.aov", {
model <- aov(Sepal.Width ~ Species, data = iris)
mp <- suppressMessages(model_parameters(model, effectsize_type = c("omega", "eta", "epsilon")))
expect_identical(sum(mp$df), 149)
expect_names(mp, c(
expect_named(mp, c(
"Parameter", "Sum_Squares", "df", "Mean_Square", "F", "p",
"Omega2", "Eta2", "Epsilon2"
))
Expand All @@ -33,25 +33,25 @@ test_that("model_parameters.aov", {
test_that("model_parameters.anova", {
skip_if_not_installed("lme4")
model <- anova(lm(Sepal.Width ~ Species, data = iris))
expect_identical(sum(model_parameters(model)$df), 149)
expect_identical(sum(model_parameters(model)$df), 149L)

model <- anova(lm(Sepal.Length ~ Species * Cat1 * Cat2, data = iris))
expect_identical(sum(model_parameters(model)$df), 149)
expect_identical(sum(model_parameters(model)$df), 149L)

model <- anova(lme4::lmer(wt ~ 1 + (1 | gear), data = mtcars))
expect_identical(nrow(model_parameters(model)), 0)
expect_identical(nrow(model_parameters(model)), 0L)

model <- anova(lme4::lmer(wt ~ cyl + (1 | gear), data = mtcars))
expect_identical(sum(model_parameters(model)$df), 1)
expect_identical(sum(model_parameters(model)$df), 1L)

model <- anova(lme4::lmer(wt ~ drat + cyl + (1 | gear), data = mtcars))
expect_eexpect_identicalual(sum(model_parameters(model)$df), 2)
expect_identical(sum(model_parameters(model)$df), 2L)

model <- anova(lme4::lmer(wt ~ drat * cyl + (1 | gear), data = mtcars))
expect_identical(sum(model_parameters(model, verbose = FALSE)$df), 3)
expect_identical(sum(model_parameters(model, verbose = FALSE)$df), 3L)

model <- anova(lme4::lmer(wt ~ drat / cyl + (1 | gear), data = mtcars))
expect_identical(sum(model_parameters(model, verbose = FALSE)$df), 2)
expect_identical(sum(model_parameters(model, verbose = FALSE)$df), 2L)
})


Expand All @@ -61,13 +61,13 @@ test_that("model_parameters.anova", {
skip_if_not_installed("httr")

model <- insight::download_model("anova_3")
expect_identical(sum(model_parameters(model, verbose = FALSE)$df), 149)
expect_identical(sum(model_parameters(model, verbose = FALSE)$df), 149L)

model <- insight::download_model("anova_4")
expect_identical(sum(model_parameters(model, verbose = FALSE)$df, na.rm = TRUE), 2)

model <- insight::download_model("anova_lmerMod_5")
expect_identical(sum(model_parameters(model, verbose = FALSE)$df), 1)
expect_identical(sum(model_parameters(model, verbose = FALSE)$df), 1L)

model <- insight::download_model("anova_lmerMod_6")
expect_identical(sum(model_parameters(model, verbose = FALSE)$df), 12)
Expand Down

0 comments on commit 48144ad

Please sign in to comment.