diff --git a/DESCRIPTION b/DESCRIPTION index b634d97b..c9317338 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: report Type: Package Title: Automated Reporting of Results and Statistical Models -Version: 0.6.1.2 +Version: 0.6.1.3 Authors@R: c(person(given = "Dominique", family = "Makowski", diff --git a/NEWS.md b/NEWS.md index 2becfea3..56ee9c00 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,6 +2,7 @@ Bug fixes +* `report.anova()`: fix missing denominator degrees of freedom in lmerTest ANOVA reports (#453) * Fixed issue with missing effect size for the Intercept term in type 3 anova tables (#451) # report 0.6.1 diff --git a/R/report.aov.R b/R/report.aov.R index d6bd62b4..e619c046 100644 --- a/R/report.aov.R +++ b/R/report.aov.R @@ -187,6 +187,8 @@ report_statistics.aov <- function(x, table = NULL, ...) { text <- paste0(text, ", ", insight::format_value(DoF_residual, protect_integers = TRUE)) } else if ("DoF_Residuals" %in% names(parameters)) { text <- paste0(text, ", ", insight::format_value(parameters$DoF_Residuals, protect_integers = TRUE)) + } else if ("df_error" %in% names(parameters)) { + text <- paste0(text, ", ", insight::format_value(parameters$df_error, protect_integers = TRUE)) } # Indices diff --git a/tests/testthat/test-report.lmer.R b/tests/testthat/test-report.lmer.R index d3a27687..e3f3eaf0 100644 --- a/tests/testthat/test-report.lmer.R +++ b/tests/testthat/test-report.lmer.R @@ -21,3 +21,19 @@ test_that("report-lmer", { expect_snapshot(variant = "windows", report(m2)) }) + +test_that("report-lmerTest-anova includes denominator df", { + skip_if_not_installed("lmerTest") + + # Test case for issue #453: lmerTest ANOVA should include denominator degrees of freedom + m <- lmerTest::lmer(mpg ~ wt + (1 | gear), data = mtcars) + anova_result <- anova(m) + report_output <- report(anova_result) + + # The report should include denominator df in F-statistic + # Should be F(1, 21.92) not just F(1) + expect_match(as.character(report_output), "F\\(1, [0-9.]+\\)") + + # Should not have the old pattern without denominator df + expect_no_match(as.character(report_output), "F\\(1\\) =") +})