diff --git a/R/methods_aov.R b/R/methods_aov.R index 6f623b8de..e57c4ae88 100644 --- a/R/methods_aov.R +++ b/R/methods_aov.R @@ -536,7 +536,7 @@ model_parameters.seqanova.svyglm <- model_parameters.aov if (length(idxResid) >= 1L && any(idxResid)) { x$df_error <- x$df[idxResid] x$Sum_Squares_Error <- x$Sum_Squares[idxResid] - x$Mean_Square_Error <- x$Sum_Squares[idxResid] + x$Mean_Square_Error <- x$Mean_Square[idxResid] x <- x[!idxResid, ] } x diff --git a/tests/testthat/test-model_parameters.aov.R b/tests/testthat/test-model_parameters.aov.R index 0502afa24..040efeaf7 100644 --- a/tests/testthat/test-model_parameters.aov.R +++ b/tests/testthat/test-model_parameters.aov.R @@ -114,4 +114,14 @@ test_that("model_parameters.aov - table_wide", { expect_identical(nrow(mp1), 3L) expect_identical(nrow(mp2), 6L) + + + + mod1 <- aov(yield ~ N * P * K + Error(block), data = npk) + + out1 <- model_parameters(mod1, table_wide = FALSE) + out2 <- model_parameters(mod1, table_wide = TRUE) + + expect_true(all(out2$Mean_Square_Error %in% out1$Mean_Square[out1$Parameter == "Residuals"])) + expect_true(all(out1$Mean_Square[out1$Parameter == "Residuals"] %in% out2$Mean_Square_Error)) })