jm and jmbayes @ jsm2015

45
Fitting Joint Models in R using Packages JM and JMbayes Dimitris Rizopoulos Department of Biostatistics, Erasmus Medical Center, the Netherlands [email protected] Joint Statistical Meetings August 11th, 2015

Upload: dimitris-rizopoulos

Post on 22-Jan-2018

4.697 views

Category:

Software


0 download

TRANSCRIPT

Page 1: JM and JMbayes @ JSM2015

Fitting Joint Models in R using Packages JM and JMbayes

Dimitris RizopoulosDepartment of Biostatistics, Erasmus Medical Center, the Netherlands

[email protected]

Joint Statistical Meetings

August 11th, 2015

Page 2: JM and JMbayes @ JSM2015

1.1 Introduction

• Often in follow-up studies different types of outcomes are collected

• Explicit outcomes

◃ multiple longitudinal responses (e.g., markers, blood values)

◃ time-to-event(s) of particular interest (e.g., death, relapse)

• Implicit outcomes

◃ missing data (e.g., dropout, intermittent missingness)

◃ random visit times

JM & JMbayes – August 11, 2015 1/37

Page 3: JM and JMbayes @ JSM2015

1.2 Illustrative Case Study

• Aortic Valve study: Patients who received a human tissue valve in the aortic position

◃ data collected by Erasmus MC (from 1987 to 2008);77 received sub-coronary implantation; 209 received root replacement

• Outcomes of interest:

◃ death and re-operation → composite event

◃ aortic gradient

JM & JMbayes – August 11, 2015 2/37

Page 4: JM and JMbayes @ JSM2015

1.3 Research Questions

• Depending on the questions of interest, different types of statistical analysis arerequired

• We will distinguish between two general types of analysis

◃ separate analysis per outcome

◃ joint analysis of outcomes

• Focus on each outcome separately

◃ does treatment affect survival?

◃ are the average longitudinal evolutions different between males and females?

◃ . . .

JM & JMbayes – August 11, 2015 3/37

Page 5: JM and JMbayes @ JSM2015

1.3 Research Questions (cont’d)

• Focus on multiple outcomes

◃ Complex effect estimation: how strong is the association between the longitudinaloutcome and the hazard rate of death?

◃ Handling implicit outcomes: focus on the longitudinal outcome but with dropout

JM & JMbayes – August 11, 2015 4/37

Page 6: JM and JMbayes @ JSM2015

1.3 Research Questions (cont’d)

In the Aortic Valve dataset:

• Research Question:

◃ Can we utilize available aortic gradient measurements to predictsurvival/re-operation

JM & JMbayes – August 11, 2015 5/37

Page 7: JM and JMbayes @ JSM2015

1.4 Goals

• Methods for the separate analysis of such outcomes are well established in theliterature

• Survival data:

◃ Cox model, accelerated failure time models, . . .

• Longitudinal data

◃ mixed effects models, GEE, marginal models, . . .

JM & JMbayes – August 11, 2015 6/37

Page 8: JM and JMbayes @ JSM2015

1.4 Goals (cont’d)

• Goals of this talk:

◃ introduce joint models

◃ illustrate present software capabilities in R

JM & JMbayes – August 11, 2015 7/37

Page 9: JM and JMbayes @ JSM2015

2.1 Joint Modeling Framework

• To answer our questions of interest we need to postulate a model that relates

◃ the aortic gradient with

◃ the time to death or re-operation

• Problem: Aortic gradient is an endogenous time-dependent covariate (Kalbfleisch and

Prentice, 2002, Section 6.3)

◃ Measurements on the same patient are correlated

◃ Endogenous (aka internal): the future path of the covariate up to any time t > sIS affected by the occurrence of an event at time point s

JM & JMbayes – August 11, 2015 8/37

Page 10: JM and JMbayes @ JSM2015

2.1 Joint Modeling Framework (cont’d)

• What is special about endogenous time-dependent covariates

◃ measured with error

