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

xsect

Make a cross-section of multi-state data at a given time point


Description

Given a dataset in long format, for instance generated by msprep, this function takes a cross-section at a given time point, to list the subjects under observation (at risk) at that time point and the states currently occupied.

Usage

xsect(msdata, xtime = 0)

Arguments

msdata

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

xtime

The time point at which the intersection is to be made

Details

It is possible that subjects have moved to one of the absorbing states prior to xtime; this is NOT taken into account. The function xsect only concerns subjects currently (at time) at risk.

Value

A list containing idstate, a data frame containing id's and state, the number of the state currently occupied; atrisk, the number at risk, and prop, a table counting how many of those at risk occupy which state.

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)
# At the start everyone is in state 1 (default xtime=0 is used)
xsect(msebmt)
# At 5 years
xsect(msebmt, xtime=1826)

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.