plot.coxphw.predict {coxphw} | R Documentation |
This function visualizes a nonlinear or a time-dependent effect of a predict.coxphw
object.
## S3 method for class 'coxphw.predict' plot(x, addci = TRUE, xlab = NULL, ylab = NULL, ...)
x |
an output object of |
addci |
confidence intervalls are obtained. Default is TRUE. |
xlab |
label for x-axis of plot, uses variable specified in |
ylab |
label for y-axis of plot, uses as appropriate either "relative hazard" or "log relative hazard" as default. |
... |
further parameters, to be used for plots (e.g., scaling of axes). |
This function can be used to depict the estimated nonlinear or time-dependent
effect of an object of class predict.coxphw
. It supports simple nonlinear
effects as well as interaction effects of continuous variables with binary
covariates (see examples section in predict.coxphw
. ).
No output value.
In coxphw version 4.0.0 the old plotshape
function is replaced with
predict.coxphw
and plot.coxphw.predict
.
Georg Heinze, Meinhard Ploner, Daniela Dunkler
Royston P and Altman D (1994). Regression Using Fractional Polynomials of Continuous Covariates: Parsimonious Parametric Modelling. Applied StatisticsJ R STAT SOC C-APPL 43, 429-467.
Royston P and Sauerbrei W (2008). Multivariable Model-building. A pragmatic approach to regression analysis based on fractional polynomials for modelling continuous variables. Wiley, Chichester, UK.
set.seed(30091) n <- 300 x <- 1:n true.func <- function(x) 3 * (x / 100)^{2} - log(x / 100) - 3 * x / 100 x <- round(rnorm(n = x) * 10 + 40, digits = 0) time <- rexp(n = n, rate = 1) / exp(true.func(x)) event <- rep(x = 1, times = n) futime <- runif(n = n, min = 0, max = 309000) event <- (time < futime) + 0 time[event == 0] <- futime[event == 0] my.data <- data.frame(x, time, event) fitahr <- coxphw(Surv(time, event) ~ x, data = my.data, template = "AHR") # estimated function plotx <- quantile(x, probs = 0.05):quantile(x, probs = 0.95) plot(predict(fitahr, type = "shape", newx = plotx, refx = median(x), x = "x", verbose = FALSE)) # true function lines(x = plotx, true.func(plotx) - true.func(median(plotx)), lty = 2) legend("topright", legend=c("AHR estimates", "true"), bty = "n", lty = 1:2, inset = 0.05) # for more examples see predict.coxphw