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 |
---|
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.
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.
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)#> $Frequencies #> to #> from Tx PR RelDeath no event total entering #> Tx 0 1169 458 577 2204 #> PR 0 0 383 786 1169 #> RelDeath 0 0 0 841 841 #> #> $Proportions #> to #> from Tx PR RelDeath no event #> Tx 0.0000000 0.5303993 0.2078040 0.2617967 #> PR 0.0000000 0.0000000 0.3276305 0.6723695 #> RelDeath 0.0000000 0.0000000 0.0000000 1.0000000 #>