Description Usage Arguments Value Examples
This function assists the user in interpreting effect sizes estimated using the coxph function. It provides the predicted probability of not observing an event, the survival function, for a fixed time period over the full range of variable's values. This routine is a plot-based wrapper for the "riskRegression" "predictCox" function, and as such, should be treated accordingly.
1 2 3 4 |
coxph_fit |
The output from a fitted "coxph" call. |
var |
A character string specifying the variable from "coxph_fit" that predicted probabilities should be plotted for. |
time |
This is the fixed time point that should be used to calculate the predicted probabilities. |
seed |
This is the seed that should be set for replication |
yaxis_label |
This is the label as it appears for the y-axis. This is the probability of not observing an event. |
xaxis_label |
This is the label ax it appears for the x-axis. This is the range of variable values for the "var" variable. |
title |
This is the plot title as it should appear. |
A ggplot2 object summarizing the corresponding predicted probability.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | library(survival)
data("heart")
# Coerce from factor
heart$transplant <- as.numeric(heart$transplant)
# Rescale age
heart$age <- heart$age+48
coxph_fit <- coxph(Surv(start, stop, event) ~
age + transplant +surgery,
data = heart,
x = TRUE)
plot_predicted_probs(coxph_fit,
var = "age",
time = mean(heart$stop-heart$start),
seed = 123,
xaxis_label = "Age")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.