Skip to content

Commit

Permalink
p_adjust -> multcomp (#1300)
Browse files Browse the repository at this point in the history
* p_adjust -> multcomp

* cruft

* multcomp works with raw models
  • Loading branch information
vincentarelbundock authored Dec 11, 2024
1 parent f829090 commit 7129130
Show file tree
Hide file tree
Showing 23 changed files with 131 additions and 654 deletions.
5 changes: 3 additions & 2 deletions 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.24.0.5
Version: 0.24.0.6
Authors@R:
c(person(given = "Vincent",
family = "Arel-Bundock",
Expand Down Expand Up @@ -123,6 +123,7 @@ Suggests:
mlr3verse,
modelbased,
modelsummary,
multcomp,
nlme,
nnet,
numDeriv,
Expand Down Expand Up @@ -200,7 +201,6 @@ Collate:
'config.R'
'conformal.R'
'datagrid.R'
'deprecated.R'
'equivalence.R'
'get_coef.R'
'get_contrast_data.R'
Expand Down Expand Up @@ -278,6 +278,7 @@ Collate:
'methods_tidymodels.R'
'methods_tobit1.R'
'modelarchive.R'
'multcomp.R'
'myTryCatch.R'
'package.R'
'plot.R'
Expand Down
6 changes: 0 additions & 6 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,6 @@ export(avg_predictions)
export(avg_slopes)
export(comparisons)
export(datagrid)
export(datagridcf)
export(deltamethod)
export(expect_margins)
export(expect_predictions)
export(expect_slopes)
Expand All @@ -209,10 +207,6 @@ export(get_vcov)
export(glance)
export(hypotheses)
export(inferences)
export(marginal_means)
export(marginaleffects)
export(marginalmeans)
export(meffects)
export(plot_comparisons)
export(plot_predictions)
export(plot_slopes)
Expand Down
13 changes: 11 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,22 @@

## Development

* Version 0.24.0 accidentally removed the "contrast" column from the output object in calls with only one focal predictor. This column is reinstated.
* Reinstate some attributes lost with `marginaleffects_lean` but necessary for printing.
Breaking changes:

* `p_adjust` argument deprecated because of name-matching conflict with `p` argument in quantile regression and others. The recommended workflow is now to pass the object to the `hypotheses()` function and use its `multcomp` argument.
* Removed long deprecated functions from the code base. These functions were already raising errors: `marginaleffects`, `meffects`, `marginal_means`, `deltamethod`, `datagridcf`.

New:

* New `multcomp` argument for the `hypotheses()` function.
* `hypotheses()` inherits the `conf_level` from `marginaleffects` objects when available. Otherwise, the default remains 0.95.
* More informative warning for `lme4` and `glmmTMB` models with `re.form=NULL`
* `df.residual()` methods tries to call `stats::df.residual()` on the "model" attribute. If that fails or returns `NULL`, we return `Inf`.

Bugs:

* Version 0.24.0 accidentally removed the "contrast" column from the output object in calls with only one focal predictor. This column is reinstated.
* Reinstate some attributes lost with `marginaleffects_lean` but necessary for printing.
* Encoding issue in bayesian models with `by`. Thanks to @Koalha for report #1290.
* Retain necessary attribute information to ensure that "lean" return objects still print correctly #1295.

Expand Down
6 changes: 0 additions & 6 deletions R/comparisons.R
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@ comparisons <- function(model,
wts = FALSE,
hypothesis = NULL,
equivalence = NULL,
p_adjust = NULL,
df = Inf,
eps = NULL,
numderiv = "fdforward",
Expand Down Expand Up @@ -287,7 +286,6 @@ comparisons <- function(model,
wts = wts,
hypothesis = hypothesis,
equivalence = equivalence,
p_adjust = p_adjust,
df = df),
dots)
if ("modeldata" %in% names(dots)) {
Expand All @@ -305,7 +303,6 @@ comparisons <- function(model,
conf_level <- sanitize_conf_level(conf_level, ...)
checkmate::assert_number(eps, lower = 1e-10, null.ok = TRUE)
numderiv <- sanitize_numderiv(numderiv)
sanity_equivalence_p_adjust(equivalence, p_adjust)
model <- sanitize_model(
model = model,
newdata = newdata,
Expand Down Expand Up @@ -511,7 +508,6 @@ comparisons <- function(model,
draws = draws,
estimate = "estimate",
null_hypothesis = hypothesis_null,
p_adjust = p_adjust,
model = model)

# clean rows and columns
Expand Down Expand Up @@ -603,7 +599,6 @@ avg_comparisons <- function(model,
wts = FALSE,
hypothesis = NULL,
equivalence = NULL,
p_adjust = NULL,
df = Inf,
eps = NULL,
numderiv = "fdforward",
Expand Down Expand Up @@ -638,7 +633,6 @@ avg_comparisons <- function(model,
wts = wts,
hypothesis = hypothesis,
equivalence = equivalence,
p_adjust = p_adjust,
df = df,
eps = eps,
...)
Expand Down
Loading

0 comments on commit 7129130

Please sign in to comment.