◃ the complete history is not available

◃ existence directly related to failure status

• What if we use the Cox model?

◃ the association size can be severely underestimated

◃ true potential of the marker will be masked

JM & JMbayes – August 11, 2015 9/37

Page 11: JM and JMbayes @ JSM2015

2.1 Joint Modeling Framework (cont’d)

0 1 2 3 4 5

46

810

Time (years)

AoG

rad

Death

observed Aortic Gradienttime−dependent Cox

JM & JMbayes – August 11, 2015 10/37

Page 12: JM and JMbayes @ JSM2015

2.1 Joint Modeling Framework (cont’d)

• To account for the special features of these covariates a new class of models has beendeveloped

Joint Models for Longitudinal and Time-to-Event Data

• Intuitive idea behind these models

1. use an appropriate model to describe the evolution of the marker in time for eachpatient

2. the estimated evolutions are then used in a Cox model

• Feature: Marker level is not assumed constant between visits

JM & JMbayes – August 11, 2015 11/37

Page 13: JM and JMbayes @ JSM2015

2.1 Joint Modeling Framework (cont’d)

Time

0.1

0.2

0.3

0.4

hazard

0.0

0.5

1.0

1.5

2.0

0 2 4 6 8

marker

JM & JMbayes – August 11, 2015 12/37

Page 14: JM and JMbayes @ JSM2015

2.1 Joint Modeling Framework (cont’d)

• We define a standard joint model

◃ Survival Part: Relative risk model

hi(t) = h0(t) exp{γ⊤wi + αmi(t)},

where

* mi(t) = the true & unobserved value of aortic gradient at time t

* α quantifies the effect of aortic gradient on the risk for death/re-operation

* wi baseline covariates

JM & JMbayes – August 11, 2015 13/37

Page 15: JM and JMbayes @ JSM2015

2.1 Joint Modeling Framework (cont’d)

◃ Longitudinal Part: Reconstruct Mi(t) = {mi(s), 0 ≤ s < t} using yi(t) and amixed effects model (we focus on continuous markers)

yi(t) = mi(t) + εi(t)

= x⊤i (t)β + z⊤i (t)bi + εi(t), εi(t) ∼ N (0, σ2),

where

* xi(t) and β: Fixed-effects part

* zi(t) and bi: Random-effects part, bi ∼ N (0, D)

JM & JMbayes – August 11, 2015 14/37

Page 16: JM and JMbayes @ JSM2015

3.1 Joint Models in R

• Joint models are fitted using function jointModel() from package JM. Thisfunction accepts as main arguments a linear mixed model and a Cox PH model basedon which it fits the corresponding joint model

lmeFit <- lme(CD4 ~ obstime + obstime:drug,

random = ~ obstime | patient, data = aids)

coxFit <- coxph(Surv(Time, death) ~ drug, data = aids.id, x = TRUE)

jointFit <- jointModel(lmeFit, coxFit, timeVar = "obstime",

method = "piecewise-PH-aGH")

summary(jointFit)

JM & JMbayes – August 11, 2015 15/37

Page 17: JM and JMbayes @ JSM2015

3.1 Joint Models in R

• As before, the data frame given in lme() should be in the long format, while thedata frame given to coxph() should have one line per subject∗

◃ the ordering of the subjects needs to be the same

• In the call to coxph() you need to set x = TRUE (or model = TRUE) such that thedesign matrix used in the Cox model is returned in the object fit

• Argument timeVar specifies the time variable in the linear mixed model

∗ Unless you want to include exogenous time-varying covariates or handle competing risks

JM & JMbayes – August 11, 2015 16/37

Page 18: JM and JMbayes @ JSM2015

3.1 Joint Models in R

• Argument method specifies the type of relative risk model and the type of numericalintegration algorithm – the syntax is as follows:

<baseline hazard>-<parameterization>-<numerical integration>

Available options are:

◃ "piecewise-PH-GH": PH model with piecewise-constant baseline hazard

