-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy path_sec-understand-coxph.qmd
More file actions
334 lines (236 loc) · 5.97 KB
/
Copy path_sec-understand-coxph.qmd
File metadata and controls
334 lines (236 loc) · 5.97 KB
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
{{< include latex-macros/macros.qmd >}}
<!-- {{< include _sec_cox-bio.qmd >}} -->
---
::: notes
Let's make two generalizations.
First, we let the hazard depend on some
covariates $x_1,x_2, \dots, x_p$;
we will indicate this dependence by extending our notation for hazard:
:::
{{< include _sec-surv-conditional-hazards.qmd >}}
---
{{< include _def-ph-model.qmd >}}
---
:::{#lem-diffloghaz-ph}
If $\loghaz(t|\vx) = \loghaz_0(t) + \reglincomb$, then:
$$
\ba
\diffloghaz(t|\vx: \vxs)
&= (\vx - \vxs) \cdot \beta
\ea
$$
:::
---
:::{#thm-hazard-ratio-ph}
If $\loghaz(t|\vx) = \loghaz_0(t) + \reglincomb$, then:
$$
\ba
\theta(t|\vx: \vxs)
&= \expf{\diffloghaz(t|\vx: \vxs)}
\\
&= \expf{(\vx - \vxs) \cdot \beta}
\ea
$$
:::
So for proportional hazards models, we can write the hazard ratio using a shorthand notation:
$$\theta(t| \vx : \vxs) = \theta(\vx : \vxs)$$
---
:::{#lem-ph-diffloghaz-0}
$$\diffloghaz(t|\vx)= \reglincomb$${#eq-diffloghaz-0-ph}
:::
---
:::{#thm-hazard-ratio-vs-baseline-ph}
If $\loghaz(t|\vx) = \loghaz_0(t) + \reglincomb$, then:
$$\theta(t|\vx) = \expf{\reglincomb}$$
:::
---
::: proof
$$
\ba
\theta(t|\vx)
&\eqdef \theta(t| \vx : \vec{0})
\\
&= \expf{\diffloghaz(t|\vx)}
\\
&= \expf{\reglincomb}
\ea
$$
:::
---
:::{#thm-ph-haz-decomp}
$$\haz(t|x) = \haz_0(t)\theta(x)$$
:::
---
Also:
:::{#thm-ph-also}
$$
\begin{aligned}
\theta(x) &= \exp{\diffloghaz(x)}
\\
\log{\haz(t|x)}
&= \log{\haz_0(t)} + \diffloghaz(x)
\\
&= \loghaz_0(t) + \diffloghaz(x)
\\
\diffloghaz(x) &= \reglincomb \\
&\eqdef \beta_1x_1+\cdots+\beta_px_p
\end{aligned}
$$
:::
::: notes
This model is **semi-parametric**,
because the linear predictor depends on estimated
parameters but the base hazard function is unspecified.
There is no constant term in $\eta(x)$,
because it is absorbed in the base hazard.
:::
---
Alternatively, we could define $\beta_0(t) = \log{\haz_0(t)}$, and then:
$$\eta(x,t) = \beta_0(t) + \beta_1x_1+\cdots+\beta_px_p$$
---
::: notes
For two different individuals
with covariate patterns $\vec x_1$ and $\vec x_2$,
the ratio of the hazard functions
(a.k.a. **hazard ratio**, a.k.a. **relative hazard**) is:
:::
$$
\begin{aligned}
\frac{\haz(t|\vec x_1)}{\haz(t|\vec x_2)}
&=\frac{\haz_0(t)\theta(\vec x_1)}{\haz_0(t)\theta(\vec x_2)}\\
&=\frac{\theta(\vec x_1)}{\theta(\vec x_2)}\\
\end{aligned}
$$
::: notes
Under the proportional hazards model,
this ratio (a.k.a. proportion) does not depend on $t$.
This property is a structural limitation of the model;
it is called the **proportional hazards assumption**.
:::
---
::: {#def-pha}
### proportional hazards
A conditional probability distribution $p(T|X)$
has **proportional hazards** if the hazard ratio $\haz(t|\vec x_1)/\haz(t|\vec x_2)$ does not depend on $t$. Mathematically, it can be written as:
$$
\frac{\haz(t|\vec x_1)}{\haz(t|\vec x_2)}
= \theta(\vec x_1,\vec x_2)
$$
:::
::: notes
As we saw above, Cox's proportional hazards model has this property, with $\theta(\vec x_1,\vec x_2) = \frac{\theta(\vec x_1)}{\theta(\vec x_2)}$.
:::
---
:::{#thm-haz-ratio-notations}
::: notes
We are using two similar notations,
$\theta(\vx,\vxs)$ and $\theta(\vec x)$.
We can link these notations:
$$\theta(\vx) \eqdef \theta(\vx, \vec 0)$$
Then:
:::
$$\theta(\vx, \vxs) = \frac{\theta(\vx)}{\theta(\vxs)}$$
$$\theta(\vec 0) = \theta(\vec 0, \vec 0) = 1$$
:::
---
The proportional hazards model also has additional notable properties:
$$
\begin{aligned}
\frac{\haz(t|\vec x_1)}{\haz(t|\vec x_2)}
&=\frac{\theta(\vec x_1)}{\theta(\vec x_2)}\\
&=\frac{\exp{\eta(\vec x_1)}}{\exp{\eta(\vec x_2)}}\\
&=\exp{\eta(\vec x_1)-\eta(\vec x_2)}\\
&=\exp{\vec x_1'\beta-\vec x_2'\beta}\\
&=\exp{(\vec x_1 - \vec x_2)'\beta}\\
\end{aligned}
$$
---
Hence on the log scale, we have:
:::{#thm-diff-loghaz-lincom}
$$
\ba
\log{\frac{\haz(t|\vx)}{\haz(t|\vxs)}}
&= \diffloghaz(t|\vx : \vxs)
\\
&\eqdef \loghaz(t|\vx) - \loghaz(t|\vxs)
\\
&=\eta(\vec x_1)-\eta(\vec x_2)\\
&= \vec x_1'\beta-\vec x_2'\beta\\
&= (\vec x_1 - \vec x_2)'\beta
\end{aligned}
$$
:::
---
If only one covariate $x_j$ is changing, then:
$$
\begin{aligned}
\log{\frac{\haz(t|\vec x_1)}{\haz(t|\vec x_2)}}
&= (x_{1j} - x_{2j}) \cdot \beta_j\\
&\propto (x_{1j} - x_{2j})
\end{aligned}
$$
::: notes
That is, under Cox's model $\haz(t|\vec x) = \haz_0(t)\exp{\vec x'\beta}$, the log of the hazard ratio is proportional to the difference in $x_j$, with the proportionality coefficient equal to $\beta_j$.
:::
---
Further,
$$
\begin{aligned}
\log{\haz(t|\vec x)}
&=\log{\haz_0(t)} + x'\beta
\end{aligned}
$$
::: notes
That is, the covariate effects are additive on the log-hazard scale; hazard functions for different covariate patterns should be vertical shifts of each other.
See also:
<https://en.wikipedia.org/wiki/Proportional_hazards_model#Why_it_is_called_%22proportional%22>
:::
### Additional properties of the proportional hazards model
If $\haz(t|x)= \haz_0(t)\theta(x)$, then:
:::{#thm-ph-cuhaz}
#### Cumulative hazards are also proportional to $\cuhaz_0(t)$
$$
\begin{aligned}
\cuhaz(t|x)
&\eqdef \int_{u=0}^t \haz(u)du\\
&= \int_{u=0}^t \haz_0(u)\theta(x)du\\
&= \theta(x)\int_{u=0}^t \haz_0(u)du\\
&= \theta(x)\cuhaz_0(t)
\end{aligned}
$$
where $\cuhaz_0(t) \eqdef \cuhaz(t|0) = \int_{u=0}^t \haz_0(u)du$.
:::
---
:::{#thm-log-cuhaz-parallel}
#### The logarithms of cumulative hazard should be parallel
$$
\logf{\cuhaz(t|\vx)} =\logf{\cuhaz_0(t)} + \reglincomb
$$
:::
---
:::{#cor-log-nlog-surv}
### linear model for log-negative-log survival
$$
\logf{-\logf{\surv(t|\vx)}} =
\logf{-\logf{\surv_0(t)}} + \reglincomb
$$
:::
---
:::{#thm-ph-surv}
#### Survival functions are exponential multiples of $\surv_0(t)$
$$\surv(t|x) = \sb{\surv_0(t)}^{\theta(x)}$$
:::
---
::: proof
$$
\begin{aligned}
\surv(t|x)
&= \expf{-\cuhaz(t|x)}\\
&= \expf{-\theta(x)\cdot \cuhaz_0(t)}\\
&= \paren{\expf{- \cuhaz_0(t)}}^{\theta(x)}\\
&= \sb{\surv_0(t)}^{\theta(x)}\\
\end{aligned}
$$
:::
### Summary of proportional hazards model structure and assumptions
{{< include _coxph-model-structure.qmd >}}