Skip to content
Merged

0.31.0 #1627

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.30.0.7
Version: 0.31.0
Authors@R:
c(person(given = "Vincent",
family = "Arel-Bundock",
Expand Down
11 changes: 4 additions & 7 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
# News {.unnumbered}

## 0.30.0.7
## 0.31.0

New:

* `inferences(method = "conformal_full")` implements full conformal prediction for regression models. This provides distribution-free prediction intervals by refitting the model on augmented data for each test observation. Unlike split conformal or CV+, full conformal uses all training data without requiring a separate calibration set. It is computationally intensive but provides valid coverage guarantees. For tidymodels workflows, pass the training data explicitly via the `data_train` argument.

Breaking changes:
Deprecated:

* The `conformal_calibration`, `conformal_train`, and `conformal_test` arguments in `inferences()` are deprecated (but kept for backward compatibility). Use the new `data_calib`, `data_train`, and `data_test`.

## 0.30.1
New:

* `inferences(method = "conformal_full")` implements full conformal prediction for regression models. This provides distribution-free prediction intervals by refitting the model on augmented data for each test observation. Unlike split conformal or CV+, full conformal uses all training data without requiring a separate calibration set. It is computationally intensive but provides valid coverage guarantees. For tidymodels workflows, pass the training data explicitly via the `data_train` argument.
* Add support `MASS::lda()` models for estimates but not standard errors. Thanks to @friendly for feature request #1598.

Bugs:
Expand Down
1 change: 1 addition & 0 deletions R/inferences.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#' + `rsample`: "perc" or "bca"
#' + `simulation`: "perc" or "wald"
#' @param data_train Data frame used to train/fit the model. If `NULL`, `marginaleffects` tries to extract the data from the original model object. Test data are inferred directly from the `newdata` supplied to the originating `marginaleffects` call (e.g., `predictions()`).
#' @param data_test Data frame make out of sample prediction. Only used for conformal inference. If `NULL`, the data frame supplied to `newdata` in the original `marginaleffects` call is used.
#' @param data_calib Data frame used for calibration in split conformal prediction.
#' @param conformal_score String. Warning: The `type` argument in `predictions()` must generate predictions which are on the same scale as the outcome variable. Typically, this means that `type` must be "response" or "probs".
#' + "residual_abs" or "residual_sq" for regression tasks (numeric outcome)
Expand Down
4 changes: 2 additions & 2 deletions R/inferences_conformal_quantile.R
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ conformal_quantile <- function(x, data_test, data_train, data_calib, conf_level
# Step 2: Get quantile predictions on calibration set
# Use same predictor columns in same order as training
x_calib <- as.data.frame(data_calib)[, predictor_cols, drop = FALSE]
q_calib <- predict(qrf, newdata = x_calib, what = c(alpha / 2, 1 - alpha / 2))
q_calib <- stats::predict(qrf, newdata = x_calib, what = c(alpha / 2, 1 - alpha / 2))
q_calib_low <- q_calib[, 1]
q_calib_high <- q_calib[, 2]

Expand All @@ -96,7 +96,7 @@ conformal_quantile <- function(x, data_test, data_train, data_calib, conf_level
# Step 5: Get quantile predictions on test set
# Use same predictor columns in same order as training
x_test <- as.data.frame(data_test)[, predictor_cols, drop = FALSE]
q_test <- predict(qrf, newdata = x_test, what = c(alpha / 2, 1 - alpha / 2))
q_test <- stats::predict(qrf, newdata = x_test, what = c(alpha / 2, 1 - alpha / 2))
q_test_low <- q_test[, 1]
q_test_high <- q_test[, 2]

Expand Down
8 changes: 8 additions & 0 deletions inst/WORDLIST
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ ARD
Aaditya
Adelie
Adelies
Alessandro
Anastasios
Angelopoulos
Arel
Expand All @@ -26,6 +27,7 @@ CRC
Candes
Carlisle
Codecov
Conformalized
Customizable
Demetri
Diniz
Expand All @@ -40,6 +42,7 @@ Estimand
Estimands
Fabbri
Foygel
G'Sell
GLMMs
Gam
Gentoos
Expand All @@ -61,6 +64,7 @@ J'VJ
JAX
JM
JVJ
Jing
Jørgensen
Kapre
Kirill
Expand Down Expand Up @@ -97,6 +101,7 @@ Rdatasets
Rdatatable
Resul
Rina
Rinaldo
Rmarkdown
Robb
Rohan
Expand All @@ -117,10 +122,12 @@ Tomz
Typst
Uffe
Umit
Wasserman
Westfall
Wittenberg
XGBoost
Xu
Yaniv
aje
al
arXiv
Expand Down Expand Up @@ -288,6 +295,7 @@ thornton
threenum
tibbles
tidiers
tidymodels
timpipeseek
tinytable
tukey
Expand Down
2 changes: 2 additions & 0 deletions man/inferences.Rd

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