Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Jan 24, 2025
1 parent 1614c31 commit 1914649
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion R/get_marginalcontrasts.R
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@ get_marginalcontrasts <- function(model,

## TODO: just experimental! Must wait for decision on marginaleffects
if (utils::packageVersion("marginaleffects") > "0.24.0" && "Parameter" %in% names(out)) {
out <- out[duplicated(lapply(out$Parameter, function(i) sort(.split_at_minus_outside_parentheses(i)))), ]
redundant_rows <- duplicated(lapply(out$Parameter, function(i) sort(.split_at_minus_outside_parentheses(i))))
if (any(redundant_rows)) {
out <- out[redundant_rows, ]
}
}

# adjust p-values
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-estimate_contrasts.R
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ test_that("estimate_contrasts - different options for comparison", {
out,
c("Level1", "Level2", "Difference", "SE", "CI_low", "CI_high", "z", "p")
)
expect_equal(out$Difference, c(-0.35, 0.8, 0.35, 1.15, 0.7, -0.45), tolerance = 1e-3)
expect_equal(out$Difference, c(-0.35, 0.8, 1.15, 0.35, 0.7, -0.45), tolerance = 1e-3)
out <- estimate_contrasts(dat_glm, contrast = "fa", comparison = "reference", backend = "marginaleffects")
expect_named(
out,
Expand Down

0 comments on commit 1914649

Please sign in to comment.