plot.frailtyCmprsk: Plot Method for a Weibull competing risks model with optional...

plot.frailtyCmprskR Documentation

Plot Method for a Weibull competing risks model with optional shared frailty between transitions.

Description

Plots estimated baseline survival and hazard functions from an object of class 'frailtyCmprsk'. Confidence bands are allowed.

Usage

## S3 method for class 'frailtyCmprsk'
plot(x, type.plot="Baseline hazard", events, conf.bands=TRUE, 
pos.legend="topright", cex.legend=0.7, lwd=c(1,1,1), color=2, median=TRUE, 
Xlab = "Time", Ylab = "Baseline hazard function",...)

Arguments

x

A Weibull competing risks model, i.e. an frailtyCmprsk class object (output from calling frailtyCmprsk function).

type.plot

a character string specifying the type of curve. Possible value are "Baseline hazard", or "Baseline survival". The default is "Baseline hazard". Only the first letters are required, e.g "Haz", "Su".

events

Integer vector specifying which competing events to display in the plots. Use 1 for the first event, 2 for the second, and so on. If not specified, plots for all events are shown.

conf.bands

Logical value. Determines whether confidence bands will be plotted. The default is TRUE.

pos.legend

The location of the legend can be specified by setting this argument to a single keyword from the list '"bottomright"', '"bottom"', '"bottomleft"', '"left"', '"topleft"', '"top"', '"topright"', '"right"' and '"center"'. The default is '"topright"'

cex.legend

character expansion factor *relative* to current 'par("cex")'. Default is 0.5

lwd

A vector of length 3 of positive values to specify the line width of the plots and their confidence bands. If no confidence bands are plotted, the last two elements of the vector are ignored. Default is (1,1,1).

color

color of the curve (integer)

median

Logical value. Determines whether median survival time will be plotted. Default is TRUE.

Xlab

Label of x-axis. Default is '"Time"'

Ylab

Label of y-axis. Default is '"Baseline hazard function"'

...

other unused arguments

Details

Plot Method for a Weibull competing risks model with optional shared frailty between transitions.

Value

Print a plot of a Weibull competing risks model with optional shared frailty between transitions.

See Also

frailtyCmprsk

Examples



    ###--- Simple Weibull competing risks model ---###

    data(CPRSKbmtcrr)

    ModCmprsk_NoCov_Factor <- frailtyCmprsk(
      formulas = list(
        Surv(observed_time, Status, type = "mstate") ~ D,
        ~ 1
      ),
      data = CPRSKbmtcrr,
      print.info = FALSE,
      maxit = 100
    )

    plot(ModCmprsk_NoCov_Factor)

    #-- No confidence bands
    plot(ModCmprsk_NoCov_Factor, conf.bands = FALSE)




frailtypack documentation built on Nov. 23, 2025, 1:09 a.m.