events | R Documentation |
Given a dataset in long format, for instance generated by
msprep
, and a transition matrix for the multi-state model,
this function counts the number of observed transitions in the multi-state
model and gives their percentages.
events(msdata)
msdata |
An object of class |
Although msdata
does not need to be the result of a call to
msprep
, it does need to be an object of class "msdata"
,
which is essentially a data frame in long format, with one row for each
transition for which the subject is at risk. The columns from
,
to
, and status
need to be present, with appropriate meaning,
see msprep
. The msdata
argument needs to have a
"trans"
attributes, which holds the transition matrix of the
multi-state model.
A list containing two tables, the first, called Frequencies
,
with the number of observed transitions in the multi-state model occurring
in msdata
, the second, called Proportions
, with the
corresponding proportions.
Hein Putter H.Putter@lumc.nl
tmat <- trans.illdeath(names=c("Tx","PR","RelDeath"))
data(ebmt3) # data from Section 4 of Putter, Fiocco & Geskus (2007)
msebmt <- msprep(time=c(NA,"prtime","rfstime"),status=c(NA,"prstat","rfsstat"),
data=ebmt3,trans=tmat)
events(msebmt) # see Fig 13 of Putter, Fiocco & Geskus (2007)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.