Skip to contents

Given a "probtrans" object, ELOS calculates the (restricted) expected length of stay in each of the states of the multi-state model.

Usage

ELOS(pt, tau)

Arguments

pt

An object of class "probtrans"

tau

The horizon until which ELOS is calculated; if missing, the maximum of the observed transition times is taken

Value

A K x K matrix (with K number of states), with the (g,h)'th element containing E_gh(s,tau). The starting time point s is inferred from pt (the smallest time point, should be equal to the predt value in the call to probtrans. The row- and column names of the matrix have been named "from1" until "fromK" and "in1" until "inK", respectively.

Details

The object pt needs to be a "probtrans" object, obtained with forward prediction (the default, direction="forward", in the call to probtrans). The restriction to tau is there because, as in ordinary survival analysis, the probability of being in a state can be positive until infinity, resulting in infinite values. The (restricted, until tau) expected length of stay in state h, given in state g at time s, is given by the integral from s to tau of P_gh(s,t), see for instance Beyersmann and Putter (2014).

Author

Hein Putter H.Putter@lumc.nl

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)
#> $Frequencies
#>          to
#> from      healthy illness death no event total entering
#>   healthy       0       4     2        0              6
#>   illness       0       0     4        0              4
#>   death         0       0     0        6              6
#> 
#> $Proportions
#>          to
#> from        healthy   illness     death  no event
#>   healthy 0.0000000 0.6666667 0.3333333 0.0000000
#>   illness 0.0000000 0.0000000 1.0000000 0.0000000
#>   death   0.0000000 0.0000000 0.0000000 1.0000000
#> 
table(tglong$status,tglong$to,tglong$from)
#> , ,  = 1
#> 
#>    
#>     2 3
#>   0 2 4
#>   1 4 2
#> 
#> , ,  = 2
#> 
#>    
#>     2 3
#>   0 0 0
#>   1 0 4
#> 
# 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)
#> Call:
#> coxph(formula = Surv(Tstart, Tstop, status) ~ x1.1 + x2.2 + strata(trans), 
#>     data = tglong, method = "breslow")
#> 
#>   n= 16, number of events= 10 
#> 
#>        coef exp(coef) se(coef)     z Pr(>|z|)
#> x1.1 1.4753    4.3723   1.2557 1.175    0.240
#> x2.2 0.8571    2.3563   0.8848 0.969    0.333
#> 
#>      exp(coef) exp(-coef) lower .95 upper .95
#> x1.1     4.372     0.2287    0.3731     51.24
#> x2.2     2.356     0.4244    0.4160     13.35
#> 
#> Concordance= 0.781  (se = 0.077 )
#> Likelihood ratio test= 2.93  on 2 df,   p=0.2
#> Wald test            = 2.32  on 2 df,   p=0.3
#> Score (logrank) test = 2.86  on 2 df,   p=0.2
#> 
# 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)
HvH <- msfit(cx,newdata,trans=tmat)
# probtrans
pt <- probtrans(HvH,predt=0)
# ELOS until last observed time point
ELOS(pt)
#>            in1      in2      in3
#> from1 7.481061 2.180088  2.33885
#> from2 0.000000 5.000000  7.00000
#> from3 0.000000 0.000000 12.00000
# Restricted ELOS until tau=10
ELOS(pt, tau=10)
#>            in1      in2       in3
#> from1 7.481061 1.228543  1.290396
#> from2 0.000000 5.000000  5.000000
#> from3 0.000000 0.000000 10.000000