plot.npdf {discfrail}R Documentation

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


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


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



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


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


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


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


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


Optional arguments to pass to plot.survfit.


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]