Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

events

Count number of observed transitions


Description

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.

Usage

events(msdata)

Arguments

msdata

An object of class "msdata", such as output by msprep

Details

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.

Value

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.

Author(s)

Hein Putter H.Putter@lumc.nl

Examples

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)

mstate

Data Preparation, Estimation and Prediction in Multi-State Models

v0.3.1
GPL (>= 2)
Authors
Hein Putter [aut, cre], Liesbeth C. de Wreede [aut], Marta Fiocco [aut], Ronald B. Geskus [ctb], Edouard F. Bonneville [ctb], Damjan Manevski [ctb]
Initial release
2020-12-17

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.