| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/msfit.R |
| 3 |
\name{msfit} |
| 4 |
\alias{msfit} |
| 5 |
\title{Compute subject-specific transition hazards with (co-)variances} |
| 6 |
\usage{ |
| 7 |
msfit( |
| 8 |
object, |
| 9 |
newdata, |
| 10 |
variance = TRUE, |
| 11 |
vartype = c("aalen", "greenwood"), |
| 12 |
trans |
| 13 |
) |
| 14 |
} |
| 15 |
\arguments{ |
| 16 |
\item{object}{A \code{\link[survival:coxph]{coxph}} object describing the |
| 17 |
fit of the multi-state model} |
| 18 |
|
| 19 |
\item{newdata}{A data frame with the same variable names as those that |
| 20 |
appear in the \code{coxph} formula. Its use is somewhat different from |
| 21 |
\code{\link[survival:survfit]{survfit}}. See Details. The argument |
| 22 |
\code{newdata} may be omitted only if the right hand side of the formula in |
| 23 |
the \code{coxph} object is \code{~strata(trans)}} |
| 24 |
|
| 25 |
\item{variance}{A logical value indicating whether the (co-)variances of the |
| 26 |
subject-specific transition hazards should be computed. Default is |
| 27 |
\code{TRUE}} |
| 28 |
|
| 29 |
\item{vartype}{A character string specifying the type of variances to be |
| 30 |
computed (so only needed if \code{variance}=\code{TRUE}). Possible values |
| 31 |
are \code{"aalen"} or \code{"greenwood"}} |
| 32 |
|
| 33 |
\item{trans}{Transition matrix describing the states and transitions in the |
| 34 |
multi-state model. See \code{trans} in \code{\link{msprep}} for more |
| 35 |
detailed information} |
| 36 |
} |
| 37 |
\value{ |
| 38 |
An object of class \code{"msfit"}, which is a list containing |
| 39 |
\item{Haz }{A data frame with \code{time}, \code{Haz}, \code{trans}, |
| 40 |
containing the estimated subject-specific hazards for each of the |
| 41 |
transitions in the multi-state model} \item{varHaz }{A data frame with |
| 42 |
\code{time}, \code{Haz}, \code{trans1}, \code{trans2} containing the |
| 43 |
variances (\code{trans1}=\code{trans2}) and covariances |
| 44 |
(\code{trans1}<\code{trans2}) of the estimated hazards. This element is only |
| 45 |
returned when \code{variance}=\code{TRUE}} \item{trans}{The transition |
| 46 |
matrix used} |
| 47 |
} |
| 48 |
\description{ |
| 49 |
This function computes subject-specific or overall cumulative transition |
| 50 |
hazards for each of the possible transitions in the multi-state model. If |
| 51 |
requested, also the variances and covariances of the estimated cumulative |
| 52 |
transition hazards are calculated. |
| 53 |
} |
| 54 |
\details{ |
| 55 |
The data frame needs to have one row for each transition in the multi-state |
| 56 |
model. An additional column \code{strata} (numeric) is needed to describe |
| 57 |
for each transition to which stratum it belongs. The name has to be |
| 58 |
\code{strata}, even if in the original \code{coxph} call another variable |
| 59 |
was used. For details refer to de Wreede, Fiocco & Putter (2010). So far, |
| 60 |
the results have been checked only for the \code{"breslow"} method of |
| 61 |
dealing with ties in \code{\link[survival:coxph]{coxph}}, so this is |
| 62 |
recommended. |
| 63 |
} |
| 64 |
\examples{ |
| 65 |
|
| 66 |
# transition matrix for illness-death model |
| 67 |
tmat <- trans.illdeath() |
| 68 |
# data in wide format, for transition 1 this is dataset E1 of |
| 69 |
# Therneau & Grambsch (2000) |
| 70 |
tg <- data.frame(illt=c(1,1,6,6,8,9),ills=c(1,0,1,1,0,1), |
| 71 |
dt=c(5,1,9,7,8,12),ds=c(1,1,1,1,1,1), |
| 72 |
x1=c(1,1,1,0,0,0),x2=c(6:1)) |
| 73 |
# data in long format using msprep |
| 74 |
tglong <- msprep(time=c(NA,"illt","dt"),status=c(NA,"ills","ds"), |
| 75 |
data=tg,keep=c("x1","x2"),trans=tmat) |
| 76 |
# events |
| 77 |
events(tglong) |
| 78 |
table(tglong$status,tglong$to,tglong$from) |
| 79 |
# expanded covariates |
| 80 |
tglong <- expand.covs(tglong,c("x1","x2")) |
| 81 |
# Cox model with different covariate |
| 82 |
cx <- coxph(Surv(Tstart,Tstop,status)~x1.1+x2.2+strata(trans), |
| 83 |
data=tglong,method="breslow") |
| 84 |
summary(cx) |
| 85 |
# new data, to check whether results are the same for transition 1 as |
| 86 |
# those in appendix E.1 of Therneau & Grambsch (2000) |
| 87 |
newdata <- data.frame(trans=1:3,x1.1=c(0,0,0),x2.2=c(0,1,0),strata=1:3) |
| 88 |
msfit(cx,newdata,trans=tmat) |
| 89 |
|
| 90 |
} |
| 91 |
\references{ |
| 92 |
Putter H, Fiocco M, Geskus RB (2007). Tutorial in biostatistics: |
| 93 |
Competing risks and multi-state models. \emph{Statistics in Medicine} |
| 94 |
\bold{26}, 2389--2430. |
| 95 |
|
| 96 |
Therneau TM, Grambsch PM (2000). \emph{Modeling Survival Data: Extending the |
| 97 |
Cox Model}. Springer, New York. |
| 98 |
|
| 99 |
de Wreede LC, Fiocco M, and Putter H (2010). The mstate package for |
| 100 |
estimation and prediction in non- and semi-parametric multi-state and |
| 101 |
competing risks models. \emph{Computer Methods and Programs in Biomedicine} |
| 102 |
\bold{99}, 261--274. |
| 103 |
|
| 104 |
de Wreede LC, Fiocco M, and Putter H (2011). mstate: An R Package for the |
| 105 |
Analysis of Competing Risks and Multi-State Models. \emph{Journal of |
| 106 |
Statistical Software}, Volume 38, Issue 7. |
| 107 |
} |
| 108 |
\seealso{ |
| 109 |
\code{\link{plot.msfit}} |
| 110 |
} |
| 111 |
\author{ |
| 112 |
Hein Putter \email{[email protected]} |
| 113 |
} |
| 114 |
\keyword{survival} |