probtrans_subjects: Compute subject-specific transition probabilities

probtrans_subjectsR Documentation

Compute subject-specific transition probabilities

Description

This function computes subject-specific transition probabilities in multi-state models.

Usage

probtrans_subjects(object, predt, direction = c("forward", "fixedhorizon"))

Arguments

object

msfit.subjects object containing estimated cumulative hazards for each of the transitions in the multi-state model

predt

A positive number indicating the prediction time. This is either the time at which the prediction is made (if direction= "forward") or the time for which the prediction is to be made (if direction="fixedhorizon")

direction

One of "forward" (default) or "fixedhorizon", indicating whether prediction is forward or for a fixed horizon

Details

For details refer to de Wreede, Fiocco & Putter (2010).

Value

An object of class "probtrans.subjects". This is a list of length n (number of subjects in object$ids), with each list element an object of class probtrans for the associated subject. List elements can be accessed using [[x]], with x ranging from 1 to n. Additionally, each list element has an element $id, representing the subject id and the output object also has an element $ids representing the subject ids in order. Plot and summary methods have been defined for "probtrans(.subjects)" objects.

Author(s)

Daniel Gomon

References

Andersen PK, Borgan O, Gill RD, Keiding N (1993). Statistical Models Based on Counting Processes. Springer, New York.

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.

Examples


# 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)
#Make newdata (3 subjects)
newdata <- data.frame(id=rep(1:3, each = 3),x1.1=c(0,0,0,1,0,1,0,1,0),
                      x2.2=c(0,1,0,0,0,0,1,0,1), trans = rep(1:3, 3))
HvH <- msfit_subjects(cx,newdata,trans=tmat)
# probtrans_subjects
pt <- probtrans_subjects(HvH,predt=0)
# A 'probtrans' object for person 1
pt[[1]]


hputter/mstate documentation built on July 17, 2025, 2:04 a.m.