Download presentation
Presentation is loading. Please wait.
Published byCathleen Armstrong Modified over 9 years ago
1
Lecture 13: Cox PHM Part II Basic Cox Model Parameter Estimation Hypothesis Testing
2
Recall Basic Cox PHM Model Linear form Proportional hazards because
3
Likelihood Full likelihood Log-likelihood
4
Partial Likelihood The partial likelihood is defined as Where – j = 1, 2, …, n – No ties – t 1 < t 2 < … < t D – Z (i)k is the k th covariate associated with the individual whose failure time is t i – R(t i ) is the risk set at time t i
5
Estimation We can use the log of the likelihood to obtain and MLE for Maximize log-likelihood to solve for estimates of Score equations and information matrices are found using standard approaches Solving for estimates can be done numerically (e.g. Newton-Raphson)
6
Tests of the Model Testing that k = 0 for all k = 1, 2, …, p Three main tests – Chi-square/ Wald test – Likelihood ratio test – Score test All three have chi-square distribution with p degrees of freedom
7
Score Equations an Information Matrix MLE found by U h ( ) = 0 using Newton-Raphson (need U h ( ) and I( ) ). Start with an initial guess for After i th step of the algorithm the updated guess is Repeat this process until convergence achieved
8
Developing the Tests In order to develop the tests, we must be able to define – Log-likelihood for the partial likelihood expression – The score equation(s) U h ( ) – The information matrix I( ) A simple example… – 3 observed times: t i = t 1 < t 2 < t 3 – Event indicators: i = 1, 1, 0 – 1 covariate: z i = z 1, z 2, z 3
9
Log-likelihood
11
Score Equation
13
Information (Matrix)
16
Wald Test Based on: Wald test:
17
Score Test Based on: Score test:
18
Likelihood Ratio Test
19
Partial Likelihood for Ties? The previous partial likelihood only applies when there are no ties Three primary approaches – Breslow – Efron – Cox When ties are few, all three perform similarly
20
Breslow (1974) s i is the sum of the vectors Z j over all individuals who die at time t i Consider each of the d i events at a given time as distinct
21
Efron (1977) i is the set of individuals who have the event at time t i Closer to the correct partial likelihood score based on a discrete hazard model than Breslow’s
22
Cox (1972) Based on discrete time, hazard-rate model Assumes logistic model for hazard rate – Let h(t | Z) be the conditional death probability in (t, t + 1) given survival to time t – Assume
23
This is the “proper” partial likelihood Where – Q i = a d i – tuple of individuals who could have been one of the d i failures at t i – q = {q 1, q 2, …, q di } is one of the elements of Q i –. Cox (1972)- Discrete
24
Why Not Use Cox Every Time? Consider the computation Denominator of Cox partial likelihood is more complicated Efron and Breslow approaches are less intensive to calculate R can do all three
25
“Local” Tests Testing individual coefficients But, more interestingly, testing a set of coefficients Examples – Testing treatment variables (3 categories) – Testing extent spread (4 categories) Same as previous – Wald test – Score test – Likelihood ratio test
26
Wald test
27
The Wald test is then Where I 11 (b) is the upper q x q submatrix of I(b) This statistics is distributed ~ 2 with q degrees of freedom
28
Score Test Define This is the vector of q scores for, evaluated at The score test is then This statistics is distributed ~ 2 with q degrees of freedom
29
Likelihood Ratio Test Define b 2 ( 10 ) be the partial maximum likelihood estimates of 2 based on the model with 1 set to 10 The LRT is Where LL = log-likelihood LRT has ~ chi-square distribution with p degrees of freedom under H 0
30
Example Study examining impact of cancer stage and age at diagnosis on survival in men with larynx cancer. 90 subjects Outcome = time to death from diagnosis Variables – Age at diagnosis – Stage (I-IV)
31
Model Consider a model with both age and stage Global Tests (fit using Breslow method) – LRT:18.07, p = 0.0012 – Wald:20.82, p = 0.0003 – Score:24.33, p < 0.0001 VariabledfbetaseWald Testp-valueRR Stage II10.13860.46230.090.76441.15 Stage III10.63830.35613.210.07301.89 Stage IV11.69310.422216.08<0.00015.44 Age10.01890.01431.760.18741.02
32
Local Test Say we want to test whether or not the beta’s for stage are all 0… H 0 : Necessary info depends on the test we want to use – LRT: need log(L(b)) for “full” and “null” models – Wald: need b 1 and I 11 – Score: need U 1 [ 10,b 2 ( 10 )] and I 11 ( 10,b 2 ( 10 ))
33
Local Test: LRT Null Model: Full Model: log(L(b)) for full model: -188.18 log(L(b)) for null model: -195.91
34
Local Test: Wald Test Information Matrix: Test:
35
Local Test: Score Test Vector of coefficients under null: Information matrix under null Test:
36
Contrasts Recall test for H 0 : c ’ = c ’ When a covariate is a factor (e.g. stage), we can test contrasts – Stage II vs. Stage III – Stage II vs. Stage IV – Stage III vs. Stage IV Define scalar contrast matrix, c, and test H 0 : c ’ = 0
37
Fitting Models In R coxph function for fitting CPHMs – Coefficient estimates – Global tests (LRT, Wald, and Score) – Local test for each individual covariate We can also easily conduct local tests ant contrasts using – LRT – Wald Score not so easy…
38
Example: Colon Cancer Trial of adjuvant chemotherapy for colon cancer. 929 subject – Main variable of interest is treatment Placebo Levamisiole Levamisole + 5-FU – Other variables Demographics (gender, age) Tumor obstruction (yes/no) Number of lymph nodes involved (number with detectable cancer) Extent of local spread (submucosa, muscle, serosa, more) Adherence to other organs (yes/no) Outcome: Time to cancer recurrence
39
Some of the Covariates
40
Fitting in R Treating factors as ordinal reg2<-coxph(st~sex+rx+perfor+obstruct+adhere+nodes2+ extent, data=coln) Treating factors as nominal reg3<-coxph(st~sex+rx+perfor+obstruct+adhere+factor(nodes2)+ factor(extent), data=coln)
41
Cox PHM Approach > data(colon) > coln<-colon[2*(1:929),] > st<-Surv(coln$time, coln$status) > reg1<-coxph(st~coln$rx) > attributes(reg1) $names [1] "coefficients" "var" "loglik" "score" "iter" "linear.predictors" [7] "residuals" "means" "concordance" "method" "n" "nevent" [13] "terms" "assign" "wald.test" "y" "formula" "xlevels" [19] "contrasts" "call" $class [1] "coxph" > reg1$coef coln$rxLev coln$rxLev+5FU -0.01512329 -0.51209312
42
Results > summary(reg1) Call: coxph(formula = st ~ coln$rx) n= 929, number of events= 468 coef exp(coef) se(coef) z Pr(>|z|) coln$rxLev -0.01512 0.98499 0.10708 -0.141 0.888 coln$rxLev+5FU -0.51209 0.59924 0.11863 -4.317 1.58e-05 *** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 exp(coef) exp(-coef) lower.95 upper.95 coln$rxLev 0.9850 1.015 0.7985 1.2150 coln$rxLev+5FU 0.5992 1.669 0.4749 0.7561 Likelihood ratio test = 24.34 on 2 df, p=5.175e-06 Wald test = 22.58 on 2 df, p=1.247e-05 Score (logrank) test = 23.07 on 2 df, p=9.804e-06
43
Multiple Regression Results > summary(reg2) Call: coxph(formula = st ~ sex + rx + perfor + obstruct + adhere + nodes2 + extent, data = coln) n= 911, number of events= 456 (18 observations deleted due to missingness) coef exp(coef) se(coef) z Pr(>|z|) sex -0.12256 0.88465 0.09410 -1.303 0.1927 rxLev -0.04272 0.95818 0.10833 -0.394 0.6933 rxLev+5FU-0.52460 0.59179 0.12077 -4.344 1.40e-05 *** perfor 0.07865 1.08182 0.25567 0.308 0.7584 obstruct 0.14509 1.15614 0.11649 1.245 0.2130 adhere 0.25080 1.28505 0.12656 1.982 0.0475 * nodes2 0.26254 1.30023 0.02995 8.765 < 2e-16 *** extent 0.53403 1.70579 0.11632 4.591 4.41e-06 *** --- Likelihood ratio test= 140.7 on 8 df, p=0 Wald test = 134.3 on 8 df, p=0 Score (logrank) test = 139.1 on 8 df, p=0
44
Multiple Regression Results > summary(reg3) Call: coxph(formula = st ~ sex + rx + perfor + obstruct + adhere + factor(nodes2) + factor(extent), data = coln) coef exp(coef) se(coef) z Pr(>|z|) sex -0.11420 0.89208 0.09475 -1.205 0.22810 rxLev -0.04064 0.96017 0.10890 -0.373 0.70899 rxLev+5FU -0.52281 0.59285 0.12106 -4.319 1.57e-05 *** perfor 0.12790 1.13643 0.25665 0.498 0.61826 obstruct 0.16688 1.18162 0.11726 1.423 0.15468 adhere 0.23380 1.26339 0.12818 1.824 0.06816. factor(nodes2)2 0.17549 1.19183 0.15009 1.169 0.24229 factor(nodes2)3 0.36671 1.44299 0.16319 2.247 0.02463 * factor(nodes2)4 0.54757 1.72904 0.18054 3.033 0.00242 ** factor(nodes2)5 1.04969 2.85676 0.12654 8.295 < 2e-16 *** factor(extent)2 0.28810 1.33389 0.53106 0.543 0.58747 factor(extent)3 0.84962 2.33876 0.50643 1.678 0.09341. factor(extent)4 1.39427 4.03201 0.53974 2.583 0.00979 **
46
Ties? > table(duplicated(st)) FALSE TRUE 751 1107 > coxph(st~rx, data=coln) coef exp(coef) se(coef) z p rxLev -0.0151 0.985 0.107 -0.141 8.9e-01 rxLev+5FU -0.5121 0.599 0.119 -4.317 1.6e-05 Likelihood ratio test=24.3 on 2 df, p=5.17e-06 n= 929, number of events= 468 > coxph(st~rx, data=coln, ties="breslow") coef exp(coef) se(coef) z p rxLev -0.0152 0.985 0.107 -0.142 8.9e-01 rxLev+5FU -0.5119 0.599 0.119 -4.315 1.6e-05 Likelihood ratio test=24.3 on 2 df, p=5.23e-06 n= 929, number of events= 468 > coxph(st~rx, data=coln, ties="exact") coef exp(coef) se(coef) z p rxLev -0.0152 0.985 0.107 -0.142 8.9e-01 rxLev+5FU -0.5122 0.599 0.119 -4.317 1.6e-05 Likelihood ratio test=24.3 on 2 df, p=5.19e-06 n= 929, number of events= 468
47
Run Time > system.time(coxph(st~rx, data=coln)) user system elapsed 0 0 0 > system.time(coxph(st~rx, data=coln, ties="breslow")) user system elapsed 0 0 0 > system.time(coxph(st~rx, data=coln, ties="exact")) user system elapsed 0.01 0.00 0.02
48
Local Tests Say we wanted to determine if extent of local spread mattered in the model Four categories: – 1 = submucosa – 2 = muscle – 3 = serosa – 4 = contiguous structures We can use our local tests here (must set it up ourselves in R) – LRT – Wald
49
Local Test: LRT > full_fit<-coxph(st ~ sex + rx + perfor + obstruct + adhere + factor(nodes2)+ factor(extent), data=coln) > LLfull<-full_fit$loglik[2] > LLfull [1] -2883.81 > null_fit<-coxph(st ~ sex + rx + perfor + obstruct + adhere + factor(nodes2), data=coln) > LLnull<-null_fit$loglik[2] > LLnull [1] -2895.227 > LRT_extent<-2*(LLfull-LLnull) > LRT_extent [1] 22.83403 > pval<-pchisq(LRT_extent, df=3, lower=F) > pval [1] 4.373093e-05
50
Local Test: Wald Test > reg3<-coxph(st~sex+rx+perfor+obstruct+adhere+factor(nodes2)+ factor(extent), data=coln) > wald_extent<-t(reg3$coeffic[11:13])%*%solve(reg3$var[11:13,11:13])%*% reg3$coeffic[11:13] > wald_extent [,1] [1,] 21.25669 > pval<-pchisq(wald_extent, df=3, lower=F) > pval [,1] [1,] 9.311276e-05
51
Contrasts Since at least one of the extent of spread categories was not 0, we may also want to contrast the four categories We can use contrasts but again, we must set this up ourselves in R.
52
Contrasts in R > E2vE3<-reg3$coef[11:12]%*%c(-1,1) > se2v3<-sqrt(reg3$var[11,11]+reg3$var[12,12]-2*reg3$var[11,12]) > z2v3<-E2vE3/se2v3 > z2v3 [,1] [1,] 2.730731 > 2*(1-pnorm(abs(z2v3))) [,1] [1,] 0.001843819 > E2vE4<-reg3$coef[c(11,13)]%*%c(-1,1) > se2v4<-sqrt(reg3$var[11,11]+reg3$var[13,13]-2*reg3$var[11,13]) > z2v4<-E2vE4/se2v4 > z2v4 [,1] [1,] 4.286233 > 2*(1-pnorm(abs(z2v4))) [,1] [1,] 1.817281e-05
53
Confidence Interval Construct a 95% CI for the hazard ratio between different extent of local spread categories For specific model coefficient For a contrast
54
CIs for Contrasts in R > ucv23<-E2vE3+qnorm(.975)*se2v3 > lcv23<-E2vE3-qnorm(.975)*se2v3 > hr23<-exp(E2vE3) > hr23 [,1] [1,] 1.753335 > uhr23<-exp(ucv23) > uhr23 [,1] [1,] 2.496546 > lhr23<-exp(lcv23) > lhr23 [,1] [1,] 1.231374
55
Confidence Interval Conclusion: – Adjusting for other covariates in the model, the risk of death among individuals with serosa involvement is 1.75 times the risk of death relative to subjects with only muscle involvement (95% CI for RR 1.23-2.50).
56
Proportional? Recall we are making a strong assumption that we have proportional hazards for each covariate We can investigate this to some extent via graphical displays BUT limited for quantitative variables We’ll learn more about this later
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.