fitting joint models in r using packages jm and jmbayes · fitting joint models in r using packages...

43
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: others

Post on 22-Oct-2019

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Fitting Joint Models in R using Packages JM and JMbayes · Fitting Joint Models in R using Packages JM and JMbayes Dimitris Rizopoulos Department of Biostatistics, Erasmus Medical

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: Fitting Joint Models in R using Packages JM and JMbayes · Fitting Joint Models in R using Packages JM and JMbayes Dimitris Rizopoulos Department of Biostatistics, Erasmus Medical

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/35

Page 3: Fitting Joint Models in R using Packages JM and JMbayes · Fitting Joint Models in R using Packages JM and JMbayes Dimitris Rizopoulos Department of Biostatistics, Erasmus Medical

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/35

Page 4: Fitting Joint Models in R using Packages JM and JMbayes · Fitting Joint Models in R using Packages JM and JMbayes Dimitris Rizopoulos Department of Biostatistics, Erasmus Medical

1.3 Research Questions

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

• 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/35

Page 5: Fitting Joint Models in R using Packages JM and JMbayes · Fitting Joint Models in R using Packages JM and JMbayes Dimitris Rizopoulos Department of Biostatistics, Erasmus Medical

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/35

Page 6: Fitting Joint Models in R using Packages JM and JMbayes · Fitting Joint Models in R using Packages JM and JMbayes Dimitris Rizopoulos Department of Biostatistics, Erasmus Medical

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/35

Page 7: Fitting Joint Models in R using Packages JM and JMbayes · Fitting Joint Models in R using Packages JM and JMbayes Dimitris Rizopoulos Department of Biostatistics, Erasmus Medical

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/35

Page 8: Fitting Joint Models in R using Packages JM and JMbayes · Fitting Joint Models in R using Packages JM and JMbayes Dimitris Rizopoulos Department of Biostatistics, Erasmus Medical

1.4 Goals (cont’d)

• Goals of this talk:

◃ Introduce joint models

* definition

* association structures

* dynamic predictions

◃ Illustrate software capabilities in R

JM & JMbayes – August 11, 2015 7/35

Page 9: Fitting Joint Models in R using Packages JM and JMbayes · Fitting Joint Models in R using Packages JM and JMbayes Dimitris Rizopoulos Department of Biostatistics, Erasmus Medical

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/35

Page 10: Fitting Joint Models in R using Packages JM and JMbayes · Fitting Joint Models in R using Packages JM and JMbayes Dimitris Rizopoulos Department of Biostatistics, Erasmus Medical

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/35

Page 11: Fitting Joint Models in R using Packages JM and JMbayes · Fitting Joint Models in R using Packages JM and JMbayes Dimitris Rizopoulos Department of Biostatistics, Erasmus Medical

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/35

Page 12: Fitting Joint Models in R using Packages JM and JMbayes · Fitting Joint Models in R using Packages JM and JMbayes Dimitris Rizopoulos Department of Biostatistics, Erasmus Medical

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/35

Page 13: Fitting Joint Models in R using Packages JM and JMbayes · Fitting Joint Models in R using Packages JM and JMbayes Dimitris Rizopoulos Department of Biostatistics, Erasmus Medical

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/35

Page 14: Fitting Joint Models in R using Packages JM and JMbayes · Fitting Joint Models in R using Packages JM and JMbayes Dimitris Rizopoulos Department of Biostatistics, Erasmus Medical

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/35

Page 15: Fitting Joint Models in R using Packages JM and JMbayes · Fitting Joint Models in R using Packages JM and JMbayes Dimitris Rizopoulos Department of Biostatistics, Erasmus Medical

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/35

Page 16: Fitting Joint Models in R using Packages JM and JMbayes · Fitting Joint Models in R using Packages JM and JMbayes Dimitris Rizopoulos Department of Biostatistics, Erasmus Medical

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/35

Page 17: Fitting Joint Models in R using Packages JM and JMbayes · Fitting Joint Models in R using Packages JM and JMbayes Dimitris Rizopoulos Department of Biostatistics, Erasmus Medical

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 16/35

Page 18: Fitting Joint Models in R using Packages JM and JMbayes · Fitting Joint Models in R using Packages JM and JMbayes Dimitris Rizopoulos Department of Biostatistics, Erasmus Medical

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 17/35

Page 19: Fitting Joint Models in R using Packages JM and JMbayes · Fitting Joint Models in R using Packages JM and JMbayes Dimitris Rizopoulos Department of Biostatistics, Erasmus Medical

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 18/35

Page 20: Fitting Joint Models in R using Packages JM and JMbayes · Fitting Joint Models in R using Packages JM and JMbayes Dimitris Rizopoulos Department of Biostatistics, Erasmus Medical

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 19/35

Page 21: Fitting Joint Models in R using Packages JM and JMbayes · Fitting Joint Models in R using Packages JM and JMbayes Dimitris Rizopoulos Department of Biostatistics, Erasmus Medical

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 20/35

