class: left, top, title-slide
Analysis of Multi-level Data
(and more)
Nicole Erler
Department of Biostatistics, Erasmus MC
n.erler@erasmusmc.nl
N_Erler
NErler
https://nerler.com
--- count: false layout: true <div class="my-footer"><span> <a href="https://twitter.com/N_Erler"><i class="fab fa-twitter"></i> N_Erler</a>      <a href="https://github.com/NErler"><i class="fab fa-github"></i> NErler</a>      <a href = "https://nerler.com"><i class="fas fa-globe-americas"></i> nerler.com</a> </span></div> --- count: false ## Example [ <img src="JHep.png" width="100%" style="display: block; margin: auto;" /> ](https://doi.org/10.1016/j.jhep.2020.03.029) ??? For this journal club: - motivating paper - deeper look into the methods - see what the authors have done - explain the related topics - focus on longitudinal data analysis --- ## Data * n = 1093 patients who - had cirrhosis, - were listed or eligible for listing for liver transplantation, - were seen as an outpatient for clinical care. * 8 liver transplant centers **Outcome:** Waitlist mortality (death / de-listing because too sick for LTx) -- **Covariate of interest:** Frailty   .sgrey[⇨ Liver Frailty Index]<br> * measured at enrolment and every subsequent ambulatory clinic visit * 3 tests combined into one continuous score (LFI) * higher LFI ⇨ more frail --- ## Statistical Analysis (I) **Multilevel mixed-effects linear regression**<br> ⇨ 2 levels (participant & visit) to take into account correlation ??? <blockquote> We used multilevel mixed-effects linear regression to model longitudinal data from each clinic visit and predict ΔLFI per 3 months.<br><br> Each participant could contribute multiple observations. <br><br> We structured the model with 2 levels (participant and visit), nesting the longitudinal visit-level observations within the participant to address correlation. </blockquote> - - - -- **Fixed effects:** * baseline age, gender, MELD Na, ascites, hepatic encephalopathy, time of measurement * selected *a priori*, irrespective of significance   <i class="fas fa-thumbs-up" style = "color: var(--nord8)"></i> ??? <blockquote> Baseline age, gender, MELD-Na, ascites, and hepatic encephalopathy were modeled as fixed effects.<br><br> These characteristics were selected a priori and included in the multivariable model, regardless of statistical significance, given their biologically plausible association with frailty. </blockquote> - - - -- **Random effects:** * participant * follow-up time ⇨ correlated ??? <blockquote> Participant and follow-up time were modeled as random effects to allow for random intercepts and random slopes, respectively.<br><br> The random intercepts and slopes were allowed to be correlated to accommodate, for example, those with greater baseline frailty worsening more quickly.<br><br> We addressed varying time between LFI observations by including the actual time of the measurement (from baseline to each LFI assessment) as a predictor in the mixed-effects model. This allowed the model to account for differences in timing of LFI measurements. </blockquote> - - - -- name: stats-I <ul class = "arrowlist"> <li>Calculate patient specific predicted/estimated baseline LFI & \(\Delta\)LFI.</li> <li>Categorize \(\Delta\)LFI into "improved", "stable", "moderate worsening", "worsening".</li> </ul> ??? <blockquote> From the multivariable mixed-effects model, we calculated the predicted intercept (baseline LFI) and slope (ΔLFI) per 3 months for each participant, to facilitate clinical interpretation of the data and for the purposes of visual presentation.<br><br> Higher positive ΔLFI values reflected more rapid frailty progression, positive ΔLFI values closer to 0 reflected slower frailty progression, and negative ΔLFI values reflected improving frailty.<br><br> We categorized ΔLFI into 4 categories: improved, stable, moderate worsening, and severe worsening. These categories were initially based on quartiles of ΔLFI slopes in this cohort.<br><br> [...] </blockquote> --- name: stats-II-1 ## Statistical Analysis (II) **Cumulative Incidence** of waitlist mortality per `\(\Delta\)`LFI category ??? <blockquote> To evaluate the impact of baseline LFI and predicted ΔLFI on risk of waitlist mortality, we estimated the cumulative incidence of waitlist mortality within 3-, 6-, and 12-months of study entry by ΔLFI category. </blockquote> -- name: stats-II-2 **Fine & Gray competing risk model** to estimate association waitlist mortality with covariates * **event of interest**: death or de-listing because too sick * **competing risk**: deceased donor liver transplant * **censoring** at time of living donor transplant or de-listing for other reasons ??? <blockquote> Then we modeled the cumulative incidence function with Fine and Gray competing risk regressions to estimate the risk of waitlist mortality associated with each variable.<br><br> Risk estimates were described as subhazard ratios (sHR) with 95% CIs.<br><br> In these competing risk models, waitlist mortality was defined as a death or delisting; deceased donor liver transplant was treated as the competing risk. [...] </blockquote> -- <br> * Selection of covariates other than MELD-Na based on univariable models (p < 0.1) and backward elimination   <i class="fas fa-frown" style = "color: var(--nord8)"></i> ??? <blockquote> For the multivariable regression, all variables associated with waitlist mortality with a p value of <0.1 in univariable analysis were evaluated for inclusion in the final multivariable model.<br><br> Backwards elimination was then performed to derive the final multivariable model which included only variables associated with a p value <0.05 and MELD-Na due to the biologically plausible association with waitlist mortality.<br><br> [...] </blockquote> -- Differences in MELD-Na regression coefficients were compared between models with and without LFI and `\(\Delta\)`LFI using **bootstrap** methods. ??? <blockquote> To determine if the MELD-Na sHR changed significantly after adjusting for LFI, differences in MELD-Na regression coefficients were compared between models with and without LFI and ΔLFI using bootstrap methods (100 replications). </blockquote> --- ## Data (Simulated) <img src="index_files/figure-html/unnamed-chunk-3-1.png" width="100%" style="display: block; margin: auto;" /> ??? * Simulated data based on the description of the data in the results section * repeated measurements over time * exact time of measurement, not visit number * **unbalanced** data ⇨ different number of measurements at different times --- ## Data (Simulated) <img src="index_files/figure-html/unnamed-chunk-4-1.png" width="100%" style="display: block; margin: auto;" /> --- ## Mixed (Effects) Model * contains both **fixed** and **random** effects **Linear Mixed Model** `$$y_{ij} = \underset{\text{fixed effects}}{\underbrace{\beta_0 + \beta_1 \text{time}_{ij} + \beta_2 \text{age}_i + \ldots}} + \underset{\text{random effects}}{\underbrace{b_{0i} + b_{1i} \text{time}_{ij}}} + \varepsilon_{ij}, \quad \substack{i = 1, \ldots, n\\j = 1,\ldots, n_i}$$` ??? Mixed model = Mixed effects model = random effects model Extension of (generalized) linear regression model that additionally includes random effects to take into account that observations are not independent of each other. -- `$$\begin{pmatrix}b_{0i}\\b_{1i}\end{pmatrix} \sim N(\mathbf 0, \mathbf D) \qquad \varepsilon_{ij} \sim N(0, \sigma^2)$$` * `\(b_{0i}\)`: random intercept * `\(b_{1i}\)`: random slope * `\(\mathbf D\)`: variance-covariance matrix ??? * random intercept and slope (random effect of time) are unobserved * assumed to be jointly normally distributed with mean zero --- ## Fixed & Random Effects <img src="index_files/figure-html/unnamed-chunk-5-1.png" width="100%" style="display: block; margin: auto;" /> ??? * Fixed effects describe population average fit. (same in each panel) * Random effects deviation of subject-specific fit from population average. We ignore other covariates here for now. --- ## Fixed & Random Effects <img src="index_files/figure-html/unnamed-chunk-6-1.png" width="100%" style="display: block; margin: auto;" /> ??? Here: zoom in, look at different elements * fixed effects intercept, `\(\beta_0\)`, point where population regression line crosses the `\(y\)`-axis --- ## Fixed & Random Effects <img src="index_files/figure-html/unnamed-chunk-7-1.png" width="100%" style="display: block; margin: auto;" /> ??? random intercept: deviation of subject-specific regression line at baseline to population line * ⇨ subject-specific line crosses `\(y\)`-axis at `\(\beta_0 + b_{0i}\)` * subject with lower values than the population average: negative random intercept --- ## Fixed & Random Effects <img src="index_files/figure-html/unnamed-chunk-8-1.png" width="100%" style="display: block; margin: auto;" /> ??? * effect of time ($\beta_1$) is slope of population regression line ("difference in `\(y\)` for a 1-unit change in time") * corresponding random effect in this special case called random slope * deviation of subject-specific slope from population slope * slope of subject-specific regression line is `\(\beta_1 + b_{1i}\)` -- <div style = "position: absolute; bottom: 450px; left: 200px; font-size: 10pt;"> \(\color{var(--nord10)}{\hat y = \beta_0 + \beta_1 \text{time}_{ij}} \color{var(--nord3)}{+ \ldots \text{(covariates)}\ldots}\) </div> <div style = "position: absolute; bottom: 250px; left: 200px; font-size: 10pt;"> \(\color{var(--nord15)}{\hat y = (\beta_0 + b_0) + (\beta_1 + b_1)\ \text{time}_{ij}} \color{var(--nord3)}{+ \ldots \text{(covariates)}\ldots}\) </div> --- ## Random Effects <img src="index_files/figure-html/unnamed-chunk-9-1.png" width="100%" style="display: block; margin: auto;" /> ??? What are the implied assumptions of the random intercept and slope with regards to the outcome trajectories? * random intercept only: subject-specific trajectories are randomly shifted on y-axis * random slope: slope randomly varies How much variation? &$8680; described by a normal distribution with mean 0 --- ## Distribution of the Random Effects Random effects are unobserved and assumed to be normally distributed `$$\begin{pmatrix}b_{0i}\\b_{1i}\end{pmatrix} \sim N(\mathbf 0, \mathbf D)$$` with **variance-covariance matrix** `$$\mathbf D = \begin{pmatrix}d_{1}^2 & d_{12}\\d_{12} & d_{2}^2\end{pmatrix}$$` <br> ⇨ Correlation between intercept and slope: `\(\rho = \frac{d_{12}}{d_1 d_2}\)` ??? * Bivariate normal distribution * not variance but variance-covariance matrix * variance-covariance matrix has the variances on the diagonal and the covariances on the off-diagonal Can be expressed in terms of correlation. Different correlation will result in different patterns of the trajectories. --- ## Random Effects Correlation <img src="index_files/figure-html/unnamed-chunk-10-1.png" width="100%" style="display: block; margin: auto;" /> --- ## Effects of Covariates `$$y_{ij} = \underset{\text{fixed effects}}{\underbrace{\beta_0 + \beta_1 \text{time}_{ij} + \bbox[#3B4252, 2pt]{\beta_2 \text{sex}_i}}} + \underset{\text{random effects}}{\underbrace{b_{0i} + b_{1i} \text{time}_{ij}}} + \varepsilon_{ij}$$` <img src="index_files/figure-html/unnamed-chunk-12-1.png" width="100%" style="display: block; margin: auto;" /> --- ## Effects of Covariates `$$y_{ij} = \underset{\text{fixed effects}}{\underbrace{\beta_0 + \beta_1 \text{time}_{ij} + \bbox[#3B4252, 2pt]{\beta_2 \text{sex}_i + \beta_3 \text{sex}_i \text{time}_{ij}}}} + \underset{\text{random effects}}{\underbrace{b_{0i} + b_{1i} \text{time}_{ij}}} + \varepsilon_{ij}$$` <img src="index_files/figure-html/unnamed-chunk-13-1.png" width="100%" style="display: block; margin: auto;" /> --- ## Effects of Time-varying Covariates `$$y_{ij} = \underset{\text{fixed effects}}{\underbrace{\beta_0 + \beta_1 \text{time}_{ij} + \bbox[#3B4252, 2pt]{\beta_2 \text{BMI}_{\color{var(--nord8)}{ij}}}}} + \underset{\text{random effects}}{\underbrace{b_{0i} + b_{1i} \text{time}_{ij}}} + \varepsilon_{ij}$$` <img src="index_files/figure-html/unnamed-chunk-15-1.png" width="100%" style="display: block; margin: auto;" /> --- ## Effects of Time-varying Covariates `$$y_{ij} = \underset{\text{fixed effects}}{\underbrace{\beta_0 + \beta_1 \text{time}_{ij} + \bbox[#3B4252, 2pt]{\beta_2 \text{BMI}_{\color{var(--nord8)}{ij}} + \beta_3 \text{BMI}_{\color{var(--nord8)}{ij}}\text{time}_{ij}}}} + \underset{\text{random effects}}{\underbrace{b_{0i} + b_{1i} \text{time}_{ij}}} + \varepsilon_{ij}$$` <img src="index_files/figure-html/unnamed-chunk-16-1.png" width="100%" style="display: block; margin: auto;" /> --- ## Predicted Intercept & Slope .pull-left[ <img src="index_files/figure-html/unnamed-chunk-17-1.png" width="100%" style="display: block; margin: auto;" /> ] .pull-right[ <img src="index_files/figure-html/unnamed-chunk-18-1.png" width="100%" style="display: block; margin: auto;" /> ] --- ## Predicted Intercept & Slope <img src="index_files/figure-html/unnamed-chunk-19-1.png" width="100%" style="display: block; margin: auto;" /> --- ## Results from the Paper .flex-grid[ .col[ <table class=" simpletable" style="width: auto !important; margin-left: auto; margin-right: auto;"> <thead> <tr> <th style="empty-cells: hide;border-bottom:hidden;" colspan="2"></th> <th style="border-bottom:hidden;padding-bottom:0; padding-left:3px;padding-right:3px;text-align: center; " colspan="2"><div style="border-bottom: 1px solid #ddd; padding-bottom: 5px; ">median (IQR)</div></th> </tr> <tr> <th style="text-align:left;"> </th> <th style="text-align:left;"> n </th> <th style="text-align:left;"> # visits </th> <th style="text-align:left;"> days between visits </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> severe </td> <td style="text-align:left;"> 284 </td> <td style="text-align:left;"> 2 (1–4) </td> <td style="text-align:left;"> 112 days (91–179) </td> </tr> <tr> <td style="text-align:left;"> moderate </td> <td style="text-align:left;"> 252 </td> <td style="text-align:left;"> 1 (1–2) </td> <td style="text-align:left;"> 112 days (91–161) </td> </tr> <tr> <td style="text-align:left;"> stable </td> <td style="text-align:left;"> 38 </td> <td style="text-align:left;"> 2 (1–2) </td> <td style="text-align:left;"> 119 days (97–175) </td> </tr> <tr> <td style="text-align:left;"> improved </td> <td style="text-align:left;"> 170 </td> <td style="text-align:left;"> 4 (3–6) </td> <td style="text-align:left;"> 168 days (116–210) </td> </tr> </tbody> </table> ] .col[ <table class=" simpletable" style="width: auto !important; margin-left: auto; margin-right: auto;"> <thead> <tr> <th style="empty-cells: hide;border-bottom:hidden;" colspan="2"></th> <th style="border-bottom:hidden;padding-bottom:0; padding-left:3px;padding-right:3px;text-align: center; " colspan="1"><div style="border-bottom: 1px solid #ddd; padding-bottom: 5px; ">median (IQR)</div></th> </tr> <tr> <th style="text-align:left;"> </th> <th style="text-align:left;"> n </th> <th style="text-align:left;"> # visits </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> died/delisted </td> <td style="text-align:left;"> 223 </td> <td style="text-align:left;"> 2 (1–3) </td> </tr> <tr> <td style="text-align:left;"> other </td> <td style="text-align:left;"> 870 </td> <td style="text-align:left;"> 2 (1–4) </td> </tr> </tbody> </table> ] ] ??? median (IQR) number of visits differed significantly by ΔLFI group: * 2 (1–4) for the severe worsening * 1 (1–2) for the slight worsening * 2 (1–2) for the stable * 4 (3–6) for the improved median (IQR) number of days between visits (among those with >1 LFI assessment) * 112 days (91–179) for steep worsening, * 112 days (91–161) for moderate worsening, * 119 days (97–175) for stable and * 168 days (116–210) for improved (p <0.001). Participants who died/delisted vs. other waitlist outcomes had a similar median number of visits (2 (1–3) vs. 2 (1–4), p = 0.55). -- <br> .warning[ <i class="fas fa-exclamation-triangle" style = "color: var(--nord11)"></i> Beware of Missing Not At Random! <i class="fas fa-exclamation-triangle" style = "color: var(--nord11)"></i> ] --- template: stats-I --- ## Statistical Analysis (II) **Cumulative Incidence** of waitlist mortality per `\(\Delta\)`LFI category <span style = "color:var(--nord11); font-weight: 700;">⇨ How???</span> -- **Remember...** <div style = "position: relative; bottom: 60px; left: 120px;">
</div> -- <div style = "position: absolute; left: 60px; bottom: 200px;"> <strong>⇨ Aalen-Johansen<br>estimator</strong> </div> --- template: stats-II-2 .box[ **Fine-Grey Model:** * model for the cumulative incidence function * *sub-distribution* hazard instead of *cause-specific* hazard * person failing from other cause remain in the risk set * PH assumption for the sub-distribution hazard ] --- ## Bootstrap .pull-left[ <table class=" bstab" style="width: auto !important; margin-left: auto; margin-right: auto;"> <thead><tr> <th style="empty-cells: hide;border-bottom:hidden;" colspan="1"></th> <th style="border-bottom:hidden;padding-bottom:0; padding-left:3px;padding-right:3px;text-align: center; " colspan="1"><div style="border-bottom: 1px solid #ddd; padding-bottom: 5px; ">original</div></th> <th style="empty-cells: hide;border-bottom:hidden;" colspan="1"></th> <th style="border-bottom:hidden;padding-bottom:0; padding-left:3px;padding-right:3px;text-align: center; " colspan="6"><div style="border-bottom: 1px solid #ddd; padding-bottom: 5px; ">bootstrap samples</div></th> </tr></thead> <tbody> <tr> <td style="text-align:left;"> </td> <td style="text-align:center;background-color: var(--nord0) !important;"> 1 </td> <td style="text-align:center;"> </td> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> ... </td> </tr> <tr> <td style="text-align:left;"> </td> <td style="text-align:center;background-color: var(--nord0) !important;"> 2 </td> <td style="text-align:center;"> </td> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> ... </td> </tr> <tr> <td style="text-align:left;"> </td> <td style="text-align:center;background-color: var(--nord0) !important;"> 3 </td> <td style="text-align:center;"> </td> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> ... </td> </tr> <tr> <td style="text-align:left;"> </td> <td style="text-align:center;background-color: var(--nord0) !important;"> 4 </td> <td style="text-align:center;"> </td> <td style="text-align:center;"> 5 </td> <td style="text-align:center;"> 4 </td> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> ... </td> </tr> <tr> <td style="text-align:left;"> </td> <td style="text-align:center;background-color: var(--nord0) !important;"> 5 </td> <td style="text-align:center;"> </td> <td style="text-align:center;"> 5 </td> <td style="text-align:center;"> 4 </td> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> ... </td> </tr> <tr> <td style="text-align:left;"> </td> <td style="text-align:center;background-color: var(--nord0) !important;"> 6 </td> <td style="text-align:center;"> </td> <td style="text-align:center;"> 6 </td> <td style="text-align:center;"> 8 </td> <td style="text-align:center;"> 7 </td> <td style="text-align:center;"> 7 </td> <td style="text-align:center;"> 4 </td> <td style="text-align:center;"> ... </td> </tr> <tr> <td style="text-align:left;"> </td> <td style="text-align:center;background-color: var(--nord0) !important;"> 7 </td> <td style="text-align:center;"> </td> <td style="text-align:center;"> 6 </td> <td style="text-align:center;"> 9 </td> <td style="text-align:center;"> 8 </td> <td style="text-align:center;"> 8 </td> <td style="text-align:center;"> 5 </td> <td style="text-align:center;"> ... </td> </tr> <tr> <td style="text-align:left;"> </td> <td style="text-align:center;background-color: var(--nord0) !important;"> 8 </td> <td style="text-align:center;"> </td> <td style="text-align:center;"> 7 </td> <td style="text-align:center;"> 9 </td> <td style="text-align:center;"> 8 </td> <td style="text-align:center;"> 9 </td> <td style="text-align:center;"> 8 </td> <td style="text-align:center;"> ... </td> </tr> <tr> <td style="text-align:left;"> </td> <td style="text-align:center;background-color: var(--nord0) !important;"> 9 </td> <td style="text-align:center;"> </td> <td style="text-align:center;"> 8 </td> <td style="text-align:center;"> 9 </td> <td style="text-align:center;"> 9 </td> <td style="text-align:center;"> 9 </td> <td style="text-align:center;"> 8 </td> <td style="text-align:center;"> ... </td> </tr> <tr> <td style="text-align:left;"> </td> <td style="text-align:center;background-color: var(--nord0) !important;"> 10 </td> <td style="text-align:center;"> </td> <td style="text-align:center;"> 10 </td> <td style="text-align:center;"> 10 </td> <td style="text-align:center;"> 9 </td> <td style="text-align:center;"> 10 </td> <td style="text-align:center;"> 9 </td> <td style="text-align:center;"> ... </td> </tr> <tr> <td style="text-align:left;"> </td> <td style="text-align:center;background-color: var(--nord0) !important;"> </td> <td style="text-align:center;"> </td> <td style="text-align:center;"> </td> <td style="text-align:center;"> </td> <td style="text-align:center;"> </td> <td style="text-align:center;"> </td> <td style="text-align:center;"> </td> <td style="text-align:center;"> </td> </tr> <tr> <td style="text-align:left;"> mean </td> <td style="text-align:center;background-color: var(--nord0) !important;"> 5.5 </td> <td style="text-align:center;"> </td> <td style="text-align:center;"> 5.1 </td> <td style="text-align:center;"> 5.8 </td> <td style="text-align:center;"> 5 </td> <td style="text-align:center;"> 5.2 </td> <td style="text-align:center;"> 4.4 </td> <td style="text-align:center;"> ... </td> </tr> </tbody> </table> ] .pull-right[ <br><br><br> ⇨ 95% bootstrap CI:<br> 2.5% and 97.5% quantile of the means from the bootstrap samples ] --- class: the-end, center, middle layout: true count: false # Thank you for your attention! <div class="contact"> <i class="fas fa-envelope"></i> <a href="mailto:n.erler@erasmusmc.nl" class="email">n.erler@erasmusmc.nl</a>  <a href="https://twitter.com/N_Erler" target="_blank"><i class="fab fa-twitter"></i> N_Erler</a>  <a href="https://github.com/NErler" target="_blank"><i class="fab fa-github"></i> NErler</a>  <a href="https://nerler.com" target="_blank"><i class="fas fa-globe-americas"></i> https://nerler.com</a> </div> ---