◃ "spline-PH-GH": PH model with B-spline-approximated log baseline hazard

◃ "weibull-PH-GH": PH model with Weibull baseline hazard

◃ "weibull-AFT-GH": AFT model with Weibull baseline hazard

◃ "Cox-PH-GH": PH model with unspecified baseline hazard

GH stands for standard Gauss-Hermite; using aGH invokes the pseudo-adaptiveGauss-Hermite rule

JM & JMbayes – August 11, 2015 17/37

Page 19: JM and JMbayes @ JSM2015

3.1 Joint Models in R

• Joint models under the Bayesian approach are fitted using functionjointModelBayes() from package JMbayes. This function works in a very similarmanner as function jointModel(), e.g.,

lmeFit <- lme(CD4 ~ obstime + obstime:drug,

random = ~ obstime | patient, data = aids)

coxFit <- coxph(Surv(Time, death) ~ drug, data = aids.id, x = TRUE)

jointFitBayes <- jointModelBayes(lmeFit, coxFit, timeVar = "obstime")

summary(jointFitBayes)

JM & JMbayes – August 11, 2015 18/37

Page 20: JM and JMbayes @ JSM2015

3.1 Joint Models in R

• JMbayes is more flexible (in some respects):

◃ directly implements the MCMC

◃ allows for categorical longitudinal data as well

◃ allows for general transformation functions

◃ penalized B-splines for the baseline hazard function

◃ . . .

JM & JMbayes – August 11, 2015 19/37

Page 21: JM and JMbayes @ JSM2015

3.1 Joint Models in R

• In both packages methods are available for the majority of the standard genericfunctions + extras

◃ summary(), anova(), vcov(), logLik()

◃ coef(), fixef(), ranef()

◃ fitted(), residuals()

◃ plot()

◃ xtable() (you need to load package xtable first)

JM & JMbayes – August 11, 2015 20/37

Page 22: JM and JMbayes @ JSM2015

4.1 Association Structures

• The standard assumption is

hi(t | Mi(t)) = h0(t) exp{γ⊤wi + αmi(t)},

yi(t) = mi(t) + εi(t)

= x⊤i (t)β + z⊤i (t)bi + εi(t),

where Mi(t) = {mi(s), 0 ≤ s < t}

JM & JMbayes – August 11, 2015 21/37

Page 23: JM and JMbayes @ JSM2015

4.1 Association structures (cont’d)

Time

0.1

0.2

0.3

0.4

hazard

0.0

0.5

1.0

1.5

2.0

0 2 4 6 8

marker

JM & JMbayes – August 11, 2015 22/37

Page 24: JM and JMbayes @ JSM2015

4.1 Association Structures (cont’d)

• The standard assumption is

hi(t | Mi(t)) = h0(t) exp{γ⊤wi + αmi(t)},

yi(t) = mi(t) + εi(t)

= x⊤i (t)β + z⊤i (t)bi + εi(t),

where Mi(t) = {mi(s), 0 ≤ s < t}

Is this the only option? Is this the most optimal forprediction?

JM & JMbayes – August 11, 2015 23/37

Page 25: JM and JMbayes @ JSM2015

4.2 Time-dependent Slopes

• The hazard for an event at t is associated with both the current value and the slopeof the trajectory at t (Ye et al., 2008, Biometrics):

hi(t | Mi(t)) = h0(t) exp{γ⊤wi + α1mi(t) + α2m′i(t)},

where

m′i(t) =

d

dt{x⊤i (t)β + z⊤i (t)bi}

JM & JMbayes – August 11, 2015 24/37

Page 26: JM and JMbayes @ JSM2015

4.2 Time-dependent Slopes (cont’d)

Time

0.1

0.2

0.3

0.4

hazard

0.0

0.5

1.0

1.5

2.0

0 2 4 6 8

marker

JM & JMbayes – August 11, 2015 25/37

Page 27: JM and JMbayes @ JSM2015

4.3 Cumulative Effects

