-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnothing.qmd
156 lines (106 loc) · 3.6 KB
/
nothing.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# 1. Regression Models
## One Individual's Data
For one individual $z_1, \dots, z_p$, the failure time $t_i$, the failure rate (intensity):
$$
\lambda(t \mid z_i) = \exp(z_i^T \beta) \times \lambda_0(t)
$$
Where $z_i$ represents the variables of the individual $i$, and $\beta$ is a vector of coefficients.
## Proportional Hazard Assumption
Under the proportional hazard assumption, the hazard ratio between different individuals remains constant over time:
$$
\frac{\lambda(t \mid z_i)}{\lambda(t \mid z_j)} = \exp((z_i - z_j)^T \beta)
$$
## Likelihood Function
The likelihood function $L(\beta)$ for the hazard rate for censored data is:
$$
L(\beta) = \prod_{i=1}^{n} \left[\lambda(t_i \mid z_i)\right]^{\delta_i} \exp \left( - \int_0^{t_i} \lambda(s \mid z_i) ds \right)
$$
For censored data:
$$
\delta_i =
\begin{cases}
1 & \text{if event observed (uncensored)} \\
0 & \text{if censored}
\end{cases}
$$
Thus, the partial likelihood function $L_P(\beta)$ is:
$$
L_P(\beta) = \prod_{i=1}^{n} \frac{\exp(z_i^T \beta)}{\sum_{j \in R(t_i)} \exp(z_j^T \beta)}
$$
Where $R(t_i)$ is the set of individuals at risk at time $t_i$.
# 2. Product-Limit Method for Censored Data
Assume $n$ independent individuals. The survival probability is modeled as:
$$
S(t) = P(T \geq t) = \prod_{j: t_j \leq t} \left(1 - \frac{d_j}{Y_j} \right)
$$
Where:
- $d_j$ is the number of failures at time $t_j$,
- $Y_j$ is the number of individuals at risk just before time $t_j$.
For censored data, the hazard rate:
$$
\lambda_j = \frac{d_j}{Y_j}
$$
The likelihood function from MLE is then:
$$
L = \prod_{j=1}^{k} \left( \frac{d_j}{Y_j} \right)^{d_j} \left( 1 - \frac{d_j}{Y_j} \right)^{Y_j - d_j}
$$
# 1. Log-Rank Test (2-Sample)
## Overview
- **Slight advantage**: Is it significant enough? Maybe within the noise.
- **At first glance**: This can be seen as a $t$-test (2-sample), where censoring $\to X$.
## Table for Seamlessly Handling with Ties
| | Group 1 | Group 2 | Total |
|------|---------|---------|--------|
| Died | $d_{1k}$| $d_{2k}$| $d_k$ |
| Survived | | | |
| Total| $r_{1k}$| $r_{2k}$| $r_k$ |
- $d_k$: death time.
- $r_k$: number at risk at time $t_k$.
- $d_{1k}$ and $d_{2k}$: number of deaths in group 1 and group 2 respectively.
To test the hypothesis $H_0$: No difference between survival curves:
$$
E(X_k) = \frac{r_{1k}}{r_k} d_k
$$
The test statistic:
$$
W = \frac{\sum_{k=1}^{K} (X_k - E(X_k))}{\sqrt{\text{Var}(X_k)}}
$$
Where:
$$
\text{Var}(X_k) = \frac{r_{1k} r_{2k} d_k (r_k - d_k)}{r_k^2 (r_k - 1)}
$$
And under $H_0$:
$$
W \sim N(0,1)
$$
From this, the $p$-value is calculated to determine the significance.
# 2. Cox (1972)
## Failure Time
Consider the failure time $T$ (discrete or continuous random variable). Define the survival function as:
$$
S(t) = P(T \geq t) = 1 - F(t)
$$
Where $F(t)$ is the distribution function.
### Discrete Case
The failure rate $\lambda$ is defined as:
$$
\lambda(t_k) = \frac{P(t_k \leq T < t_{k+1} \mid T \geq t_k)}{h_k} = \frac{f(t_k)}{S(t_k)}
$$
For the continuous case, the hazard function is:
$$
\lambda(t) = \lim_{\Delta t \to 0} \frac{P(t \leq T < t + \Delta t \mid T \geq t)}{\Delta t} = \frac{f(t)}{S(t)}
$$
Thus, the relationship between the hazard function and the survival function is:
$$
\lambda(t) = -\frac{d}{dt} \log S(t)
$$
Which implies:
$$
S(t) = e^{-\int_0^t \lambda(u) du}
$$
### Likelihood and Censoring
For censored data, the likelihood function becomes:
$$
L = \prod_{i=1}^{n} \left[ \lambda(t_i) \right]^{\delta_i} \left[ S(t_i) \right]^{1 - \delta_i}
$$
Where $\delta_i = 1$ if the event is observed and $\delta_i = 0$ if censored.