Skip to content

Commit 1af1be9

Browse files
docs and imports
1 parent 67ccb62 commit 1af1be9

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

R/inferences.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#' + `rsample`: "perc" or "bca"
2525
#' + `simulation`: "perc" or "wald"
2626
#' @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()`).
27+
#' @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.
2728
#' @param data_calib Data frame used for calibration in split conformal prediction.
2829
#' @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".
2930
#' + "residual_abs" or "residual_sq" for regression tasks (numeric outcome)

R/inferences_conformal_quantile.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ conformal_quantile <- function(x, data_test, data_train, data_calib, conf_level
7070
# Step 2: Get quantile predictions on calibration set
7171
# Use same predictor columns in same order as training
7272
x_calib <- as.data.frame(data_calib)[, predictor_cols, drop = FALSE]
73-
q_calib <- predict(qrf, newdata = x_calib, what = c(alpha / 2, 1 - alpha / 2))
73+
q_calib <- stats::predict(qrf, newdata = x_calib, what = c(alpha / 2, 1 - alpha / 2))
7474
q_calib_low <- q_calib[, 1]
7575
q_calib_high <- q_calib[, 2]
7676

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

man/inferences.Rd

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)