Page 22: Fitting Joint Models in R using Packages JM and JMbayes · Fitting Joint Models in R using Packages JM and JMbayes Dimitris Rizopoulos Department of Biostatistics, Erasmus Medical

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 21/35

Page 23: Fitting Joint Models in R using Packages JM and JMbayes · Fitting Joint Models in R using Packages JM and JMbayes Dimitris Rizopoulos Department of Biostatistics, Erasmus Medical

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 22/35

Page 24: Fitting Joint Models in R using Packages JM and JMbayes · Fitting Joint Models in R using Packages JM and JMbayes Dimitris Rizopoulos Department of Biostatistics, Erasmus Medical

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 23/35

Page 25: Fitting Joint Models in R using Packages JM and JMbayes · Fitting Joint Models in R using Packages JM and JMbayes Dimitris Rizopoulos Department of Biostatistics, Erasmus Medical

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 24/35

Page 26: Fitting Joint Models in R using Packages JM and JMbayes · Fitting Joint Models in R using Packages JM and JMbayes Dimitris Rizopoulos Department of Biostatistics, Erasmus Medical

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 25/35

Page 27: Fitting Joint Models in R using Packages JM and JMbayes · Fitting Joint Models in R using Packages JM and JMbayes Dimitris Rizopoulos Department of Biostatistics, Erasmus Medical

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 26/35

Page 28: Fitting Joint Models in R using Packages JM and JMbayes · Fitting Joint Models in R using Packages JM and JMbayes Dimitris Rizopoulos Department of Biostatistics, Erasmus Medical

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 27/35

Page 29: Fitting Joint Models in R using Packages JM and JMbayes · Fitting Joint Models in R using Packages JM and JMbayes Dimitris Rizopoulos Department of Biostatistics, Erasmus Medical

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 28/35

Page 30: Fitting Joint Models in R using Packages JM and JMbayes · Fitting Joint Models in R using Packages JM and JMbayes Dimitris Rizopoulos Department of Biostatistics, Erasmus Medical

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 29/35

Page 31: Fitting Joint Models in R using Packages JM and JMbayes · Fitting Joint Models in R using Packages JM and JMbayes Dimitris Rizopoulos Department of Biostatistics, Erasmus Medical

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 29/35

Page 32: Fitting Joint Models in R using Packages JM and JMbayes · Fitting Joint Models in R using Packages JM and JMbayes Dimitris Rizopoulos Department of Biostatistics, Erasmus Medical

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 29/35

Page 33: Fitting Joint Models in R using Packages JM and JMbayes · Fitting Joint Models in R using Packages JM and JMbayes Dimitris Rizopoulos Department of Biostatistics, Erasmus Medical

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 30/35

Page 34: Fitting Joint Models in R using Packages JM and JMbayes · Fitting Joint Models in R using Packages JM and JMbayes Dimitris Rizopoulos Department of Biostatistics, Erasmus Medical

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 31/35

Page 35: Fitting Joint Models in R using Packages JM and JMbayes · Fitting Joint Models in R using Packages JM and JMbayes Dimitris Rizopoulos Department of Biostatistics, Erasmus Medical

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 32/35

Page 36: Fitting Joint Models in R using Packages JM and JMbayes · Fitting Joint Models in R using Packages JM and JMbayes Dimitris Rizopoulos Department of Biostatistics, Erasmus Medical

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 32/35

Page 37: Fitting Joint Models in R using Packages JM and JMbayes · Fitting Joint Models in R using Packages JM and JMbayes Dimitris Rizopoulos Department of Biostatistics, Erasmus Medical

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 32/35

Page 38: Fitting Joint Models in R using Packages JM and JMbayes · Fitting Joint Models in R using Packages JM and JMbayes Dimitris Rizopoulos Department of Biostatistics, Erasmus Medical

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 32/35

Page 39: Fitting Joint Models in R using Packages JM and JMbayes · Fitting Joint Models in R using Packages JM and JMbayes Dimitris Rizopoulos Department of Biostatistics, Erasmus Medical

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 32/35

Page 40: Fitting Joint Models in R using Packages JM and JMbayes · Fitting Joint Models in R using Packages JM and JMbayes Dimitris Rizopoulos Department of Biostatistics, Erasmus Medical

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 32/35

Page 41: Fitting Joint Models in R using Packages JM and JMbayes · Fitting Joint Models in R using Packages JM and JMbayes Dimitris Rizopoulos Department of Biostatistics, Erasmus Medical

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)

# shiny app in JMbayes

JMbayes::runDynPred()

JM & JMbayes – August 11, 2015 33/35

Page 42: Fitting Joint Models in R using Packages JM and JMbayes · Fitting Joint Models in R using Packages JM and JMbayes Dimitris Rizopoulos Department of Biostatistics, Erasmus Medical

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 34/35

Page 43: Fitting Joint Models in R using Packages JM and JMbayes · Fitting Joint Models in R using Packages JM and JMbayes Dimitris Rizopoulos Department of Biostatistics, Erasmus Medical

Thank you for your attention!

JM & JMbayes – August 11, 2015 35/35