01.Association05.Time to event  sporedata/researchdesigneR Wiki
1. Use cases: in which situations should I use this method?
 Situations where an outcome is assessed in terms of the time until it occurs, i.e. time to event. observations might also be censored (when the exact time of an event is unknown, but it is established that the event occurred before or after a specific time or within an interval) or truncated (when we do not observe individuals with times to event smaller or larger than prespecified values)
2. Input: what kind of data does the method require?
 A variable indicating when the event happened, when the patient was last seen, and covariates.
3. Algorithm: how does the method work?
Model mechanics
Describing in words

The standard modeling is performed through Cox proportional hazards. Checks are performed ahead of the modeling in terms of:
 Proportional hazards assumption that each covariate has a multiplicative effect in the hazards function that is constant over time

Piecewise additive mixed models (PAMM) can be used in place of Cox proportional hazards models, bringing in flexibility in relation to:
 Nonlinear effects (penalized splines), or when the effect of the main risk factor on time to event has a shape that is not linear.
 Timevarying effects, where different study periods present a different hazard.
 Frailty models or multilevel survival models to account for groups that are not homogeneous.
 Timedependent covariates, happens when a covariate is not constant throughout the study period, for example when the dose of a given drug is variable over time.
 Left truncation, or when individuals below a certain threshold are not included in the analysis.
 Competing Risks, when the event of interest can have different causes; for example, when death can be caused by a stroke or myocardial infarction, but we are only interested in those with a stroke

Another alternative for the Cox proportional hazard is multistate models. These models are more flexible than Cox PH regression because they capture the transition of individuals through different types of events 4(#4).
Multistate models work in different scenarios:

Survival in two states. The Cox Proportional Hazard model is a special case of multistate models with only two survival states. In Panel A, healthy people transition to a COVID19 state.

Sequential models. More than two states aligned one after the other. For example, in Panel B people that contracted COVID19 can require ventilation in the intensive care unit (ICU).

Competing risks models. Instead of experiencing the event of interest, one experience another competing event. For example, a person can experience the main event of interest (ie.COVID) or a competing event (ie. death from a car accident).

Healthillness models with recovery. These models allow for recurring events. For example, healthy individuals can experience COVID, recover (transition into the healthy state), or go into the ICU (and from there back into the COVID state).
Describing in images

The outcome of the models is the time until an event occurs.

When individuals are lost to followup, they become censored. Therefore, they still contribute information for the analysis instead of being removed from the population.
Describing with code
Breaking down equations
Suggested companion methods
Learning materials

Books

Articles
4. Output: how do I interpret this method's results?
Typical tables and plots and corresponding text description
 Kaplan Meier 3(#3).
 Cumulative incidence plot 3(#3).
 Survival trees 5(#5).
Survival trees offer a relatively flexible approach to understanding the effects of covariates, including their interaction, on survival times when the association's functional form is unknown. Survival trees have the advantage of a more straightforward interpretation.
A survival tree is typically constructed based on the heterogeneity in timetoevent distribution. However, ignorance of censoring distribution might lead to inconsistent survival trees in some applications with markerdependent censoring. For instance when less education or better prognosis might lead to early censoring.
The SurvCART algorithm 6(#6) is flexible in constructing a survival tree based on heterogeneity in timetoevent and censoring distribution. However, it is essential to emphasize that censoring heterogeneity in the construction of survival trees is optional.
 HR: Compared to [referent], [intervention] presented [hr, (95% CI)] times the risk [p value] of [outcome].
Associated concepts
 Time until something or some event happens.
 It is possible to account for people who are lost to follow up.
Associated concepts
Reporting guidelines for Methods
5. SporeDataspecific
Templates
Data science functions
* sdatools::kaplanMeierPlot
References
[1] Vandenbroucke JP, Von Elm E, Altman DG, Gøtzsche PC, Mulrow CD, Pocock SJ, Poole C, Schlesselman JJ, Egger M, Strobe Initiative. Strengthening the Reporting of Observational Studies in Epidemiology (STROBE): explanation and elaboration. PLoS Med. 2007 Oct 16;4(10):e297.
[2] Methods strobe template
[3] survCurve: Plots Survival Curves Element by Element
[4] Multistate models and competing risks
[5] Creating a survivalswimmer plot in R
[6] SurvCART: Constructing Survival Tree in R