Skip to content

Commit 34f8846

Browse files
hfricktopepo
andauthored
add to predict() docs how to get the IPCW (#981)
* add link to `augment()` as a way to get the IPCW * add links to tidymodels article --------- Co-authored-by: Max Kuhn <[email protected]>
1 parent b14fd04 commit 34f8846

File tree

4 files changed

+30
-5
lines changed

4 files changed

+30
-5
lines changed

R/augment.R

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,15 @@
2727
#'
2828
#' If survival predictions are created and `new_data` contains a
2929
#' [survival::Surv()] object, additional columns are added for inverse
30-
#' probability of censoring weights (IPCW) are also created. This enables the
31-
#' user to compute performance metrics in the \pkg{yardstick} package.
30+
#' probability of censoring weights (IPCW) are also created (see `tidymodels.org`
31+
#' page in the references below). This enables the user to compute performance
32+
#' metrics in the \pkg{yardstick} package.
3233
#'
3334
#' @param new_data A data frame or matrix.
3435
#' @param ... Not currently used.
3536
#' @rdname augment
37+
#' @references
38+
#' \url{https://www.tidymodels.org/learn/statistics/survival-metrics/}
3639
#' @export
3740
#' @examples
3841
#' car_trn <- mtcars[11:32,]

R/predict.R

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,13 @@
5454
#' functions will adjust the values to fit this specification by removing
5555
#' offending points (with a warning).
5656
#'
57+
#' `predict.model_fit()` does not require the outcome to be present. For
58+
#' performance metrics on the predicted survival probability, inverse probability
59+
#' of censoring weights (IPCW) are required (see the `tidymodels.org` reference
60+
#' below). Those require the outcome and are thus not returned by `predict()`.
61+
#' They can be added via [augment.model_fit()] if `new_data` contains a column
62+
#' with the outcome as a `Surv` object.
63+
#'
5764
#' Also, when `type = "linear_pred"`, censored regression models will by default
5865
#' be formatted such that the linear predictor _increases_ with time. This may
5966
#' have the opposite sign as what the underlying model's `predict()` method
@@ -105,7 +112,8 @@
105112
#' `predict()` function will return the same structure as above but
106113
#' filled with missing values. This does not currently work for
107114
#' multivariate models.
108-
#'
115+
#' @references
116+
#' \url{https://www.tidymodels.org/learn/statistics/survival-metrics/}
109117
#' @examples
110118
#' library(dplyr)
111119
#'

man/augment.Rd

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

man/predict.model_fit.Rd

Lines changed: 10 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)