Learn R Programming

survival (version 3.1-8)

survfit0: Convert the format of a survfit object.

Description

Add the point for a starting time (time 0) to a survfit object's elements. This is useful for plotting.

Usage

survfit0(x, start.time=0)

Arguments

x

a survfit object

start.time

the desired starting time; see details below.

Value

a reformulated version of the object with an initial data point at start.time added. The time, surv, pstate, cumhaz, std.err, and std.cumhaz components will all be aliged, so as to make plots and summaries easier to produce.

Details

Survival curves are traditionally plotted forward from time 0, but since the true starting time is not known as a part of the data, the survfit routine does not include a time 0 value in the resulting object. Someone might look at cumulative mortgage defaults versus calendar year, for instance, with the `time' value a Date object. The plotted curve probably should not start at 0 = 1970/01/01. (One could certainly argue that this behavior is overly pedantic, but the decision was made over 20 years ago and it is far too late to change it now.)

This is a utility function used by plot.survfit and summary.survfit. If the original survfit call included a start.time argument then that will be used as the starting point, otherwise the default is 0. It may be useful to others, so was exported.