Simple analysis of influence of relapse and sm on death. The SM part is not working currently (due to limited events).
54 lines
1.4 KiB
R
54 lines
1.4 KiB
R
# Cox time-depended hazard models for death and sm
|
|
#
|
|
# License: GPL version 3
|
|
# Jens Mathis Sauer (c) 2020
|
|
|
|
sma_cox_time_death_setup <- function() {
|
|
data <- tmerge(data1 = secmal %>% select(uuid),
|
|
data2 = secmal,
|
|
id = uuid,
|
|
tstop = event_time_asct)
|
|
data <- tmerge(data, secmal, id = uuid, death = event(event_time_asct,
|
|
event_status))
|
|
data <- tmerge(data, secmal, id = uuid, relapse = tdc(
|
|
event_time_asct - event_time_relapse))
|
|
data <- tmerge(data, secmal, id = uuid, sm = tdc(
|
|
event_time_asct - event_time_sm))
|
|
|
|
return(data)
|
|
}
|
|
|
|
# Calculate HR of death with time dependend relapse status
|
|
sma_cox_death_relapse <- function() {
|
|
data <- sma_cox_time_death_setup()
|
|
cox <- coxph(Surv(tstart, tstop, death) ~ relapse + cluster(uuid), data)
|
|
|
|
return(cox)
|
|
}
|
|
|
|
sma_cox_death_sm <- function() {
|
|
data <- sma_cox_time_death_setup()
|
|
cox <- coxph(Surv(tstart, tstop, death) ~ sm + cluster(uuid), data)
|
|
|
|
return(cox)
|
|
}
|
|
|
|
sma_cox_time_sm_setup <- function() {
|
|
data <- tmerge(data1 = secmal %>% select(uuid),
|
|
data2 = secmal,
|
|
id = uuid,
|
|
tstop = time_at_risk)
|
|
data <- tmerge(data, secmal, id = uuid, sm = event(event_time_sm))
|
|
data <- tmerge(data, secmal, id = uuid, relapse = tdc(
|
|
event_time_asct - event_time_relapse))
|
|
|
|
return(data)
|
|
}
|
|
|
|
sma_cox_sm_rel <- function() {
|
|
data <- sma_cox_time_sm_setup()
|
|
cox <- coxph(Surv(tstart, tstop, sm) ~ relapse + cluster(uuid), data)
|
|
|
|
return(cox)
|
|
}
|