plot.unsurv: Plot medoid survival curves from an unsurv fit

View source: R/plot.R

plot.unsurvR Documentation

Plot medoid survival curves from an unsurv fit

Description

Produces a base R plot of the cluster medoid survival curves stored in the fitted object.

Usage

## S3 method for class 'unsurv'
plot(x, ...)

Arguments

x

An object of class "unsurv".

...

Additional arguments passed to matplot (e.g., lwd).

Value

Invisibly returns x.

Examples

if (requireNamespace("cluster", quietly = TRUE)) {
  set.seed(1)
  times <- seq(0, 4, length.out = 30)
  grp <- rep(1:2, each = 8)
  rates <- c(0.2, 0.55)
  S <- sapply(times, function(t) exp(-rates[grp] * t))
  fit <- unsurv(S, times, K = 2)
  plot(fit)
}

unsurv documentation built on Sept. 1, 2026, 1:06 a.m.