Debian Codegraph @

man/xsect.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/xsect.R
3 \name{xsect}
4 \alias{xsect}
5 \title{Make a cross-section of multi-state data at a given time point}
6 \usage{
7 xsect(msdata, xtime = 0)
8 }
9 \arguments{
10 \item{msdata}{An object of class \code{"msdata"}, such as output by
11 \code{\link{msprep}}}
12
13 \item{xtime}{The time point at which the intersection is to be made}
14 }
15 \value{
16 A list containing \code{idstate}, a data frame containing
17 \code{id}'s and \code{state}, the number of the state currently occupied;
18 \code{atrisk}, the number at risk, and \code{prop}, a table counting how
19 many of those at risk occupy which state.
20 }
21 \description{
22 Given a dataset in long format, for instance generated by
23 \code{\link{msprep}}, this function takes a cross-section at a given time
24 point, to list the subjects under observation (at risk) at that time point
25 and the states currently occupied.
26 }
27 \details{
28 It is possible that subjects have moved to one of the absorbing states prior
29 to \code{xtime}; this is NOT taken into account. The function \code{xsect}
30 only concerns subjects currently (at \code{time}) at risk.
31 }
32 \examples{
33
34 tmat <- trans.illdeath(names=c("Tx","PR","RelDeath"))
35 data(ebmt3) # data from Section 4 of Putter, Fiocco & Geskus (2007)
36 msebmt <- msprep(time=c(NA,"prtime","rfstime"),status=c(NA,"prstat","rfsstat"),
37 data=ebmt3,trans=tmat)
38 # At the start everyone is in state 1 (default xtime=0 is used)
39 xsect(msebmt)
40 # At 5 years
41 xsect(msebmt, xtime=1826)
42
43 }
44 \author{
45 Hein Putter \email{[email protected]}
46 }
47 \keyword{univar}