Learn R Programming

mstate (version 0.2.6)

msfit: Compute subject-specific transition hazards with (co-)variances

Description

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.

Usage

msfit(object, newdata, variance=TRUE, vartype=c("aalen","greenwood"), trans)

Arguments

object
A coxph object describing the fit of the multi-state model
newdata
A data frame with the same variable names as those that appear in the coxph formula. Its use is somewhat different from survfit. See Details. The argument newdata
variance
A logical value indicating whether the (co-)variances of the subject-specific transition hazards should be computed. Default is TRUE
vartype
A character string specifying the type of variances to be computed (so only needed if variance=TRUE). Possible values are "aalen" or "greenwood"
trans
Transition matrix describing the states and transitions in the multi-state model. See trans in msprep for more detailed information

Value

  • An object of class "msfit", which is a list containing
  • HazA data frame with time, Haz, trans, containing the estimated subject-specific hazards for each of the transitions in the multi-state model
  • varHazA data frame with time, Haz, trans1, trans2 containing the variances (trans1=trans2) and covariances (trans1<trans2) of the estimated hazards. This element is only returned when variance=TRUE
  • transThe transition matrix used

Details

The data frame needs to have one row for each transition in the multi-state model. An additional column stratum (numeric) is needed to describe for each transition to which stratum it belongs. For details refer to de Wreede, Fiocco & Putter (2009). So far, the results have been checked only for the "breslow" method of dealing with ties in coxph.

References

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. L. C. de Wreede, M. Fiocco, and H. Putter (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.

See Also

plot.msfit

Examples

Run this code
# 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)

Run the code above in your browser using DataLab