| msfit | R Documentation |
This function computes subject-specific or overall cumulative transition hazards for each of the possible transitions in the multi-state model. If requested, also the variances and covariances of the estimated cumulative transition hazards are calculated.
msfit(
object,
newdata,
variance = TRUE,
vartype = c("aalen", "greenwood"),
trans
)
object |
A |
newdata |
A data frame with the same variable names as those that
appear in the |
variance |
A logical value indicating whether the (co-)variances of the
subject-specific transition hazards should be computed. Default is
|
vartype |
A character string specifying the type of variances to be
computed (so only needed if |
trans |
Transition matrix describing the states and transitions in the
multi-state model. See |
The data frame needs to have one row for each transition in the multi-state
model. An additional column strata (numeric) is needed to describe
for each transition to which stratum it belongs. The name has to be
strata, even if in the original coxph call another variable
was used. For details refer to de Wreede, Fiocco & Putter (2010). So far,
the results have been checked only for the "breslow" method of
dealing with ties in coxph, so this is
recommended.
An object of class "msfit", which is a list containing
Haz |
A data frame with |
varHaz |
A data frame with
|
trans |
The transition matrix used |
Hein Putter H.Putter@lumc.nl
Putter H, Fiocco M, Geskus RB (2007). Tutorial in biostatistics: Competing risks and multi-state models. Statistics in Medicine 26, 2389–2430.
Therneau TM, Grambsch PM (2000). Modeling Survival Data: Extending the Cox Model. Springer, New York.
de Wreede LC, Fiocco M, and Putter H (2010). The mstate package for estimation and prediction in non- and semi-parametric multi-state and competing risks models. Computer Methods and Programs in Biomedicine 99, 261–274.
de Wreede LC, Fiocco M, and Putter H (2011). mstate: An R Package for the Analysis of Competing Risks and Multi-State Models. Journal of Statistical Software, Volume 38, Issue 7.
plot.msfit
# transition matrix for illness-death model
tmat <- trans.illdeath()
# data in wide format, for transition 1 this is dataset E1 of
# Therneau & Grambsch (2000)
tg <- data.frame(illt=c(1,1,6,6,8,9),ills=c(1,0,1,1,0,1),
dt=c(5,1,9,7,8,12),ds=c(1,1,1,1,1,1),
x1=c(1,1,1,0,0,0),x2=c(6:1))
# data in long format using msprep
tglong <- msprep(time=c(NA,"illt","dt"),status=c(NA,"ills","ds"),
data=tg,keep=c("x1","x2"),trans=tmat)
# events
events(tglong)
table(tglong$status,tglong$to,tglong$from)
# expanded covariates
tglong <- expand.covs(tglong,c("x1","x2"))
# Cox model with different covariate
cx <- coxph(Surv(Tstart,Tstop,status)~x1.1+x2.2+strata(trans),
data=tglong,method="breslow")
summary(cx)
# new data, to check whether results are the same for transition 1 as
# those in appendix E.1 of Therneau & Grambsch (2000)
newdata <- data.frame(trans=1:3,x1.1=c(0,0,0),x2.2=c(0,1,0),strata=1:3)
msfit(cx,newdata,trans=tmat)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.