plot.coxlps {blapsr}R Documentation

Plot baseline hazard and survival curves from a coxlps object.

Description

Produces a plot of the baseline hazard and/or survival based on a coxlps object.

Usage

## S3 method for class 'coxlps'
plot(x, S0 = TRUE, h0 = TRUE, cred.int = 0.95, overlay.km = FALSE,
     plot.cred = FALSE, np = 50, show.legend = TRUE, ...)

Arguments

x

An object of class coxlps.

S0

Logical. Should the estimated baseline survival be plotted?

h0

Logical. Should the estimated baseline hazard be plotted?

cred.int

The level for an approximate pointwise credible interval to be computed for the baseline curves. Default is 0.95.

overlay.km

A logical value indicating whether the Kaplan-Meier estimate should be plotted together with the smooth baseline survival curve. The default is FALSE.

plot.cred

Logical. Should the credible intervals be plotted ? Default is FALSE.

np

The number of points used to plot the smooth baseline functions. Default is 50 and allowed values are between 20 and 200.

show.legend

Logical. Should a legend be displayed?

...

Further arguments to be passed to plot.

Details

Plots for the baseline hazard and survival curves are computed on a grid (of length np) between 0 and the 99th percentile of follow-up times. When plot.cred is FALSE, the fit omits to compute the approximate pointwise credible intervals for plotting and hence is less computationally intensive. Vertical ticks on the x-axis correspond to the observed follow-up times.

Author(s)

Oswaldo Gressani oswaldo_gressani@hotmail.fr.

See Also

coxlps coxlps.object

Examples



## Simulate survival data
set.seed(6)
betas <- c(0.35, -0.20, 0.05, 0.80) # Regression coefficients
data <- simsurvdata(a = 1.8, b = 2, n = 200, betas = betas, censperc = 25)
simdat <- data$survdata

# Fit model
fit <- coxlps(Surv(time, delta) ~ x1 + x2 + x3 + x4, data = simdat)
plot(fit, h0 = FALSE, S0 = TRUE, overlay.km = FALSE, show.legend = FALSE)
domt <- seq(0, 5.5, length = 500)
lines(domt, data$S0(domt), type = "l", col = "red")
legend("topright", c("Bayesian LPS", "Target"), col = c("black", "red"),
       lty = c(1, 1), bty = "n", cex = 0.8)


[Package blapsr version 0.6.1 Index]