User:Mark viking/sandbox

In survival analysis, a topic in statistics, competing risks refers to the possibility that an event, such as a death, may occur due to a number of different risk factors. Because death can only happen once in the history of an individual, a death due to one risk factor prevents a death due to other risk factors. In this sense, the risk factors are said to compete in causing the death. An example of competing risks occurs in cancer studies, where multiple events may be of interest, such as recurrence of a tumor, metastasis in a in a new location, or patient death.

Because competing risks interfere with each other, modeling the survival of an individual with competing risks is more complex than modeling the survival of an individual with a single risk factor; caution is needed in estimating the risk of individual factors.

Definition
In the following, it is assumed that the events under study are not left censored or left truncated; that is all events are either recorded exactly or are right censored. In such data, each subject $$i$$ has an event time $$t_i$$ and a right censor time $$ c_i $$ with observed events $$ x_i = \min(t_i,c_i)$$. A survival data set of subjects indexed $$ i=1,\ldots,n$$ is seen as a random sample $$ (X_i, C_i)$$ from a survival distribution $$ X_i \sim S(t) = \Pr(T > t)$$ and a censoring distribution $$ C_i \sim G $$.

Survival analysis with a single risk factor
A basic assumption made with a single risk factor is that the survival distribution and the censoring distribution are statistically independent. Then the hazard rate


 * $$ \lambda(t) = \lim_{\Delta t \to 0} \frac{\Pr(t\le T < t+\Delta t | T \ge t)}{\Delta t} $$

plays an important role in survival analysis. The cumulative hazard is then


 * $$\Lambda(t) = \int_o^t \lambda(d)\;ds$$

and the survival function is $$S(t) = e^{\Lambda(t)}$$.

Covariate estimation
Proportional hazard analysis of cause-specific hazards

Regression on cumulative incidence functions: Fine and Gray method

Multi-state model
In some cases, risk factors may cause non-lethal events that an individual survives. Instead of death, a non-lethal event causes a transition from one state to another. An individual may suffer a sequence of non-lethal events before finally dying. Then the goal becomes modeling the individual's history of events until the final endpoint of death. A multi-state model, an extension of a competing risks model, provides a framework for the analysis of history of event data. Under appropriate independence assumptions, multi-state systems can be analyzed as Markov models.

Wikipedia graph tools
Just for fun, try some graphs:

{ "version": 2, "width": 400, "height": 200, "padding": {"top": 10, "left": 30, "bottom": 30, "right": 10}, "data": [ {     "name": "table", "values": [ {"x": 1, "y": 28}, {"x": 2,  "y": 55}, {"x": 3, "y": 43}, {"x": 4,  "y": 91}, {"x": 5, "y": 81}, {"x": 6,  "y": 53}, {"x": 7, "y": 19}, {"x": 8,  "y": 87}, {"x": 9, "y": 52}, {"x": 10, "y": 48}, {"x": 11, "y": 24}, {"x": 12, "y": 49}, {"x": 13, "y": 87}, {"x": 14, "y": 66}, {"x": 15, "y": 17}, {"x": 16, "y": 27}, {"x": 17, "y": 68}, {"x": 18, "y": 16}, {"x": 19, "y": 49}, {"x": 20, "y": 15} ]   }  ],  "scales": [ {     "name": "x", "type": "ordinal", "range": "width", "domain": {"data": "table", "field": "x"} },   {      "name": "y", "range": "height", "nice": true, "domain": {"data": "table", "field": "y"} } ],  "axes": [ {"type": "x", "scale": "x"}, {"type": "y", "scale": "y"} ], "marks": [ {     "type": "rect", "from": {"data": "table"}, "properties": { "enter": { "x": {"scale": "x", "field": "x"}, "width": {"scale": "x", "band": true, "offset": -1}, "y": {"scale": "y", "field": "y"}, "y2": {"scale": "y", "value": 0} },       "update": { "fill": {"value": "steelblue"} },       "hover": { "fill": {"value": "red"} }     }    }  ] }

{ "width": 800, "height": 500,

"data": [ {     "name": "temperature", "url": "data/seattle-temps.csv", "format": {"type": "csv", "parse": {"temp": "number", "date": "date"}}, "transform": [ {"type": "formula", "field": "hour", "expr": "hours(datum.date)"}, { "type": "formula", "field": "date", "expr": "datetime(year(datum.date), month(datum.date), date(datum.date))"} ]   }  ],

"scales": [ {     "name": "x", "type": "time", "domain": {"data": "temperature", "field": "date"}, "range": "width" }, {     "name": "y", "type": "ordinal", "domain": {"data": "temperature", "field": "hour"}, "range": "height", "round": false }, {     "name": "c", "type": "linear", "domain": [37.5, 41.3, 45.1, 48.9, 52.7, 56.5, 60.3, 64.1, 67.9, 71.7, 75.5], "range": ["#313695", "#4575b4", "#74add1", "#abd9e9", "#e0f3f8", "#ffffbf", "#fee090", "#fdae61", "#f46d43", "#d73027", "#a50026"], "zero": false } ],

"axes": [ {"type": "x", "scale": "x"}, {"type": "y", "scale": "y"} ],

"legends": [{"fill": "c", "values": [37.5, 56.5, 75.5]}],

"marks": [ {     "type": "rect", "from": {"data": "temperature"}, "properties": { "enter": { "x": {"scale": "x", "field": "date"}, "width": {"value": 5}, "y": {"scale": "y", "field": "hour"}, "height": {"scale": "y", "band": true}, "fill": {"scale": "c", "field": "temp"} }     }    }  ] }