Faculty of Health Sciences. Cox regression. Torben Martinussen. Department of Biostatistics University of Copenhagen. 20. september 2012 Slide 1/51

Similar documents
Goodness-Of-Fit for Cox s Regression Model. Extensions of Cox s Regression Model. Survival Analysis Fall 2004, Copenhagen

Survival analysis in R

Survival analysis in R

Outline. Cox's regression model Goodness-of-t methods. Cox's proportional hazards model: Survival analysis

MAS3301 / MAS8311 Biostatistics Part II: Survival

Definitions and examples Simple estimation and testing Regression models Goodness of fit for the Cox model. Recap of Part 1. Per Kragh Andersen

Cox s proportional hazards model and Cox s partial likelihood

( t) Cox regression part 2. Outline: Recapitulation. Estimation of cumulative hazards and survival probabilites. Ørnulf Borgan

Outline. Frailty modelling of Multivariate Survival Data. Clustered survival data. Clustered survival data

REGRESSION ANALYSIS FOR TIME-TO-EVENT DATA THE PROPORTIONAL HAZARDS (COX) MODEL ST520

Survival Analysis Math 434 Fall 2011

Survival Regression Models

ADVANCED STATISTICAL ANALYSIS OF EPIDEMIOLOGICAL STUDIES. Cox s regression analysis Time dependent explanatory variables

