Turn one row per subject with a time and status for each event type into
one row per subject and event type, for the marginal Cox model of Wei, Lin
and Weissfeld (1989), coxph(Surv(time, status) ~ x + strata(etype) + cluster(id)), whose robust variance accounts for the events of one
subject being correlated.
Value
The stacked data frame: the columns of data that are not event
columns, the identifier, etype (a factor in the order of events),
time and status; ordered by subject, then event type.
References
Wei LJ, Lin DY, Weissfeld L. Regression analysis of multivariate incomplete failure time data by modeling marginal distributions. Journal of the American Statistical Association 1989; 84(408): 1065-1073. doi:10.1080/01621459.1989.10478873
See also
Other model-fitting:
is_sest_refusal(),
sest_cuminc(),
sest_ic(),
sest_power(),
sest_refusal(),
sest_rmst(),
sest_score(),
survestimand()
Examples
st <- sest_stack(survival::mgus2,
events = list(pcm = c("ptime", "pstat"),
death = c("futime", "death")),
id = "id")
survival::coxph(survival::Surv(time, status) ~ sex + survival::strata(etype),
data = st, cluster = id)
#> Call:
#> survival::coxph(formula = survival::Surv(time, status) ~ sex +
#> survival::strata(etype), data = st, cluster = id)
#>
#> coef exp(coef) se(coef) robust se z p
#> sexM 0.1737 1.1897 0.0614 0.0660 2.632 0.0085
#>
#> Likelihood ratio test=8.04 on 1 df, p=0.00457
#> n= 2768, number of events= 1078
