77# ' @param object An object of class `model_fit`
88# ' @param new_data A rectangular data object, such as a data frame.
99# ' @param type A single character value or `NULL`. Possible values
10- # ' are "numeric", "class", "probs", "conf_int", "pred_int", or
11- # ' "raw". When `NULL`, `predict` will choose an appropriate value
10+ # ' are "numeric", "class", "probs", "conf_int", "pred_int", "quantile",
11+ # ' or "raw". When `NULL`, `predict` will choose an appropriate value
1212# ' based on the model's mode.
1313# ' @param opts A list of optional arguments to the underlying
1414# ' predict function that will be used when `type = "raw"`. The
4545# ' produces for class probabilities (or other non-scalar outputs),
4646# ' the columns will be named `.pred_lower_classlevel` and so on.
4747# '
48+ # ' Quantile predictions return a tibble with a column `.pred`, which is
49+ # ' a list-column. Each list element contains a tibble with columns
50+ # ' `.pred` and `.quantile` (and perhaps others).
51+ # '
4852# ' Using `type = "raw"` with `predict.model_fit` (or using
4953# ' `predict_raw`) will return the unadulterated results of the
5054# ' prediction function.
@@ -96,6 +100,7 @@ predict.model_fit <- function (object, new_data, type = NULL, opts = list(), ...
96100 prob = predict_classprob(object = object , new_data = new_data , ... ),
97101 conf_int = predict_confint(object = object , new_data = new_data , ... ),
98102 pred_int = predict_predint(object = object , new_data = new_data , ... ),
103+ quantile = predict_quantile(object = object , new_data = new_data , ... ),
99104 raw = predict_raw(object = object , new_data = new_data , opts = opts , ... ),
100105 stop(" I don't know about type = '" , " '" , type , call. = FALSE )
101106 )
@@ -112,7 +117,8 @@ predict.model_fit <- function (object, new_data, type = NULL, opts = list(), ...
112117 res
113118}
114119
115- pred_types <- c(" raw" , " numeric" , " class" , " link" , " prob" , " conf_int" , " pred_int" )
120+ pred_types <-
121+ c(" raw" , " numeric" , " class" , " link" , " prob" , " conf_int" , " pred_int" , " quantile" )
116122
117123# ' @importFrom glue glue_collapse
118124check_pred_type <- function (object , type ) {
0 commit comments