β j = coefficient of x j in the model; β = ( β1, β2,

Other Survival Models. (1) Non-PH models. We briefly discussed the non-proportional hazards (non-ph) model

Lecture 12. Multivariate Survival Data Statistics Survival Analysis. Presented March 8, 2016

More on Cox-regression

In contrast, parametric techniques (fitting exponential or Weibull, for example) are more focussed, can handle general covariates, but require

Part [1.0] Measures of Classification Accuracy for the Prediction of Survival Times

Statistics 262: Intermediate Biostatistics Non-parametric Survival Analysis

Survival Analysis. Stat 526. April 13, 2018

PhD course in Advanced survival analysis. One-sample tests. Properties. Idea: (ABGK, sect. V.1.1) Counting process N(t)

Residuals and model diagnostics

Lecture 22 Survival Analysis: An Introduction

University of California, Berkeley

Log-linearity for Cox s regression model. Thesis for the Degree Master of Science

Lecture 7 Time-dependent Covariates in Cox Regression

Analysis of Time-to-Event Data: Chapter 6 - Regression diagnostics

Proportional hazards regression

Cox s proportional hazards/regression model - model assessment

THESIS for the degree of MASTER OF SCIENCE. Modelling and Data Analysis

Multistate Modeling and Applications

DAGStat Event History Analysis.

Outline. Frailty modelling of Multivariate Survival Data. Clustered survival data. Clustered survival data

Lecture 10. Diagnostics. Statistics Survival Analysis. Presented March 1, 2016

UNIVERSITY OF CALIFORNIA, SAN DIEGO

Relative-risk regression and model diagnostics. 16 November, 2015

STAT Sample Problem: General Asymptotic Results

Hypothesis Testing Based on the Maximum of Two Statistics from Weighted and Unweighted Estimating Equations

You know I m not goin diss you on the internet Cause my mama taught me better than that I m a survivor (What?) I m not goin give up (What?

ST745: Survival Analysis: Nonparametric methods

Accelerated Failure Time Models

Practice Exam 1. (A) (B) (C) (D) (E) You are given the following data on loss sizes:

Extensions of Cox Model for Non-Proportional Hazards Purpose

Lecture 8 Stat D. Gillen

Chapter 4 Regression Models

The coxvc_1-1-1 package

Survival Analysis for Case-Cohort Studies

Lecture 2: Martingale theory for univariate survival analysis

MAS3301 / MAS8311 Biostatistics Part II: Survival

11 Survival Analysis and Empirical Likelihood

Survival Analysis. Lu Tian and Richard Olshen Stanford University

e 4β e 4β + e β ˆβ =0.765

Time-dependent coefficients

Survival Analysis. STAT 526 Professor Olga Vitek

Multistate models and recurrent event models

Goodness-of-fit test for the Cox Proportional Hazard Model

1 Glivenko-Cantelli type theorems

Survival Analysis I (CHL5209H)

Beyond GLM and likelihood

8. Parametric models in survival analysis General accelerated failure time models for parametric regression

Exercises. (a) Prove that m(t) =

Semiparametric Regression

Lecture 6 PREDICTING SURVIVAL UNDER THE PH MODEL

STAT331. Cox s Proportional Hazards Model

Multistate models and recurrent event models

STAT 6350 Analysis of Lifetime Data. Failure-time Regression Analysis

Introduction to Empirical Processes and Semiparametric Inference Lecture 25: Semiparametric Models

TESTINGGOODNESSOFFITINTHECOX AALEN MODEL

Lecture 7. Proportional Hazards Model - Handling Ties and Survival Estimation Statistics Survival Analysis. Presented February 4, 2016

TMA 4275 Lifetime Analysis June 2004 Solution

Approximation of Survival Function by Taylor Series for General Partly Interval Censored Data

Tied survival times; estimation of survival probabilities

9 Estimating the Underlying Survival Distribution for a

Analysis of Time-to-Event Data: Chapter 4 - Parametric regression models

Chapter 7: Hypothesis testing

Survival Analysis: Weeks 2-3. Lu Tian and Richard Olshen Stanford University

Modelling geoadditive survival data

Lecture 5 Models and methods for recurrent event data

Nonparametric two-sample tests of longitudinal data in the presence of a terminal event

1 Introduction. 2 Residuals in PH model

ST745: Survival Analysis: Cox-PH!

Power and Sample Size Calculations with the Additive Hazards Model

ST495: Survival Analysis: Maximum likelihood

P n. This is called the law of large numbers but it comes in two forms: Strong and Weak.

Time-dependent covariates

Multi-state Models: An Overview

Lecture 9. Statistics Survival Analysis. Presented February 23, Dan Gillen Department of Statistics University of California, Irvine

Tests of independence for censored bivariate failure time data

Chapter 7 Fall Chapter 7 Hypothesis testing Hypotheses of interest: (A) 1-sample

Empirical Likelihood Confidence Band

Statistics in medicine

FULL LIKELIHOOD INFERENCES IN THE COX MODEL

Comparing Distribution Functions via Empirical Likelihood

Logistic regression model for survival time analysis using time-varying coefficients

Chapter 2 Inference on Mean Residual Life-Overview

A Regression Model For Recurrent Events With Distribution Free Correlation Structure

On a connection between the Bradley-Terry model and the Cox proportional hazards model

Case-control studies

Philosophy and Features of the mstate package

Transcription:

Faculty of Health Sciences Cox regression Torben Martinussen Department of Biostatistics University of Copenhagen 2. september 212 Slide 1/51

Survival analysis Standard setup for right-censored survival data. IID copies of (T, D) where T = T C D = I(T C) ubiquitous with T being the true survival time and C the (potential) censoring time and possibly covariates X i (t). Hazard-function: α(t) = lim h 1 h P(t T < t + h T t, F t ). Counting process: N i (t) = I(T i t, D i = 1) Martingale: M i (t) = N i (t) Λ i (t) where Λ i (t) = t Y i(s)α(s) ds (compensator), Y i (t) = I(t T i ) (at risk process). Intensity: Y (t)α(t). Slide 2/51

Modelling Survival Data To model and analyze survival data and deal with censorings in a convenient way one often specifies the model through the hazard rate: α(t) = risk of dying among people at risk at time t The hazard function is closely related to the survival probability in other words So t P(T > t) = S(t) = exp( α(s)ds) logs(t) = A(t) = t α(t) = d dt logs(t) α(s)ds Notation, may use both α(t) and λ(t) for the hazard function. Forgive me. But keep in mind that intensity function is Y (t)α(t). Slide 3/51

Parametric Models To give precise and clear answers. Kaplan-Meier curves and log-rank tests are not always sufficient. By making simplifying reasonable assumptions something more can be said through parametric models. The simplest possible survival model simply claims that the intensity is constant over time λ(t) = λ, Λ(t) = λt When the rate is constant the survival time is exponentially distributed. One may validate the model by considering the non-parametric estimator of the cumulative intensity (Nelson-Aalen) ˆΛ(t) Should be approximately linear if the model is correct Slide 4/51

Malignant melanoma In the period 1962-77 25 patients had their tumour removed and were followed until 1977. At the end of 1977: 57 died of mgl. mel. 14 died of non-related mgl. mel. 134 were still alive. Purpose: Study effect on survival of sex, age, thickness of tumour, ulceration,.. Slide 5/51

Malignant melanoma N time status sex age year thickness ulcer 1 1 3 1 76 1972 6.76 1 2 3 3 1 56 1968.65 3 35 2 1 41 1977 1.34 4 99 3 71 1968 2.9 5 185 1 1 52 1965 12.8 1 6 24 1 1 28 1971 4.84 1 7 21 1 1 77 1972 5.16 1 8 232 3 6 1974 3.22 1 9 232 1 1 49 1968 12.88 1........................ 23 4688 2 42 1965.48 24 4926 2 5 1964 2.26 25 5565 2 41 1962 2.9 Slide 6/51

Parametric models - the Weibull model Let X, a (p-dimensional) covariate. The Weibull regression model has hazard function α θ (t) = λγ(λt) γ 1 exp(x T β), (1) where θ = (λ, γ, β); β denotes the regression parameters. The hazard (1) may be written as a so-called proportional hazards model λ (t) exp(x T β), Likelihood function based on T i = Ti C i D i = I(Ti C i ), X i (ignoring censoring part) is : L(θ) = i α θ (T i ) D i e T i αθ (t) dt Standard MLE applies, n(ˆθ θ) D N(, Σ), ˆΣ = I 1 (ˆθ) where I(θ) is minus the derivative of U(θ). How would you compute ˆθ if you were to implement it in R? Slide 7/51

Parametric models - the Weibull model Do exercise 3.7 (a) in MS, p. 76. Read in the melanoma-data, and fit the Weibull-model with only sex in the model, see p. 69 in MS Any suggestion on how to check the validity of the Weibull-model in this case? Slide 8/51

Cox-Regression Cox-regression is the regression technique for survival analysis, Cox (1972). Per 25. The two most cited statistical papers: (1) With 25,869 citations (currently cited 1,984 times per year): Kaplan, E. L. and Meier, P. (1958) Nonparametric estimation from incomplete observations, Journal of the American Statistical Association, 53, pp. 457-481. (2) With 18,193 citations (1,342 per year), Cox, D. R. (1972) Regression models and life tables, Journal of the Royal Statistical Society, Series B, 34, pp. 187-22. Regression techniques are very useful for dealing with many covariates Can be used to learn about treatment effect while correcting for other covariates. Cox model: λ i (t) = λ (t) exp(β 1 X i1 +... + β px ip ), where λ (t) is baseline hazard for a subject with covariates. Note: λ (t) is not further specified! Slide 9/51

The Cox model The regression coefficients β 1,..., β p represent the effects of the covariates. β 1 is the effect of X i1 when we have corrected for the other covariates. β 1 may be interpreted in terms of the relative risk when the covariate X i1 is increased 1: λ (t) exp(β 1 (X i1 + 1) +... + β px ip ) λ (t) exp(β 1 X i1 +... + β px ip ) = exp (β 1 ) If β 1 > the risk of dying increases as X i1 increases, and if β 1 < the risk of dying decreases as X i1 increases. The quantity ˆβ 1 X i1 +... + ˆβ px ip is called the prognostic index for the ith subject. Slide 1/51

Two-Sample Cox Model Consider a simple 2-sample situation where we wish to study effect of sex. Defining a covariate for the ith patient { 1 Male X i = Female The hazard can be written as λ i (t) = λ (t) exp(βx i ) giving the contributions λ (t) exp(β) when X i = 1 and λ (t) when X i =. Note again that λ (t) is unspecified meaning that which distribution is unspecified? In a moment we derive estimators for the Cox model, but let s already use them. Can be calculated in R (or SAS, Stata, SPSS). http://nyheder.ku.dk/alle_nyheder/212/212.9/ forskere-paaviser-klar-sammenhaeng-mellem-antistof-og-leddegigt/ BMJ-paper Slide 11/51

Example: Melanoma data Consider the Cox-model for the melanoma with the explanatory variables sex and log(thickness) (lthick): We get: λ i (t) = λ (t) exp (β 1 sex i + β 2 lt i ) > melanoma$lthick=log(melanoma$thick) > fit=coxph(surv(days,status==1)~ factor(sex)+lthick,data=melanoma) > fit Call: coxph(formula = Surv(days, status == 1) ~ factor(sex) + lthick, data = melanoma) coef exp(coef) se(coef) z p factor(sex)1.458 1.58.269 1.7 8.8e-2 lthick.781 2.18.157 4.96 6.9e-7 Likelihood ratio test=33.5 on 2 df, p=5.45e-8 n= 25 What does the relative risks of 1.58 and 2.18 mean? Slide 12/51

PBC-data PBC data (primary biliary cirrhosis): 418 patients are followed until death or censoring. PBC is a fatal chronic liver disease. Important explanatory variables: Age: in years Albumin: serum albumin (mg/dl) Bilirubin: serum bilirunbin (mg/dl) Edema: no edema,.5 untreated or successfully treated 1 edema despite diuretic therapy Prothrombin time: standardised blood clotting time Slide 13/51

Fitting Cox s model in R > library(survival) > data(pbc) > with(pbc,cbind(time,status,age,edema,bili,protime,albumin)[1:5,]) time status age edema bili protime albumin [1,] 4 2 58.76523 1. 14.5 12.2 2.6 [2,] 45 56.44627. 1.1 1.6 4.14 [3,] 112 2 7.7255.5 1.4 12. 3.48 [4,] 1925 2 54.7459.5 1.8 1.3 2.54 [5,] 154 1 38.1541. 3.4 1.9 3.53 > > fit.pbc<-coxph(surv(time, status==2) ~ age+factor(edema)+log(bili)+log(protime)+ log(albumin),data=pbc) > fit.pbc Call: coxph(formula = Surv(time, status == 2) ~ age + factor(edema) + log(bili) + log(protime) + log(albumin), data = pbc) coef exp(coef) se(coef) z p age.45 1.413.771 5.25 1.6e-7 factor(edema).5.2819 1.3256.22523 1.25 2.1e-1 factor(edema)1 1.125 2.7524.28975 3.49 4.8e-4 log(bili).859 2.369.8324 1.32.e+ log(protime) 2.3599 1.592.77314 3.5 2.3e-3 log(albumin) -2.5158.88.65262-3.85 1.2e-4 Likelihood ratio test=232 on 6 df, p= n=416 (2 observations deleted due to missingness) Slide 14/51

Likelihood construction Likelihood function based on T i = Ti C i D i = I(Ti C i ), X i is: i α(t i ) D i e T i α(t) dt = i { α(t) N i (t) } e τ t Y i (t)α(t) dt τ is end of observation period Y i (t) = I(t T i ) is the at risk indicator. Can also write it as { da(t) N i (t) } e τ i t Y i (t)da(t) where A(t) = t α(s) ds. Cox-model: A(t) = A (t)e X T β with A (t) = t α (s) ds. Slide 15/51

Likelihood construction Let S (t, β) = n i=1 Y i(t) exp(xi T β). Based on martingale equation can you then suggest an estimator of A (t) assuming β is known? Slide 16/51

Likelihood construction The "estimator" Â (t, β) = is called the Breslow-estimator. t 1 S (t, β) dn (s) Now plug this estimator into the likelihood function, and arrive at a function only depending on β! This function, L(β) is called Cox s partial likelihood function. Slide 17/51

Cox s proportional hazards model The Cox model is λ i (t) = Y i (t)λ (t) exp(x T i β), (2) where X = (X 1,..., X p) is a p-dimensional locally bounded predictable covariate and Y i (t) is an at risk indicator. The regression parameter β is estimated as the maximizer to Cox s partial likelihood function L(β) = ( ) exp (X T Ni (t) i β), (3) S (t, β) t where S (t, β) = i n i=1 Λ (t) is estimated by the Breslow estimator ˆΛ (t) = ˆΛ (t, ˆβ) = Y i (t) exp(xi T β). t 1 S (t, ˆβ) dn (t). (4) Slide 18/51

Cox s proportional hazards model We have presented theory with time-const. X s, but can easily handle time-var. covariates. Now let s look into the asymptotical properties of Cox s estimators. The first partial derivative of S (t, β) with respect to β is denoted : S 1 (t, β) = n i=1 Y i (t) exp(xi T β)x i Show that ˆβ is found as the solution to the score equation U( ˆβ) =, where U(β) = n i=1 τ (X i (t) E(t, β))dn i (t) E(t, β) = S 1(t, β) S (t, β). (5) Show also that U(β ) can be written as a martingale evaluated at τ. Here, β denotes the true β. Slide 19/51

Asymptotic properties Theorem Under the standard conditions, then, as n, n 1/2 U(β ) D N(, Σ), n 1/2 ( ˆβ β ) D N(, Σ 1 ), and Σ is estimated consistently by n 1 I( ˆβ), with I minus the derivative of U. Under the standard conditions, then, as n, n 1/2 (ˆΛ (t, ˆβ) Λ (t)) D U(t) where U(t) is a zero-mean Gaussian process with covariance function Φ(t). Not a martingale though, why? Get back to how Φ(t) can be estimated consistently Slide 2/51

Asymptotic properties Key to the proof is that the score evaluated in the true point β is a martingale (evaluated at τ): U(β ) = n τ i=1 (X i E(t, β ))dm i (t) (6) The predictable variation process of n 1/2 U(β ) is n 1/2 U(β ) = n 1 n where i=1 τ (X i (t) E(t, β )) 2 Y i (t) exp(xi T (t)β )dλ (t) τ = n 1 V (t, β )S (t, β )dλ (t) Σ. P V (t, β) = S 2(t, β) S (t, β) E(t, β) 2. (7) Lindeberg condition of martingale CLT is also fulfilled Slide 21/51

Asymptotic properties It follows that U(β ) converges in distribution to a normal variate with zero-mean and variance Σ. A Taylor series expansion of the score gives n 1/2 ( ˆβ β ) = (n 1 I(β )) 1 n 1/2 U(β ), where β is on the line segment between β and ˆβ. Consistency of ˆβ and the results above give that n 1/2 ( ˆβ β ) converges to the postulated normal distribution. Slide 22/51

IID decomposition The score process evaluated at β where n 1/2 U(β, t) = n 1/2 ɛ 1i (t) = t n ɛ 1i (t) + o p(1) i=1 ( X i s ) 1(β, t) dm i (s) s (β, t) with s j (β, t) the limit in prob. of n 1 S j (β, t). That is a sum of zero-mean iid terms! The variance of n 1/2 ( ˆβ β ) may be estimated consistently by { n } Σ = ni 1 ( ˆβ, τ) ˆɛ 2 1i (τ) I 1 ( ˆβ, τ). where ˆɛ 1i (τ) is given by ɛ 1i (τ) replacing unknowns with their empirical counterparts. i=1 Slide 23/51

IID decomposition More important! Try the same for the Breslow-estimator. n 1/2 (ˆΛ (t, ˆβ) Λ (t)) n 1/2 (ˆΛ (t, β ) Λ (t)) + D β ˆΛ (t, ˆβ)n 1/2 ( ˆβ β ) D β ˆΛ (t, ˆβ) conv. in probability so last term is essentially a sum of zero-mean iid s. But also n 1/2 (ˆΛ (t, β ) Λ (t)) = since n 1 S (s, β) P s (s, β). t n 1/2 t 1 S (s, β) dm (s) 1 s (s, β) dm i(s), Slide 24/51

IID decomposition It thus follows that n 1/2 (ˆΛ (t, ˆβ) Λ (t)) is asymptotically equivalent to where n 1/2 n ɛ 2i (t), (8) i=1 ɛ 2i (t) =ɛ 3i (t) + H T (β, t)i(β, τ) 1 ɛ 1i (τ), ɛ 3i (t) = t S 1 (β, s)dm i (s), and where H(β, t) is the derivative of t S 1 (β, s)dn.(s) wrt β. The variance of n 1/2 (ˆΛ (t, ˆβ) Λ (t)) thus may be estimated by n 1 n i=1 ɛ 2 2i (t) Slide 25/51

Resampling Now, n 1/2 (ˆΛ (t, ˆβ) Λ (t)) is asymptotically equivalent to n 1/2 where G 1,..., G n are iid N(, 1). n ˆɛ 2i (t)g i (9) This is very useful for constructing confidence bands for the survival predictions and to make tests about the baseline and survival function predictions. Taylor expansion: i=1 n 1/2 (S (ˆΛ, ˆβ, { t) S (Λ, β, t)) = S (Λ, β, t) n 1/2 exp(x T β)(ˆλ (t) Λ (t)) + Λ (t) exp(x T β)x T ( ˆβ } β). (1) Slide 26/51

Resampling Just saw that : n 1/2 ( ˆβ β, ˆΛ Λ ) was asymptotically equivalent to the processes 1 = n 1/2 2 (t) = n 1/2 n ˆɛ 1i G i, i=1 n ˆɛ 2i (t)g i, where G 1,..., G n are independent standard normals. It follows that n 1/2 (Ŝ S ) has the same asymptotic distribution as i=1 where n S (t) = S (t)n 1/2 ˆɛ 4i (t)g i, (11) i=1 ɛ 4i (t) = exp(z T β)ɛ 2i (t) + A(t) exp(x T β)x T ɛ 1i. Slide 27/51

Cox-Regression: checking assumptions Wish to study a treatment effect while correcting for other variables. May use Cox-model: λ i (t) = λ (t) exp(β 1 X i1 +... + β px ip ) λ (t) is the baseline hazard for a subject with covariates. The Cox models ability to deal with many covariates comes from the regression structure. Some assumptions have been made The effects of covariates are additive and linear on the log risk scale. If covariates interact with each other the regression model should include interaction terms. The relative risk between the hazard rate for two subjects is constant over time c(β 1,..., β p) = λ i (t) λ i (t) We will try to check all these assumptions with the latter being the key assumption. Slide 28/51

Interaction between categorical and cont. variables Melanoma data: Consider the Cox-model for melanoma data with explanatory variables sex and log(thickness) (lt): λ i (t) = λ (t) exp (β 1 sex i + β 2 lt i ) How do we check for interaction in this situation? Group the continuous variable (log(thickness)) and proceed as before. Allow for two different β 2 s, one for each value of sex. Fit this latter model in R, and interpret output. Slide 29/51

Interaction between categorical and cont. variables > fit=coxph(surv(days,status==1)~ factor(sex)+factor(sex)*lthick,data=melanoma) > fit Call: coxph(formula = Surv(days, status == 1) ~ factor(sex) + factor(sex) * lthick, data = melanoma) coef exp(coef) se(coef) z p factor(sex)1 1.111 3.37 1.817.612 5.4e-1 lthick.834 2.32.214 3.895 9.8e-5 factor(sex)1:lthick -.113.893.311 -.363 7.2e-1 Cox-model: λ (t) exp (β 1 sex + β 2 lt + β 3 sexlt) with { β1 + (β β 1 sex + β 2 lt + β 3 sexlt = 2 + β 3 ) lt, sex = 1 β 2 lt, sex = The baseline λ (t) is the hazard for? The effect of lt is estimated to? for male and to? for female Is there an interaction between sex and lt? Slide 3/51

Checking proportionality Constant relative risk between the hazard rates for two subjects c(β 1,..., β p) = λ i (t) λ i (t) In the 2-sample case the assumption is equivalent to proportional intensities for the two groups, i.e., exp(β 1 )λ 1 (t) = λ 2 (t). Implies that the cumulative intensities are proportional Λ 2 (t) = t λ 2 (s)ds = exp(β 1 )Λ 1 (t) A plot of ˆΛ 2 (t) versus ˆΛ 1 (t) should give a straight line through (,) with slope exp(β 1 ). Similarly log(λ 2 (t)) log(λ 1 (t)) = β 1 so plotting log(ˆλ k (t)), k = 1, 2, versus t should give parallel curves. Slide 31/51

The Stratified Cox model The stratified Cox model contains different baselines for different strata : λ ik (t) = λ k (t) exp(β 1 X i1 +... + β px ip ) k = 1,..., K λ k (t) is the baseline hazard for a subject in strata k. The regression coefficients β 1,..., β p represent the effects of the covariates as in the simple Cox regression model. Melanoma-data: we might stratify according to ulceration. The baselines give the mortality of the two defined by ulceration (yes/no) when all other covariates are. Slide 32/51

Log-cumulative hazard plot > fit=coxph(surv(days,status==1)~ factor(sex)+lthick+strata(ulc),data=melanoma) > fit.detail=coxph.detail(fit) > logcum1=log(cumsum(fit.detail$hazard[c(17:57)])) > logcum=log(cumsum(fit.detail$hazard[1:16])) > plot(c(fit.detail$time[17:57],37),c(logcum1,logcum1[41]),type= s,xlab="time (in days)",ylab="logcums") > lines(c(fit.detail$time[1:16],37),c(logcum,logcum[16]),type= s,lty=2) Logcums -5-4 -3-2 -1 5 1 15 2 25 3 35 Time (in days) Parallel? Slide 33/51

Checking Proportionality: tests Graphical test may reveal serious violations, but they may be difficult to use in general. If effect is expected to wear off with time or to increase with time, one may try to describe this effect and then fit a Cox model with a time-varying explanatory variable f (t) exp(β + θ f (t)) = λ 1(t) λ 2 (t) For a given choice of f (t) we can then test if θ is, i.e, if the time-varying effect can be left out of the model. A common choice of f (t) is ln(t). More specialized methods and programs are available. Slide 34/51

Checking Proportionality: tests > fit=coxph(surv(days/365,status==1)~ factor(sex)+ulc+lthick,data=melanoma) > time.test=cox.zph(fit,transform="log") > time.test rho chisq p factor(sex)1 -.627.23.6312 ulc -.1335.956.3283 lthick -.2942 4.22.449 GLOBAL NA 8.773.325 Based on this, the Cox model is rejected. Slide 35/51

Checking Proportionality: tests Another option is to have a time-changing effect of ulc. Imagine for instance that effect of ulc is most important in an initial phase. We try the first 4 years, approx 14 days. We hence replace β ulc ulc by β ulc (t) ulc with Note that with β ulc (t) = β ulc,1 + β ulc,2 I(t > 14) β ulc (t) ulc = (β ulc,1 + β ulc,2 I(t > 14)) ulc being a time-varying covariate. = β ulc,1 ulc + β ulc,2 X(t) X(t) = I(t > 14)) ulc So this is just a Cox-model again, but now with a time-varying covariate. Slide 36/51

Time-changing effect of covariates Such a model can easily be fitted in R using the survsplit-function. > melanoma1=survsplit(melanoma,cut=c(14),end="days",start="start", event="status") > melanoma1$ulcnew=melanoma1$ulc*as.numeric(melanoma1$days>14) > > fit1=coxph(surv(start,days,status==1)~ factor(sex)+lthick+ actor(ulc)+ factor(ulcnew), data=melanoma1) > summary(fit1) Call: coxph(formula = Surv(start, days, status == 1) ~ factor(sex) + lthick + factor(ulc) + factor(ulcnew), data = melanoma1) n= 367 coef exp(coef) se(coef) z Pr(> z ) factor(sex)1.3744 1.4541.271 1.386.165759 lthick.5741 1.7756.181 3.187.1436 ** factor(ulc)1 1.6967 5.4561.524 3.377.732 *** factor(ulcnew)1-1.5515.2119.6451-2.45.1617 * --- Relative risk Ulc/no Ulc in the first 4 years, and after the first 4 years? Conclusion? Slide 37/51

Cox s proportional hazards model The procedures described above are the traditional goodness-of-fit tools. Make tests against specific deviations: Replace X 1 with (X 1, X 1 (log (t))), say (β 1 β 1 + β p+1 log (t)). Test the null β p+1 =. Graphical method Time-changing effect. These methods are quite useful but also have some limitations: Graphical method: Not parallel. What is acceptable? What if a given covariate is continuous? Test: Ad hoc method. Which transformation to use? Time-changing effect. Also ad-hoc in that the time where effects changes are rarely known in practice. All methods: They assume that model is ok for all the other covariates. Slide 38/51

Cumulative martingale residuals Alternative: Cumulative martingale residuals, Lin, Wein and Ying (1993). The martingales under the Cox regression model can be written as t M i (t) = N i (t) Y i (s) exp(x T β)dλ (s) ˆM i (t) = N i (t) = N i (t) t t Y i (s) exp(x T ˆβ)d ˆΛ (s) Y i (s) exp(x T i (s) ˆβ) 1 S (s, ˆβ) dn (s). One idea is now to look at different groupings of the these residuals and see if they behave as they should under the model. Slide 39/51

Cumulative martingale residuals The score function, evaluated in the estimate ˆβ, and seen as a function of time, can for example be written as U( ˆβ, t) = n i=1 t (X i S 1(s, ˆβ) S (s, ˆβ) )dn i(s) = n i=1 t X i d ˆM i (s) so it is equivalent to cumulating the martingale residuals (in certain way). Also, by Taylor series expansion, n 1/2 U( ˆβ, t) n 1/2 U(β, t) (n 1 I( ˆβ, t))n 1/2 ( ˆβ β) n 1/2 ( ˆβ β) (n 1 I( ˆβ, τ)) 1 n 1/2 U(β, τ) Hence n 1/2 U( ˆβ, { } t) n 1/2 U(β, t) I( ˆβ, t)(i( ˆβ, τ)) 1 U(β, τ) Slide 4/51

Cumulative martingale residuals n 1/2 U( ˆβ, t) is thus asymptotically equivalent to the process ( ) n 1/2 M 1 (t) I(t, ˆβ)I 1 (τ, ˆβ)M 1 (τ), (12) where M 1 (t) = n M 1i (t) = i=1 n t i=1 (X i (s) e(s, β ))dm i (s) with e(t, β ) = lim p E(t, β ). Note: n 1/2 U( ˆβ, τ) = Slide 41/51

Cumulative martingale residuals The distribution of the process n 1/2 M 1 (t) (t [, τ]) is asymptotically equivalent to n 1/2 n i=1 t (X i (s) E(s, ˆβ))dN i (s)g i where G 1,..., G n are independent standard normals. Since M i s are i.i.d. with variance E(N i ). Alternatively to this resampling approach one may also ([?]), show n 1/2 n ˆM 1i (t)g i, with ˆM 1i (t) = i=1 t (X i (s) E(s, ˆβ))d ˆM i (s). Therefore it can be shown that n 1/2 U( ˆβ, t) is asymptotically equivalent to n 1/2 n i=1 ( ˆM1i (t) I(t, ˆβ)I 1 (τ, ˆβ) ˆM 1i (τ)) G i, for almost any sequence of the counting processes that determines ˆM and I. Slide 42/51

Cumulative martingale residuals To summarize the cumulative score process plots one may look at test statistics like sup U j ( ˆβ, t), j = 1..., p, t [,τ] Slide 43/51

PBC-data > library(timereg) > fit=cox.aalen(surv(days,status==1)~ prop(factor(sex))+prop(lthick)+ prop(ulc), data=melanoma) > summary(fit) Proportional Cox terms : Coef. SE Robust SE D2log(L)^-1 z P-val prop(factor(sex))1.381.274.281.271 1.36.174 prop(lthick).576.162.172.179 3.34.847 prop(ulc).939.315.37.324 3.6.223 Test for Proportionality sup hat U(t) p-value H_ prop(factor(sex))1 3.27.282 prop(lthick) 8.17.12 prop(ulc) 4.31.54 > plot(fit,score=t) Slide 44/51

PBC-data prop(factor(sex))1 prop(lthick) Cumulative coefficients -6-4 -2 2 4 6 Cumulative coefficients -1-5 5 1 5 15 25 Time 5 15 25 Time prop(ulc) Cumulative coefficients -6-4 -2 2 4 6 5 15 25 Time Slide 45/51

Cumulative Residuals LWY also suggested : M c(t, z) = t K T z (s)d ˆM(s) where K z(t) is an n 1 matrix with elements I(X i1 (t) z) for i = 1,..., n focusing here on the first continuous covariate X 1, say. Thus cumulating residuals versus both time and the covariate values. A 1-dimensional process : M c(z) = τ which can be plotted against z. If X 1 (t) = X 1 then τ K T z (t)d ˆM(t) = i process in z. K T z (t)d ˆM(t), (13) ˆM i (τ)i(x i1 z) which is a This will reveal if the functional form is appropriate. These processes can also be resampled. Slide 46/51

Cumulative residuals > fit.gof=cox.aalen(surv(days,status==1)~ prop(lthick),melanoma, residuals=1) > > resids=cum.residuals(fit.gof,melanoma,cum.resid=1) > summary(resids) Test for cumulative MG-residuals Grouped cumulative residuals not computed, you must provide modelmatrix to get these (see help) Residual versus covariates consistent with model sup hat B(t) p-value H_: B(t)= 5.772.512 Call: cum.residuals(fit.gof, melanoma, cum.resid = 1) Slide 47/51

Cumulative martingale residuals Cumulative residuals -1-5 5 1 3 4 5 6 7 Slide 48/51

Cumulative residuals > fit.gof=cox.aalen(surv(days,status==1)~ prop(thick),melanoma, residuals=1) > resids=cum.residuals(fit.gof,melanoma,cum.resid=1) > summary(resids) Test for cumulative MG-residuals Grouped cumulative residuals not computed, you must provide modelmatrix to get these (see help) Residual versus covariates consistent with model sup hat B(t) p-value H_: B(t)= 1.885.22 Call: cum.residuals(fit.gof, melanoma, cum.resid = 1) Slide 49/51

Cumulative martingale residuals Cumulative residuals -1-5 5 1 5 1 15 Slide 5/51

Summary Cox s proportional hazards model. Nice model with easily interpretable parameters - relative risks! Is is used heavily in Biostatistcs. Are the relative risks really not depending on time? Check model carefully. Resampling techniques useful for evaluating asymptotics distributions. Useful goodness-of-fit based on cumulative residuals with p-values. Slide 51/51