plot.coxphw.predict: Plot the Relative or Log Relative Hazard Versus Values of a...

Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/plot.coxphw.predict.r

Description

This function visualizes a nonlinear or a time-dependent effect of a predict.coxphw object.

Usage

1
2
## S3 method for class 'coxphw.predict'
plot(x, addci = TRUE,  xlab = NULL, ylab = NULL, ...)

Arguments

x

an output object of coxphw.

addci

confidence intervalls are obtained. Default is TRUE.

xlab

label for x-axis of plot, uses variable specified in x in predict as default.

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).

Details

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. ).

Value

No output value.

Note

In coxphw version 4.0.0 the old plotshape function is replaced with predict.coxphw and plot.coxphw.predict.

Author(s)

Georg Heinze, Meinhard Ploner, Daniela Dunkler

References

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.

See Also

coxphw, predict.coxphw

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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

Example output

Loading required package: survival

coxphw documentation built on July 8, 2020, 6:52 p.m.