| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/probtrans.R |
| 3 |
\name{probtrans} |
| 4 |
\alias{probtrans} |
| 5 |
\title{Compute subject-specific or overall transition probabilities with standard |
| 6 |
errors} |
| 7 |
\usage{ |
| 8 |
probtrans( |
| 9 |
object, |
| 10 |
predt, |
| 11 |
direction = c("forward", "fixedhorizon"), |
| 12 |
method = c("aalen", "greenwood"), |
| 13 |
variance = TRUE, |
| 14 |
covariance = FALSE |
| 15 |
) |
| 16 |
} |
| 17 |
\arguments{ |
| 18 |
\item{object}{\link{msfit} object containing estimated cumulative hazards |
| 19 |
for each of the transitions in the multi-state model and, if standard errors |
| 20 |
are requested, (co)variances of these cumulative hazards for each pair of |
| 21 |
transitions} |
| 22 |
|
| 23 |
\item{predt}{A positive number indicating the prediction time. This is |
| 24 |
either the time at which the prediction is made (if \code{direction}= |
| 25 |
\code{"forward"}) or the time for which the prediction is to be made (if |
| 26 |
\code{direction}=\code{"fixedhorizon"})} |
| 27 |
|
| 28 |
\item{direction}{One of \code{"forward"} (default) or \code{"fixedhorizon"}, |
| 29 |
indicating whether prediction is forward or for a fixed horizon} |
| 30 |
|
| 31 |
\item{method}{A character string specifying the type of variances to be |
| 32 |
computed (so only needed if either \code{variance} or \code{covariance} is |
| 33 |
\code{TRUE}). Possible values are \code{"aalen"} or \code{"greenwood"}} |
| 34 |
|
| 35 |
\item{variance}{Logical value indicating whether standard errors are to be |
| 36 |
calculated (default is \code{TRUE})} |
| 37 |
|
| 38 |
\item{covariance}{Logical value indicating whether covariances of transition |
| 39 |
probabilities for different states are to be calculated (default is |
| 40 |
\code{FALSE})} |
| 41 |
} |
| 42 |
\value{ |
| 43 |
An object of class \code{"probtrans"}, which is a list of which item |
| 44 |
[[s]] contains a data frame with the estimated transition probabilities (and |
| 45 |
standard errors if \code{variance}=\code{TRUE}) from state s. If |
| 46 |
\code{covariance}=\code{TRUE}, item \code{varMatrix} contains an array of |
| 47 |
dimension K^2 x K^2 x (nt+1) (with K the number of states and nt the |
| 48 |
distinct transition time points); the time points correspond to those in the |
| 49 |
data frames with the estimated transition probabilities. Finally, there are |
| 50 |
items \code{trans}, \code{method}, \code{predt}, \code{direction}, recording |
| 51 |
the transition matrix, and the method, predt and direction arguments used in |
| 52 |
the call to probtrans. Plot and summary methods have been defined for |
| 53 |
\code{"probtrans"} objects. |
| 54 |
} |
| 55 |
\description{ |
| 56 |
This function computes subject-specific or overall transition probabilities |
| 57 |
in multi-state models. If requested, also standard errors are calculated. |
| 58 |
} |
| 59 |
\details{ |
| 60 |
For details refer to de Wreede, Fiocco & Putter (2010). |
| 61 |
} |
| 62 |
\examples{ |
| 63 |
|
| 64 |
# transition matrix for illness-death model |
| 65 |
tmat <- trans.illdeath() |
| 66 |
# data in wide format, for transition 1 this is dataset E1 of |
| 67 |
# Therneau & Grambsch (2000) |
| 68 |
tg <- data.frame(illt=c(1,1,6,6,8,9),ills=c(1,0,1,1,0,1), |
| 69 |
dt=c(5,1,9,7,8,12),ds=c(1,1,1,1,1,1), |
| 70 |
x1=c(1,1,1,0,0,0),x2=c(6:1)) |
| 71 |
# data in long format using msprep |
| 72 |
tglong <- msprep(time=c(NA,"illt","dt"),status=c(NA,"ills","ds"), |
| 73 |
data=tg,keep=c("x1","x2"),trans=tmat) |
| 74 |
# events |
| 75 |
events(tglong) |
| 76 |
table(tglong$status,tglong$to,tglong$from) |
| 77 |
# expanded covariates |
| 78 |
tglong <- expand.covs(tglong,c("x1","x2")) |
| 79 |
# Cox model with different covariate |
| 80 |
cx <- coxph(Surv(Tstart,Tstop,status)~x1.1+x2.2+strata(trans), |
| 81 |
data=tglong,method="breslow") |
| 82 |
summary(cx) |
| 83 |
# new data, to check whether results are the same for transition 1 as |
| 84 |
# those in appendix E.1 of Therneau & Grambsch (2000) |
| 85 |
newdata <- data.frame(trans=1:3,x1.1=c(0,0,0),x2.2=c(0,1,0),strata=1:3) |
| 86 |
HvH <- msfit(cx,newdata,trans=tmat) |
| 87 |
# probtrans |
| 88 |
pt <- probtrans(HvH,predt=0) |
| 89 |
# predictions from state 1 |
| 90 |
pt[[1]] |
| 91 |
|
| 92 |
} |
| 93 |
\references{ |
| 94 |
Andersen PK, Borgan O, Gill RD, Keiding N (1993). |
| 95 |
\emph{Statistical Models Based on Counting Processes}. Springer, New York. |
| 96 |
|
| 97 |
Putter H, Fiocco M, Geskus RB (2007). Tutorial in biostatistics: Competing |
| 98 |
risks and multi-state models. \emph{Statistics in Medicine} \bold{26}, |
| 99 |
2389--2430. |
| 100 |
|
| 101 |
Therneau TM, Grambsch PM (2000). \emph{Modeling Survival Data: Extending the |
| 102 |
Cox Model}. Springer, New York. |
| 103 |
|
| 104 |
de Wreede LC, Fiocco M, and Putter H (2010). The mstate package for |
| 105 |
estimation and prediction in non- and semi-parametric multi-state and |
| 106 |
competing risks models. \emph{Computer Methods and Programs in Biomedicine} |
| 107 |
\bold{99}, 261--274. |
| 108 |
|
| 109 |
de Wreede LC, Fiocco M, and Putter H (2011). mstate: An R Package for the |
| 110 |
Analysis of Competing Risks and Multi-State Models. \emph{Journal of |
| 111 |
Statistical Software}, Volume 38, Issue 7. |
| 112 |
} |
| 113 |
\author{ |
| 114 |
Liesbeth de Wreede and Hein Putter \email{[email protected]} |
| 115 |
} |
| 116 |
\keyword{survival} |