Fast Marginal means of recurrent events using the Lin and Ghosh (2000) standard errors. Fitting two models for death and recurent events these are combined to prducte the estimator $$ \int_0^t S(u|x=0) dR(u|x=0) $$ the mean number of recurrent events, here $$ S(u|x=0) $$ is the probability of survival for the baseline group, and $$ dR(u|x=0) $$ is the hazard rate of an event among survivors for the baseline. Here $$ S(u|x=0) $$ is estimated by $$ exp(-\Lambda_d(u|x=0) $$ with $$\Lambda_d(u|x=0) $$ being the cumulative baseline for death.

recurrentMarginal(formula, data, cause = 1, ..., death.code = 2)

Arguments

formula

with Event object

data

data frame for computation

cause

of interest (1 default)

...

Additional arguments to lower level funtions

death.code

codes for death (terminating event, 2 default)

Details

Assumes no ties in the sense that jump times needs to be unique, this is particularly so for the stratified version.

References

Cook, R. J. and Lawless, J. F. (1997) Marginal analysis of recurrent events and a terminating event. Statist. Med., 16, 911–924. Ghosh and Lin (2002) Nonparametric Analysis of Recurrent events and death, Biometrics, 554–562.

Author

Thomas Scheike

Examples

library(mets)
data(hfactioncpx12)
hf <- hfactioncpx12
hf$x <- as.numeric(hf$treatment) 

##  to fit non-parametric models with just a baseline 
xr <- phreg(Surv(entry,time,status==1)~cluster(id),data=hf)
dr <- phreg(Surv(entry,time,status==2)~cluster(id),data=hf)
par(mfrow=c(1,3))
plot(dr,se=TRUE)
title(main="death")
plot(xr,se=TRUE)
### robust standard errors 
rxr <-  robust.phreg(xr,fixbeta=1)
plot(rxr,se=TRUE,robust=TRUE,add=TRUE,col=4)

## marginal mean of expected number of recurrent events 
## out <- recurrentMarginalPhreg(xr,dr)
## summary(out,times=1:5) 

## marginal mean using formula  
outN <- recurrentMarginal(Event(entry,time,status)~cluster(id),hf,cause=1,death.code=2)
plot(outN,se=TRUE,col=2,add=TRUE)
summary(outN,times=1:5) 
#> [[1]]
#>        new.time      mean         se  CI-2.5%  CI-97.5% strata
#> 608           1 0.8281512 0.04843574 0.738458 0.9287387      0
#> 1053          2 1.5138672 0.07038890 1.382007 1.6583085      0
#> 1282          3 2.0244179 0.08351017 1.867183 2.1948936      0
#> 1392          4 2.5003948 0.10842486 2.296666 2.7221955      0
#> 1392.1        5 2.5003948 0.10842486 2.296666 2.7221955      0
#> 

########################################################################
###   with strata     ##################################################
########################################################################
out <- recurrentMarginal(Event(entry,time,status)~strata(treatment)+cluster(id),
                         data=hf,cause=1,death.code=2)
plot(out,se=TRUE,ylab="marginal mean",col=1:2)


summary(out,times=1:5) 
#> [[1]]
#>       new.time      mean         se   CI-2.5% CI-97.5% strata
#> 325          1 0.8737156 0.06783343 0.7503858 1.017315      0
#> 555          2 1.5718563 0.09572955 1.3949953 1.771140      0
#> 682          3 2.1184963 0.11385721 1.9066915 2.353829      0
#> 748          4 2.6815219 0.15451005 2.3951619 3.002118      0
#> 748.1        5 2.6815219 0.15451005 2.3951619 3.002118      0
#> 
#> [[2]]
#>       new.time      mean         se   CI-2.5%  CI-97.5% strata
#> 284          1 0.7814051 0.06906425 0.6571176 0.9292005      1
#> 499          2 1.4532550 0.10313216 1.2645476 1.6701230      1
#> 601          3 1.9239119 0.12163725 1.6996867 2.1777172      1
#> 645          4 2.3133492 0.14962177 2.0379220 2.6260006      1
#> 645.1        5 2.3133492 0.14962177 2.0379220 2.6260006      1
#>