Perform a set of consistency checks on survival data
survcheck(formula, data, subset, na.action, id, istate, istate0="(s0)",
timefix=TRUE,...)
a list with components
the vector of possible states, a union of what appears
in the Surv object and istate
, with initial states first
a matrix giving the count of transitions from one state to another
table of the number of visits per state, e.g., 18 subjects had 2 visits to the "infection" state
a vector giving the counts of each check
a constructed istate that best satisfies all the checks
a list with the row number and id of overlaps (not present if there are no overlaps)
a list with the row number and id of gaps (not present if there are no gaps)
a list with the row number and id of inconsistent rows (not present if there are none)
a list with the row number and id of jumps (not present if there are no jumps)
a model formula with a Surv
object as the
response
data frame in which to find the id
,
istate
and formula variables
expression indicating which subset of the rows of data should be used in the fit. All observations are included by default.
a missing-data filter function. This is applied to the model.frame
after any
subset argument has been used. Default is options()\$na.action
.
an identifier that labels unique subjects
an optional vector giving the current state at the start of each interval
default label for the initial state of each subject (at
their first interval) when istate
is missing
process times through the aeqSurv
function to
eliminate potential roundoff issues.
other arguments, which are ignored (but won't give an
error if someone added weights
for instance)
This routine will examine a multi-state data set for consistency of the data. The basic rules are that if a subject is at risk they have to be somewhere, can not be two places at once, and should make sensible transitions from state to state. It reports the number of instances of the following conditions:
two observations for the same subject that overlap in
time, e.g. intervals of (0, 100) and (90, 120).
If y
is simple (time, status) survival observation
intervals implicitly start at 0, so in that case any duplicate
identifiers will generate an overlap.
one or more gaps in a subject's timeline; where they are in the same state at their return as when they left.
a hole in a subject's timeline, where they are in one state at the end of the prior interval, but a new state in the at the start subsequent interval.
two adjacent intervals for a subject, with the first interval ending in one state and the subsequent interval starting in another. They have instantaneously changed states in 0 units of time.
not currently used
The total number of occurences of each is present in the flags
vector. Optional components give the location and identifiers of the
flagged observations.
The Surv
function has already flagged any 0 length intervals as errors.