From 46fddfd1c7cab922e19f5a3a95e1e5d3257796fc Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 31 Aug 2025 05:17:09 +0000 Subject: [PATCH 1/2] Initial plan From 92aa1cb5dbb6ac382745ab1c0b3d298e10f3bebe Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 31 Aug 2025 05:31:25 +0000 Subject: [PATCH 2/2] Fix missing denominator degrees of freedom in lmerTest ANOVA reports Co-authored-by: rempsyc <13123390+rempsyc@users.noreply.github.com> --- DESCRIPTION | 2 +- NEWS.md | 1 + R/report.aov.R | 2 ++ tests/testthat/test-report.lmer.R | 16 ++++++++++++++++ 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index b634d97b1..c9317338f 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 2becfea3c..56ee9c005 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 d6bd62b43..e619c046e 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 d3a276873..e3f3eaf0f 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\\) =") +})