| surv_term | R Documentation |
Creates Data for One Type of Survival Outcome
surv_term(formula, id, data, time_fixef, with_frailty = FALSE, delayed = NULL)
formula |
a two-sided |
id |
the variable for the id of each individual. |
data |
|
time_fixef |
the time-varying fixed effects. See .e.g.
|
with_frailty |
|
delayed |
a vector with an entry which is |
The time_fixef should likely not include an intercept as this is
often included in formula.
The delayed argument is to account for delayed entry with terminal
events when observations are sampled in a way such that they must not have
had the event prior to their left-truncation time. In this case, the proper
complete data likelihood is
\frac{a(u)h(t_{ij}\mid u)^{d_{ij}}S(t_{ij} \mid u)g(u)}{\int a(u) S(v_{ij} \mid u) du}
and not
a(u)h(t_{ij} \mid u)^{d_{ij}}\frac{S(t_{ij} \mid u)}{S(v_{ij} \mid u)}g(u)
where h is conditional hazard, S is the conditional survival
function, g is additional conditional likelihood factors from other
outcomes, a is the random effect distribution, t_{ij} is the
observed time, d_{ij} is an event indicator, and v_{ij} is the
left truncation time.
The denominator in the proper complete likelihood becomes the expectation over all delayed entries when a cluster has more than one delayed entry. See van den Berg and Drepper (2016) and Crowther et al. (2016) for further details.
An object of class surv_term with data required for survival outcome.
Crowther MJ, Andersson TM, Lambert PC, Abrams KR & Humphreys K (2016). Joint modelling of longitudinal and survival data: incorporating delayed entry and an assessment of model misspecification. Stat Med, 35(7):1193-1209. doi:10.1002/sim.6779
van den Berg GJ & Drepper B (2016). Inference for Shared-Frailty Survival Models with Left-Truncated Data. Econometric Reviews, 35:6, 1075-1098, doi: 10.1080/07474938.2014.975640
# load in the data
library(survival)
data(pbc, package = "survival")
# re-scale by year
pbcseq <- transform(pbcseq, day_use = day / 365.25)
pbc <- transform(pbc, time_use = time / 365.25)
# base knots on observed event times
bs_term_knots <-
with(pbc, quantile(time_use[status == 2], probs = seq(0, 1, by = .2)))
boundary <- c(bs_term_knots[ c(1, length(bs_term_knots))])
interior <- c(bs_term_knots[-c(1, length(bs_term_knots))])
# create the survival term
s_term <- surv_term(
Surv(time_use, status == 2) ~ 1, id = id, data = pbc,
time_fixef = bs_term(time_use, Boundary.knots = boundary, knots = interior))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.