plot.npdf {discfrail}R Documentation

Survival or cumulative hazard curves from a fitted nonparametric discrete frailty model

Description

This function plots estimates of the survival or cumulative hazard for each group, coloured according to the latent population that each group belongs to.

Usage

## S3 method for class 'npdf'
plot(x, type = "km", cols = NULL, survfit_opts = NULL,
  na_opts = NULL, ...)

Arguments

x

A fitted nonparametric discrete frailty model, as returned by npdf_cox with estK=FALSE.

type

character. If "km" group-specific Kaplan-Meier estimates of survival are plotted. If "na" group-specific Nelson-Aalen estimates of the cumulative hazard are plotted. The default is "km".

cols

Vector of colour names or numbers, of the same length as the number of groups. If not given, this defaults to x$belonging.

survfit_opts

Optional list of additional arguments to pass to survfit.formula.

na_opts

Optional list of arguments (other than "cols") to pass to plot.nelsonaalen_npdf.

...

Optional arguments to pass to plot.survfit.

Examples


result = npdf_cox( Surv(time, status) ~ x, groups = family, data = weibdata2030,
                    K = 2, estK = FALSE, eps_conv=10^-4)
plot( result )
plot( result, type = "km" )
plot( result, cols = ifelse( result$belonging == 1, "purple", "black" ), xlim = c( 0, 150 ) )

## use of survfit_opts.  show only first 10 groups
plot( result, survfit_opts = list(subset = (weibdata2030$family >= 10) ))

plot( result, type = "na" )

## use of na_opts to customise the Nelson-Aalen plot
plot( result, type = "na", cols=ifelse(result$belonging==2, "purple", "black"),
     na_opts = list(xlim=c(0,200), ylim=c(0,2),
                    xlab="Follow-up days",
                    ylab="Nelson-Aalen estimate"))


[Package discfrail version 0.1 Index]