Professional Documents
Culture Documents
CH 7
CH 7
Mahbub Latif
Institute of Statistical Research and Training (ISRT)
University Dhaka, Dhaka 1000, Bangladesh
(mlatif@isrt.ac.bd)
January 2024
𝑥′𝛽 )
ℎ(𝑡 | 𝑥 ) = ℎ0 (𝑡) exp(𝑥 (1)
• Data
{(𝑡𝑖 , 𝛿𝑖 , 𝑥 𝑖 ), 𝑖 = 1, … , 𝑛}
• Log-likelihood function
𝑛
𝛿 1−𝛿𝑖
ℓ(ℎ0 (𝑡), 𝛽 ) = log ∏ [𝑓(𝑡𝑖 ; 𝑥 𝑖 )] 𝑖 [𝑆(𝑡𝑖 ; 𝑥 𝑖 )]
𝑖=1
𝑥′𝑖𝛽 )] + exp(𝑥
= ∑ {𝛿𝑖 log [ℎ0 (𝑡𝑖 ) exp(𝑥 𝑥′𝑖𝛽 ) log 𝑆0 (𝑡𝑖 )}
𝑖
The complete likelihood function does not help estimate parameters of Cox’s
proportional hazards model
• There are a number of different likelihood functions defined for estimating
parameters
• Conditional likelihood function, marginal likelihood function, and partial
likelihood function
• Cox’s “partial likelihood function” is widely used for PH models
• 𝑌𝑘 (𝑡) = 𝐼(𝑡𝑘 ≥ 𝑡) → indicates whether the 𝑘𝑡ℎ subject is still in the risk set at
time 𝑡 or not
ℎ(𝑡 | 𝑥 𝑖 ) exp(𝑥𝑥′𝑖𝛽 )
𝑛 = 𝑛 (7)
∑𝑘=1 𝑌𝑘 (𝑡)ℎ(𝑡𝑘 | 𝑥 𝑖 ) ∑𝑘=1 𝑌𝑘 (𝑡) exp(𝑥𝑥′𝑘𝛽 )
{(𝑡𝑖 , 𝛿𝑖 , 𝑥𝑖 ), 𝑖 = 1, … , 𝑛}
• 𝑥𝑖 = 𝐼(𝑖𝑡ℎ subject is from group 1)
• Null and alternative hypotheses
• Consider a PH model
• We can obtain
• The null and alternative hypotheses under the proportional model assumption
𝐻0 ∶ 𝑆1 (𝑡) = 𝑆2 (𝑡) ⇒ 𝐻0 ∶ 𝛽 = 0
𝐻0 ∶ 𝑆1 (𝑡) = 𝑆2 (𝑡) ⇒ 𝐻0 ∶ 𝛽 ≠ 0
• Large sample-based property of MLE 𝛽 ̂ can be used to test the null hypothesis
• Log-likelihood function
𝛿𝑖
𝑛
𝑒𝛽𝑥𝑖
ℓ(𝛽) = log ∏ ( 𝑛 𝛽𝑥𝑘
)
𝑖=1 ∑ 𝑘=1
𝑌 𝑘 (𝑡𝑖 ) 𝑒
𝑛 𝑛
= ∑ (𝛿𝑖 𝑥𝑖 𝛽 − 𝛿𝑖 log ∑ 𝑌𝑘 (𝑡𝑖 ) 𝑒𝛽𝑥𝑘 )
𝑖=1 𝑘=1
• 𝑑𝑖 = 𝛿𝑖 = I(𝑡𝑖 is a lifetime)
• 𝑑1𝑖 = 𝛿𝑖 𝑥𝑖 = 𝐼(𝑡𝑖 is a lifetime and from group 1)
𝑛
• 𝑛1𝑖 = ∑𝑘=1 𝑌𝑘 (𝑡𝑖 )𝑥𝑘 → number of group 1 subjects at risk at time 𝑡𝑖
𝑛
• 𝑛2𝑖 = ∑𝑘=1 𝑌𝑘 (𝑡𝑖 )(1 − 𝑥𝑘 ) → number of group 2 subjects at risk at time 𝑡𝑖
• Information Matrix
𝑛
𝑑𝑖 𝑛1𝑖 𝑒𝛽 𝑛1𝑖 𝑒𝛽 − 𝑑𝑖 (𝑛1𝑖 𝑒𝛽 + 𝑛2𝑖 )𝑛1𝑖 𝑒𝛽
𝐼(𝛽) = ∑ [ − 2
]
𝑖=1 (𝑛1𝑖 𝑒𝛽 + 𝑛2𝑖 )
𝑛
𝑑𝑖 𝑛1𝑖 𝑛2𝑖 𝑒𝛽
= ∑[ 2
]
𝑖=1 (𝑛1𝑖 𝑒𝛽 + 𝑛2𝑖 )
• Confidence interval for 𝛽 can be obtained from the following pivotal quantity
𝑈 (𝛽)
𝑍(𝛽) =
[𝐼(𝛽)]1/2
• Under 𝐻0 ∶ 𝛽 = 0
𝑛
𝑑𝑖 𝑛1𝑖
𝑈 (0) = ∑ (𝑑1𝑖 − )
𝑖=1
𝑛1𝑖 + 𝑛2𝑖
𝑛
𝑑𝑖 𝑛1𝑖 𝑛2𝑖
𝐼(0) = ∑ 2
𝑖=1 (𝑛1𝑖 + 𝑛2𝑖 )
• Test statistic
𝑈 (0)
𝑍= ∼ 𝒩(0, 1)
[𝐼(0)]1/2
• MLE of 𝛽 does not require to test 𝐻0 ∶ 𝛽 = 0 using the statistic 𝑍
𝑛1𝑖
𝑑1𝑖 − [𝑑𝑖 × ]
𝑛1𝑖 + 𝑛2𝑖
• At the time 𝑡𝑖 , there are 𝑛𝑖 = 𝑛1𝑖 + 𝑛2𝑖 subjects are at risk, and 𝑑𝑖 is either 0 or
1 (i.e., there is no ties in the lifetime)
• In the presence of a small number of ties in the data, the score test is still valid
• In the presence of substantial ties, the discrete model is preferable, and the
resulting expression of the information matrix takes the following form
𝑛
𝑑𝑖 𝑛1𝑖 𝑛2𝑖 (𝑛𝑖 − 𝑑𝑖 )
𝐼(0) = ∑
𝑖=1
𝑛2𝑖 (𝑛𝑖 − 1)
Data below show remission times (in weeks) for 40 leukemia patients who were
randomly assigned either treatment 𝐴 or 𝐵
> tab7_1_1
## # A tibble: 40 x 3
## time status group
## <dbl> <dbl> <chr>
## 1 1 1 A
## 2 3 1 A
## 3 3 1 A
## 4 6 1 A
## 5 7 1 A
## 6 7 1 A
## 7 10 1 A
## 8 12 1 A
## 9 14 1 A
## 10 15 1 A
## # i 30 more rows
𝛿𝑖
𝐻̂0 (𝑡) = ∑ 𝑛
𝑥′𝑘𝛽 ̂ )
𝑖∶𝑡𝑖 ≤𝑡 ∑𝑘=1 𝑌𝑘 (𝑡𝑖 ) exp(𝑥
> tidy(mod1)
## # A tibble: 2 x 5
## term estimate std.error statistic p.value
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 trt -0.352 0.106 -3.31 9.47e- 4
## 2 fevm -0.0188 0.00226 -8.31 9.63e-17
• Treatment group patients have a lower hazard for time to first exacerbation
• As FEV value increases, the hazard of first exacerbation decreases
• Effects of treatment and FEV are significant on the hazard of first exacerbation
decreases
hazard 0.4
0.2
0.0
0 50 100 150
time
Figure 1: Plot of estimated baseline cumulative hazard function 𝐻̂ 0 (𝑡)
0.9
0.8
surv
0.7
0.6
0.5
0 50 100 150
time
Figure 2: Plot of estimated baseline survivor function 𝑆0̂ (𝑡)
0.9
0.8 treatment
survival 0
0.7
1
0.6
0.5
0 50 100 150
time
Figure 3: Estimated survivor functions for treatment and placebo groups obtained from Cox’s
PH model.
• 𝛽 ) → partial likelihood function for the subjects assigned to the 𝑗𝑡ℎ stratum
𝐿𝑗 (𝛽
• Estimation and inference procedures are the same as before
0.6
treatment
hazard
0.4
trt=0
trt=1
0.2
0.0
0 50 100 150
Mahbub Latif time
Lifetime Data Analysis January 2024 52 / 66
> basehaz(mod2) %>%
mutate(surv = exp(-hazard)) %>%
ggplot() +
geom_step(aes(time, surv, col = strata)) +
theme_bw() + labs(col = "treatment")
1.0
0.9
0.8 treatment
surv
trt=0
0.7
trt=1
0.6
0.5
• It can be shown that martingales 𝑀𝑖 (𝑡) are uncorrelated and have zero mean
𝑡
𝑥′𝑖𝛽 ) 𝑑𝐻0 (𝑢)
𝑀𝑖 (𝑡) = 𝑁𝑖 (𝑡) − ∫ 𝑌𝑖 (𝑢) exp(𝑥 (10)
0
• Martingale residuals
∞
𝑀𝑖 = 𝑀𝑖 (∞) = 𝛿𝑖 − ∫ 𝑥′𝑖𝛽 ̂ ) 𝑑𝐻̂0 (𝑢)
𝑌𝑖 (𝑢) exp(𝑥
0
𝑥′𝑖𝛽 ̂ )
= 𝛿𝑖 − 𝐻̂0 (𝑡𝑖 ) exp(𝑥 (11)
• Since
𝑒𝑎𝑑𝑗
𝑖 𝑥′𝑖𝛽 ̂ ) + 1 − 𝛿𝑖
= 𝐻̂0 (𝑡𝑖 ) exp(𝑥
• We can show
𝑥′𝑖𝛽 ̂ )
𝑀𝑖 = 𝛿𝑖 − 𝐻̂0 (𝑡𝑖 ) exp(𝑥
= 1 − 𝑒𝑎𝑑𝑗
𝑖
• Martingale residuals are uncorrelated and have zero mean, and it lie between
−∞ to 1
• For correct regression mean function, a plot of martinagle residuals and
covariate should show 𝐸(𝑀̂ 𝑖 ) = 0
• Similar to exponential residuals, the distribution of martingale residuals is
skewed, and there could be a systematic pattern because if heavy censoring
resid 0 status
0
1
−1
0 50
fevm