class: center, middle, inverse, title-slide .title[ # LECTURE 16: repeated measures ] .subtitle[ ## FANR 6750 (Experimental design) ] .author[ ###
Fall 2022 ] --- # outline <br/> 1) Motivation <br/> -- 2) Split-plot with adjustments <br/> -- 3) MANOVA --- # motivation <br/> #### Suppose we want to test the effect of fertilizer on plant growth (number of leaves) <br/> -- #### We assign each of 10 plants to one of two treatments: low fertilizer and high fertilizer <br/> -- #### How should we measure the response of each plant to the treatment? --- # plant data <table> <thead> <tr> <th style="empty-cells: hide;border-bottom:hidden;" colspan="1"></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="5"><div style="border-bottom: 1px solid #ddd; padding-bottom: 5px; ">Leaves</div></th> </tr> <tr> <th style="text-align:right;"> Plant </th> <th style="text-align:left;"> Fertilizer </th> <th style="text-align:right;"> Week 1 </th> <th style="text-align:right;"> Week 2 </th> <th style="text-align:right;"> Week 3 </th> <th style="text-align:right;"> Week 4 </th> <th style="text-align:right;"> Week 5 </th> </tr> </thead> <tbody> <tr> <td style="text-align:right;"> 1 </td> <td style="text-align:left;"> Low </td> <td style="text-align:right;"> 4 </td> <td style="text-align:right;"> 5 </td> <td style="text-align:right;"> 6 </td> <td style="text-align:right;"> 8 </td> <td style="text-align:right;"> 10 </td> </tr> <tr> <td style="text-align:right;"> 2 </td> <td style="text-align:left;"> Low </td> <td style="text-align:right;"> 3 </td> <td style="text-align:right;"> 4 </td> <td style="text-align:right;"> 6 </td> <td style="text-align:right;"> 6 </td> <td style="text-align:right;"> 9 </td> </tr> <tr> <td style="text-align:right;"> 3 </td> <td style="text-align:left;"> Low </td> <td style="text-align:right;"> 6 </td> <td style="text-align:right;"> 7 </td> <td style="text-align:right;"> 9 </td> <td style="text-align:right;"> 10 </td> <td style="text-align:right;"> 12 </td> </tr> <tr> <td style="text-align:right;"> 4 </td> <td style="text-align:left;"> Low </td> <td style="text-align:right;"> 5 </td> <td style="text-align:right;"> 7 </td> <td style="text-align:right;"> 8 </td> <td style="text-align:right;"> 10 </td> <td style="text-align:right;"> 12 </td> </tr> <tr> <td style="text-align:right;"> 5 </td> <td style="text-align:left;"> Low </td> <td style="text-align:right;"> 5 </td> <td style="text-align:right;"> 6 </td> <td style="text-align:right;"> 7 </td> <td style="text-align:right;"> 8 </td> <td style="text-align:right;"> 10 </td> </tr> <tr> <td style="text-align:right;"> 6 </td> <td style="text-align:left;"> High </td> <td style="text-align:right;"> 4 </td> <td style="text-align:right;"> 6 </td> <td style="text-align:right;"> 9 </td> <td style="text-align:right;"> 9 </td> <td style="text-align:right;"> 11 </td> </tr> <tr> <td style="text-align:right;"> 7 </td> <td style="text-align:left;"> High </td> <td style="text-align:right;"> 3 </td> <td style="text-align:right;"> 5 </td> <td style="text-align:right;"> 7 </td> <td style="text-align:right;"> 10 </td> <td style="text-align:right;"> 12 </td> </tr> <tr> <td style="text-align:right;"> 8 </td> <td style="text-align:left;"> High </td> <td style="text-align:right;"> 6 </td> <td style="text-align:right;"> 8 </td> <td style="text-align:right;"> 11 </td> <td style="text-align:right;"> 10 </td> <td style="text-align:right;"> 14 </td> </tr> <tr> <td style="text-align:right;"> 9 </td> <td style="text-align:left;"> High </td> <td style="text-align:right;"> 5 </td> <td style="text-align:right;"> 7 </td> <td style="text-align:right;"> 9 </td> <td style="text-align:right;"> 10 </td> <td style="text-align:right;"> 12 </td> </tr> <tr> <td style="text-align:right;"> 10 </td> <td style="text-align:left;"> High </td> <td style="text-align:right;"> 5 </td> <td style="text-align:right;"> 8 </td> <td style="text-align:right;"> 9 </td> <td style="text-align:right;"> 11 </td> <td style="text-align:right;"> 11 </td> </tr> </tbody> </table> --- # plant data <img src="16_repeated_measures_files/figure-html/unnamed-chunk-2-1.png" width="648" style="display: block; margin: auto;" /> -- #### What are the experimental units? How do we handle time? --- # repeated measures designs ### General features - Whole units are called subjects -- - One or more treatments is applied to each subject -- - The response variable is measured multiple times on each subject -- - Time can be thought of as a treatment variable applied at the subunit level, but it *can't be randomly assigned* -- - We are often most interested in the interaction between treatment and time -- - In some cases, one of the treatment variables might be applied part way through the experiment. A BACI design is one example --- # examples of repeated measures designs #### To investigate the effect of three drugs, each drug is administered to 8 people, and each person's heart rate is measured every 5 minutes for 4 time intervals #### The effects of predator exclosures are assessed by monitoring prey abundance over multiple years in exclosures and control sites #### The effect of dam removal is evaluated by measuring upstream fish abundance before and after dam removal at multiple rivers --- # options for analysis #### At least three ways to analyze data from repeated measures designs 1) Split-plot model with adjusted p-values 2) Multivariate analysis of variance (MANOVA) 3) (Linear) mixed-effects model (LMM) with serial correlation -- #### Methods (1) and (3) are often called "univariate" approaches, whereas (2) is considered to be multivariate -- #### I don't like these distinctions because (1) often uses multivariate techniques to make the adjustments and (3) can be multivariate as well --- class: inverse, middle, center # split-plot with adjustments --- # model `$$\Large y_{ijk} = \mu + \alpha_i + \beta_j + \alpha \beta_{ij} + \delta_{ik} + \epsilon_{ijk}$$` -- `$$i = 1, ..., a \;(treatment \;levels)$$` `$$j = 1, ..., b \;(time \; periods)$$` `$$k = 1, ..., c \;(subjects \;per \;treatment \;level)$$` -- - `\(\mu =\)` grand mean - `\(\alpha_i =\)` effect of the `\(i\)`th treatment level - `\(\beta_{j} =\)` effect of the `\(j\)`th level of time - `\(\alpha \beta_{ij} =\)` interaction effect between treatment and time - `\(\delta_{ik} =\)` subject effect - `\(\epsilon_{ijk} =\)` residual, unexplained variation --- # model `$$\Large y_{ijk} = \mu + \alpha_i + \beta_j + \alpha \beta_{ij} + \delta_{ik} + \epsilon_{ijk}$$` <br/> Because we want our inferences to apply to all subjects, `\(\delta_{ik}\)` is random: `$$\large \delta_{ik} \sim normal(0, \sigma^2_D)$$` -- If residuals are uncorrelated, we assume: `$$\large \epsilon_{ijk} \sim normal(0, \sigma^2)$$` <br/> -- *p*-values based on this assumption will be wrong (too low) if the residuals are correlated -- **Note**: Hypothesis tests are analogous to those in the split-plot design --- # adjusting *p* -values If we use a split-plot type of ANOVA, we can deal with correlated residuals by adjusting the *p*-values -- The two common adjustment methods are called the **Greenhouse-Geisser** and the **Huynh-Feldt** methods. Estimate `\(\hat{\epsilon}\)`, the degree to which assumption of "*sphericity*" is violated ( `\(\hat{\epsilon}<1\)` indicate assumption violated) - Sphericity is equivalent to equal variances but applied to variances of the *differences* ( `\(\sigma^2_{1-2} = \sigma^2_{1-3} = \sigma^2_{2-3}\)`...) - In general, `\(\hat{\epsilon}_{H-F} > \hat{\epsilon}_{G-G}\)` -- The adjustments involve modifying the degrees-of-freedom of the *F* tests of the within-subjects factors (time and time-treatment interaction) - `\(df_{adj} = (b - 1) \hat{\epsilon}\)`, `\((a - 1)(b - 1)\hat{\epsilon}\)` -- Adjustments only make the *p*-values go up, so there is no need to bother with them if your tests aren't significant under the independence assumption --- # adjusted *p* -values <br/> <table> <thead> <tr> <th style="text-align:right;"> </th> <th style="text-align:center;"> df </th> <th style="text-align:center;"> SS </th> <th style="text-align:center;"> MS </th> <th style="text-align:center;"> F </th> <th style="text-align:center;"> p-value </th> <th style="text-align:center;"> p-adj (H-F) </th> <th style="text-align:right;"> p-adj (G-G) </th> </tr> </thead> <tbody> <tr> <td style="text-align:right;"> Fertilizer </td> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 16.8 </td> <td style="text-align:center;"> 16.80 </td> <td style="text-align:center;"> 2.6 </td> <td style="text-align:center;"> 0.145 </td> <td style="text-align:center;"> </td> <td style="text-align:right;"> </td> </tr> <tr> <td style="text-align:right;"> Error (among-subjects </td> <td style="text-align:center;"> 8 </td> <td style="text-align:center;"> 51.7 </td> <td style="text-align:center;"> 6.50 </td> <td style="text-align:center;"> </td> <td style="text-align:center;"> </td> <td style="text-align:center;"> </td> <td style="text-align:right;"> </td> </tr> <tr> <td style="text-align:right;"> Time </td> <td style="text-align:center;"> 4 </td> <td style="text-align:center;"> 267.4 </td> <td style="text-align:center;"> 66.80 </td> <td style="text-align:center;"> 158.2 </td> <td style="text-align:center;"> <0.001 </td> <td style="text-align:center;"> <0.001 </td> <td style="text-align:right;"> <0.001 </td> </tr> <tr> <td style="text-align:right;"> Interaction </td> <td style="text-align:center;"> 4 </td> <td style="text-align:center;"> 5.1 </td> <td style="text-align:center;"> 1.27 </td> <td style="text-align:center;"> 3.0 </td> <td style="text-align:center;"> 0.03 </td> <td style="text-align:center;"> 0.042 </td> <td style="text-align:right;"> 0.066 </td> </tr> <tr> <td style="text-align:right;"> Error (within-subjects) </td> <td style="text-align:center;"> 32 </td> <td style="text-align:center;"> 13.5 </td> <td style="text-align:center;"> 0.42 </td> <td style="text-align:center;"> </td> <td style="text-align:center;"> </td> <td style="text-align:center;"> </td> <td style="text-align:right;"> </td> </tr> </tbody> </table> <br/> -- #### Which is the only effect in the above table that is of interest? --- class: inverse, middle, center # manova --- # manova #### Assumption of sphericity will often be violated in repeated measures designs (why?) -- #### If the assumption of sphericity cannot be met, or the design is far from balanced, a multivariate analysis of variance (MANOVA) is preferred over the adjusted p-values approach -- #### The two most common multivariate test statistics are: - Wilks' lambda - Pillai's trace -- #### These tests are less powerful than those based on sphericity, but they have less restrictive assumptions --- # model `$$\LARGE y_{i} \sim MVN(\mu_i, \Sigma)$$` -- #### where - `\(\large y_i\)` is the multivariate response vector for subject *i* - `\(\large \mu_i\)` is the vector of means for subject *i* (determined by the fixed effects and the subject-specific random effects) - `\(\large \Sigma\)` is the variance-covariance matrix of the multivariate normal distribution. It has *T* rows and *T* columns, where *T* is the number of time periods -- #### Technical details with accompanying `R` code can be found in Dalgaard (2006) --- # profile analysis #### MANOVA is typically used to test the effects of time or the time-treatment interaction. A common application is in growth studies -- #### We can think of several possible outcomes: -- - If the interaction is significant, the growth curves will not be parallel -- - If the interaction is not significant, but the time effect is, then the curves will be parallel but not flat -- - If neither time nor the interaction is significant, the curves will be flat -- #### These possibilities can be explored using a profile analysis. --- # profile analysis <img src="figs/profile.png" width="1061" style="display: block; margin: auto;" /> --- # profile analysis #### Profile analysis can be performed by analyzing the differences in the response variable over consecutive time periods <div style="border: 1px solid #ddd; padding: 0px; overflow-y: scroll; height:67%; overflow-x: scroll; width:100%; "><table class="table table-responsive table-condensed table-hover" style="font-size: 12px; margin-left: auto; margin-right: auto;"> <thead> <tr> <th style="empty-cells: hide;border-bottom:hidden;position: sticky; top:0; background-color: #FFFFFF;" colspan="1"></th> <th style="empty-cells: hide;border-bottom:hidden;position: sticky; top:0; background-color: #FFFFFF;" colspan="1"></th> <th style="border-bottom:hidden;padding-bottom:0; padding-left:3px;padding-right:3px;text-align: center; position: sticky; top:0; background-color: #FFFFFF;" colspan="5"><div style="border-bottom: 1px solid #ddd; padding-bottom: 5px; ">Leaves</div></th> </tr> <tr> <th style="text-align:right;position: sticky; top:0; background-color: #FFFFFF;"> Plant </th> <th style="text-align:left;position: sticky; top:0; background-color: #FFFFFF;"> Fertilizer </th> <th style="text-align:right;position: sticky; top:0; background-color: #FFFFFF;"> Week 1 </th> <th style="text-align:right;position: sticky; top:0; background-color: #FFFFFF;"> Week 2 </th> <th style="text-align:right;position: sticky; top:0; background-color: #FFFFFF;"> Week 3 </th> <th style="text-align:right;position: sticky; top:0; background-color: #FFFFFF;"> Week 4 </th> <th style="text-align:right;position: sticky; top:0; background-color: #FFFFFF;"> Week 5 </th> </tr> </thead> <tbody> <tr> <td style="text-align:right;"> 1 </td> <td style="text-align:left;"> Low </td> <td style="text-align:right;"> 4 </td> <td style="text-align:right;"> 5 </td> <td style="text-align:right;"> 6 </td> <td style="text-align:right;"> 8 </td> <td style="text-align:right;"> 10 </td> </tr> <tr> <td style="text-align:right;"> 2 </td> <td style="text-align:left;"> Low </td> <td style="text-align:right;"> 3 </td> <td style="text-align:right;"> 4 </td> <td style="text-align:right;"> 6 </td> <td style="text-align:right;"> 6 </td> <td style="text-align:right;"> 9 </td> </tr> <tr> <td style="text-align:right;"> 3 </td> <td style="text-align:left;"> Low </td> <td style="text-align:right;"> 6 </td> <td style="text-align:right;"> 7 </td> <td style="text-align:right;"> 9 </td> <td style="text-align:right;"> 10 </td> <td style="text-align:right;"> 12 </td> </tr> <tr> <td style="text-align:right;"> 4 </td> <td style="text-align:left;"> Low </td> <td style="text-align:right;"> 5 </td> <td style="text-align:right;"> 7 </td> <td style="text-align:right;"> 8 </td> <td style="text-align:right;"> 10 </td> <td style="text-align:right;"> 12 </td> </tr> <tr> <td style="text-align:right;"> 5 </td> <td style="text-align:left;"> Low </td> <td style="text-align:right;"> 5 </td> <td style="text-align:right;"> 6 </td> <td style="text-align:right;"> 7 </td> <td style="text-align:right;"> 8 </td> <td style="text-align:right;"> 10 </td> </tr> <tr> <td style="text-align:right;"> 6 </td> <td style="text-align:left;"> High </td> <td style="text-align:right;"> 4 </td> <td style="text-align:right;"> 6 </td> <td style="text-align:right;"> 9 </td> <td style="text-align:right;"> 9 </td> <td style="text-align:right;"> 11 </td> </tr> <tr> <td style="text-align:right;"> 7 </td> <td style="text-align:left;"> High </td> <td style="text-align:right;"> 3 </td> <td style="text-align:right;"> 5 </td> <td style="text-align:right;"> 7 </td> <td style="text-align:right;"> 10 </td> <td style="text-align:right;"> 12 </td> </tr> <tr> <td style="text-align:right;"> 8 </td> <td style="text-align:left;"> High </td> <td style="text-align:right;"> 6 </td> <td style="text-align:right;"> 8 </td> <td style="text-align:right;"> 11 </td> <td style="text-align:right;"> 10 </td> <td style="text-align:right;"> 14 </td> </tr> <tr> <td style="text-align:right;"> 9 </td> <td style="text-align:left;"> High </td> <td style="text-align:right;"> 5 </td> <td style="text-align:right;"> 7 </td> <td style="text-align:right;"> 9 </td> <td style="text-align:right;"> 10 </td> <td style="text-align:right;"> 12 </td> </tr> <tr> <td style="text-align:right;"> 10 </td> <td style="text-align:left;"> High </td> <td style="text-align:right;"> 5 </td> <td style="text-align:right;"> 8 </td> <td style="text-align:right;"> 9 </td> <td style="text-align:right;"> 11 </td> <td style="text-align:right;"> 11 </td> </tr> </tbody> </table></div> --- # profile analysis #### Profile analysis can be performed by analyzing the differences in the response variable over consecutive time periods <div style="border: 1px solid #ddd; padding: 0px; overflow-y: scroll; height:67%; overflow-x: scroll; width:100%; "><table class="table table-responsive table-condensed table-hover" style="font-size: 12px; margin-left: auto; margin-right: auto;"> <thead> <tr> <th style="empty-cells: hide;border-bottom:hidden;position: sticky; top:0; background-color: #FFFFFF;" colspan="1"></th> <th style="empty-cells: hide;border-bottom:hidden;position: sticky; top:0; background-color: #FFFFFF;" colspan="1"></th> <th style="border-bottom:hidden;padding-bottom:0; padding-left:3px;padding-right:3px;text-align: center; position: sticky; top:0; background-color: #FFFFFF;" colspan="4"><div style="border-bottom: 1px solid #ddd; padding-bottom: 5px; ">New Leaves</div></th> </tr> <tr> <th style="text-align:right;position: sticky; top:0; background-color: #FFFFFF;"> Plant </th> <th style="text-align:left;position: sticky; top:0; background-color: #FFFFFF;"> Fertilizer </th> <th style="text-align:right;position: sticky; top:0; background-color: #FFFFFF;"> Interval 1 </th> <th style="text-align:right;position: sticky; top:0; background-color: #FFFFFF;"> Interval 2 </th> <th style="text-align:right;position: sticky; top:0; background-color: #FFFFFF;"> Interval 3 </th> <th style="text-align:right;position: sticky; top:0; background-color: #FFFFFF;"> Interval 4 </th> </tr> </thead> <tbody> <tr> <td style="text-align:right;"> 1 </td> <td style="text-align:left;"> Low </td> <td style="text-align:right;"> 1 </td> <td style="text-align:right;"> 1 </td> <td style="text-align:right;"> 2 </td> <td style="text-align:right;"> 2 </td> </tr> <tr> <td style="text-align:right;"> 2 </td> <td style="text-align:left;"> Low </td> <td style="text-align:right;"> 1 </td> <td style="text-align:right;"> 2 </td> <td style="text-align:right;"> 0 </td> <td style="text-align:right;"> 3 </td> </tr> <tr> <td style="text-align:right;"> 3 </td> <td style="text-align:left;"> Low </td> <td style="text-align:right;"> 1 </td> <td style="text-align:right;"> 2 </td> <td style="text-align:right;"> 1 </td> <td style="text-align:right;"> 2 </td> </tr> <tr> <td style="text-align:right;"> 4 </td> <td style="text-align:left;"> Low </td> <td style="text-align:right;"> 2 </td> <td style="text-align:right;"> 1 </td> <td style="text-align:right;"> 2 </td> <td style="text-align:right;"> 2 </td> </tr> <tr> <td style="text-align:right;"> 5 </td> <td style="text-align:left;"> Low </td> <td style="text-align:right;"> 1 </td> <td style="text-align:right;"> 1 </td> <td style="text-align:right;"> 1 </td> <td style="text-align:right;"> 2 </td> </tr> <tr> <td style="text-align:right;"> 6 </td> <td style="text-align:left;"> High </td> <td style="text-align:right;"> 2 </td> <td style="text-align:right;"> 3 </td> <td style="text-align:right;"> 0 </td> <td style="text-align:right;"> 2 </td> </tr> <tr> <td style="text-align:right;"> 7 </td> <td style="text-align:left;"> High </td> <td style="text-align:right;"> 2 </td> <td style="text-align:right;"> 2 </td> <td style="text-align:right;"> 3 </td> <td style="text-align:right;"> 2 </td> </tr> <tr> <td style="text-align:right;"> 8 </td> <td style="text-align:left;"> High </td> <td style="text-align:right;"> 2 </td> <td style="text-align:right;"> 3 </td> <td style="text-align:right;"> -1 </td> <td style="text-align:right;"> 4 </td> </tr> <tr> <td style="text-align:right;"> 9 </td> <td style="text-align:left;"> High </td> <td style="text-align:right;"> 2 </td> <td style="text-align:right;"> 2 </td> <td style="text-align:right;"> 1 </td> <td style="text-align:right;"> 2 </td> </tr> <tr> <td style="text-align:right;"> 10 </td> <td style="text-align:left;"> High </td> <td style="text-align:right;"> 3 </td> <td style="text-align:right;"> 1 </td> <td style="text-align:right;"> 2 </td> <td style="text-align:right;"> 0 </td> </tr> </tbody> </table></div> --- # profile analysis <br/> #### The effect of treatment on growth rate can be tested using a MANOVA on the differences <br/> -- #### If the multivariate test is significant, univariate ANOVAs `\(-\)` one for each time period `\(-\)` can be used to determine when the treatment had significant effects <br/> -- #### We will cover this in lab --- # summary <br/> #### Which of the three methods should I use? -- - It's up to you! -- - The simplest approach might be the split-plot option with adjusted p-values -- - The most robust approach might be the MANOVA -- - Another alternative approach, linear mixed models with serial correlation, is flexible enough to handle many different designs and data characteristics preference