• The hazard for an event at t is associated with area under the trajectory up to t:

hi(t | Mi(t)) = h0(t) exp{γ⊤wi + α

∫ t

0

mi(s) ds}

• Area under the longitudinal trajectory taken as a summary of Mi(t)

JM & JMbayes – August 11, 2015 26/37

Page 28: JM and JMbayes @ JSM2015

4.3 Cumulative Effects (cont’d)

Time

0.1

0.2

0.3

0.4

hazard

0.0

0.5

1.0

1.5

2.0

0 2 4 6 8

marker

JM & JMbayes – August 11, 2015 27/37

Page 29: JM and JMbayes @ JSM2015

4.4 Weighted Cumulative Effects

• The hazard for an event at t is associated with the area under the weighted trajectoryup to t:

hi(t | Mi(t)) = h0(t) exp{γ⊤wi + α

∫ t

0

ϖ(t− s)mi(s) ds},

where ϖ(·) appropriately chosen weight function, e.g.,

◃ Gaussian density

◃ Student’s-t density

◃ . . .

JM & JMbayes – August 11, 2015 28/37

Page 30: JM and JMbayes @ JSM2015

4.5 Association Structures in JM & JMbayes

• Both package give options to define the aforementioned association structures

◃ in JM via arguments parameterization & derivForm

◃ in JMbayes via arguments param & extraForm

• JMbayes also gives the option for general transformation functions, e.g.,

hi(t | Mi(t)) = h0(t) exp{γ⊤wi + α1mi(t) + α2mi(t)× Treati +

α3m′i(t) + α3(m

′i(t))

2},

JM & JMbayes – August 11, 2015 29/37

Page 31: JM and JMbayes @ JSM2015

5.1 Predictions – Definitions

• We are interested in predicting survival probabilities for a new patient j that hasprovided a set of aortic gradient measurements up to a specific time point t

• Example: We consider Patients 20 and 81 from the Aortic Valve dataset

JM & JMbayes – August 11, 2015 30/37

Page 32: JM and JMbayes @ JSM2015

5.1 Predictions – Definitions (cont’d)

Follow−up Time (years)

Aor

tic G

radi

ent (

mm

Hg)

0

2

4

6

8

10

0 5 10

Patient 200 5 10

Patient 81

JM & JMbayes – August 11, 2015 31/37

Page 33: JM and JMbayes @ JSM2015

5.1 Predictions – Definitions (cont’d)

Follow−up Time (years)

Aor

tic G

radi

ent (

mm

Hg)

0

2

4

6

8

10

2 4 6 8 10 12

Patient 202 4 6 8 10 12

Patient 81

JM & JMbayes – August 11, 2015 31/37

Page 34: JM and JMbayes @ JSM2015

5.1 Predictions – Definitions (cont’d)

Follow−up Time (years)

Aor

tic G

radi

ent (

mm

Hg)

0

2

4

6

8

10

2 4 6 8 10 12

Patient 202 4 6 8 10 12

Patient 81

JM & JMbayes – August 11, 2015 31/37

Page 35: JM and JMbayes @ JSM2015

5.1 Predictions – Definitions (cont’d)

• What do we know for these patients?

◃ a series of aortic gradient measurements

◃ patient are event-free up to the last measurement

• Dynamic Prediction survival probabilities are dynamically updated as additionallongitudinal information is recorded

JM & JMbayes – August 11, 2015 32/37

Page 36: JM and JMbayes @ JSM2015

5.2 Predictions – JM & JMbayes

• Individualized predictions of survival probabilities are computed by functionsurvfitJM() – for example, for Patient 2 from the PBC dataset we have

sfit <- survfitJM(jointFit, newdata = pbc2[pbc2$id == "2", ])

sfit

plot(sfit)

plot(sfit, include.y = TRUE)

JM & JMbayes – August 11, 2015 33/37

Page 37: JM and JMbayes @ JSM2015

5.3 Dyn. Predictions – Illustration

Follow−up Time (years)

Aor

