Skip to content

Commit

Permalink
issue #1202 default value of type plot_comparison() (#1206)
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentarelbundock authored Aug 31, 2024
1 parent 5ca9c55 commit 25b3b4f
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 6 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: marginaleffects
Title: Predictions, Comparisons, Slopes, Marginal Means, and Hypothesis Tests
Version: 0.21.0.20
Version: 0.21.0.21
Authors@R:
c(person(given = "Vincent",
family = "Arel-Bundock",
Expand Down
3 changes: 2 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

## Development

Breaking change:
Breaking changes:

* `type="invlink(link)"` is no longer default in `avg_predictions()` or when calling `predictions()` with the `by` argument. It is still default in `predictions()` without the `by` argument. The backtransform strategy is still available with by setting `type="invlink(link)"` explicitly.
* The `type` argument in `plot_comparisons()` now defaults to `NULL`, which is now consistent with `comparisons()` and `avg_comparisons()`. Before, the default was `type="response"`. Thanks to @giakhang1906 for report #1202.

New:

Expand Down
2 changes: 1 addition & 1 deletion R/plot_comparisons.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ plot_comparisons <- function(model,
condition = NULL,
by = NULL,
newdata = NULL,
type = "response",
type = NULL,
vcov = NULL,
conf_level = 0.95,
wts = FALSE,
Expand Down
2 changes: 1 addition & 1 deletion R/plot_slopes.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ plot_slopes <- function(model,
condition = NULL,
by = NULL,
newdata = NULL,
type = "response",
type = NULL,
vcov = NULL,
conf_level = 0.95,
wts = FALSE,
Expand Down
20 changes: 20 additions & 0 deletions inst/tinytest/test-pkg-tidymodels.R
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,26 @@ expect_inherits(m, "slopes")
expect_false("std.error" %in% colnames(m))


# Issue #1202
fit <- linear_reg() |>
set_engine("lm") |>
fit(hp ~ am * vs, data = mtcars)
p <- plot_predictions(fit, condition = "am", draw = FALSE)
expect_inherits(p, "data.frame")

p <- plot_comparisons(fit,
variables = "am",
condition = "vs",
draw = FALSE)
expect_inherits(p, "data.frame")

p <- plot_comparisons(fit,
variables = "am",
condition = "vs",
draw = FALSE)
expect_inherits(p, "data.frame")




rm(list = ls())
Expand Down
2 changes: 1 addition & 1 deletion man/plot_comparisons.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/plot_slopes.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 25b3b4f

Please sign in to comment.