tic G

radi

ent (

mm

Hg)

0

2

4

6

8

10

0 5 10

Patient 200 5 10

Patient 81

JM & JMbayes – August 11, 2015 34/37

Page 38: JM and JMbayes @ JSM2015

5.3 Dyn. Predictions – Illustration (cont’d)

0 5 10 15

02

46

810

12

Time

Patient 20

0.0

0.2

0.4

0.6

0.8

1.0

Aor

tic G

radi

ent (

mm

Hg)

0 5 10 15

02

46

810

12

Time

0.0

0.2

0.4

0.6

0.8

1.0

Patient 81

Re−

Ope

ratio

n−F

ree

Sur

viva

l

JM & JMbayes – August 11, 2015 35/37

Page 39: JM and JMbayes @ JSM2015

5.3 Dyn. Predictions – Illustration (cont’d)

0 5 10 15

02

46

810

12

Time

Patient 20

0.0

0.2

0.4

0.6

0.8

1.0

Aor

tic G

radi

ent (

mm

Hg)

0 5 10 15

02

46

810

12

Time

0.0

0.2

0.4

0.6

0.8

1.0

Patient 81

Re−

Ope

ratio

n−F

ree

Sur

viva

l

JM & JMbayes – August 11, 2015 35/37

Page 40: JM and JMbayes @ JSM2015

5.3 Dyn. Predictions – Illustration (cont’d)

0 5 10 15

02

46

810

12

Time

Patient 20

0.0

0.2

0.4

0.6

0.8

1.0

Aor

tic G

radi

ent (

mm

Hg)

0 5 10 15

02

46

810

12

Time

0.0

0.2

0.4

0.6

0.8

1.0

Patient 81

Re−

Ope

ratio

n−F

ree

Sur

viva

l

JM & JMbayes – August 11, 2015 35/37

Page 41: JM and JMbayes @ JSM2015

5.3 Prediction Survival – Illustration (cont’d)

0 5 10 15

02

46

810

12

Time

Patient 20

0.0

0.2

0.4

0.6

0.8

1.0

Aor

tic G

radi

ent (

mm

Hg)

0 5 10 15

02

46

810

12

Time

0.0

0.2

0.4

0.6

0.8

1.0

Patient 81

Re−

Ope

ratio

n−F

ree

Sur

viva

l

JM & JMbayes – August 11, 2015 35/37

Page 42: JM and JMbayes @ JSM2015

5.3 Dyn. Predictions – Illustration (cont’d)

0 5 10 15

02

46

810

12

Time

Patient 20

0.0

0.2

0.4

0.6

0.8

1.0

Aor

tic G

radi

ent (

mm

Hg)

0 5 10 15

02

46

810

12

Time

0.0

0.2

0.4

0.6

0.8

1.0

Patient 81

Re−

Ope

ratio

n−F

ree

Sur

viva

l

JM & JMbayes – August 11, 2015 35/37

Page 43: JM and JMbayes @ JSM2015

5.3 Dyn. Predictions – Illustration (cont’d)

0 5 10 15

02

46

810

12

Time

Patient 20

0.0

0.2

0.4

0.6

0.8

1.0

Aor

tic G

radi

ent (

mm

Hg)

0 5 10 15

02

46

810

12

Time

0.0

0.2

0.4

0.6

0.8

1.0

Patient 81

Re−

Ope

ratio

n−F

ree

Sur

viva

l

JM & JMbayes – August 11, 2015 35/37

Page 44: JM and JMbayes @ JSM2015

6. Resources

• JM

◃ JSS paper (http://www.jstatsoft.org/v35/i09/)

◃ book for joint models (http://jmr.r-forge.r-project.org/)

• JMbayes

◃ JSS paper (http://arxiv.org/abs/1404.7625; to appear)

JM & JMbayes – August 11, 2015 36/37

Page 45: JM and JMbayes @ JSM2015

Thank you for your attention!

JM & JMbayes – August 11, 2015 37/37