class: center, middle, inverse, title-slide .title[ # LECTURE 14: nested designs ] .subtitle[ ## FANR 6750 (Experimental design) ] .author[ ###
Fall 2023 ] --- # outline 1) Motivation <br/> -- 2) Model <br/> -- 3) Procedure <br/> -- 4) Example --- # motivation #### Often, the response variable is measured numerous times within the experimental unit -- For example, we might apply a pesticide for gypsy moth control to 200 ha plots. We want to see if there are fewer gypsy moths on treated plots compared with untreated plots, but we can't sample the whole plot, so we work with four subplots of 0.04 ha each. The 3 plots below represent one replicate of each of the treatments <img src="figs/gypsymoth.png" width="80%" height="80%" style="display: block; margin: auto;" /> --- # terminology There are numerous terms for subplots. Sometimes they are called subsamples. In experimental design terminology, we refer to the 0.04-ha subplots as **subunits**, and the 200-ha plots as **whole units**, and the design in general is referred to as a **nested design** <img src="figs/gypsymoth.png" width="80%" height="80%" style="display: block; margin: auto;" /> --- # other examples of nested designs <br/> <table class="table" style="font-size: 14px; margin-left: auto; margin-right: auto;"> <thead> <tr> <th style="text-align:left;"> Response </th> <th style="text-align:left;"> Whole unit </th> <th style="text-align:left;"> Subunit </th> <th style="text-align:left;"> Scope of inference </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> Fish Abundance </td> <td style="text-align:left;"> River </td> <td style="text-align:left;"> Reach </td> <td style="text-align:left;"> All rivers in study area </td> </tr> <tr> <td style="text-align:left;"> Lead (Pb) levels </td> <td style="text-align:left;"> Individual </td> <td style="text-align:left;"> Blood sample </td> <td style="text-align:left;"> Population </td> </tr> <tr> <td style="text-align:left;"> Tree height </td> <td style="text-align:left;"> Stand </td> <td style="text-align:left;"> Quadrat </td> <td style="text-align:left;"> All stands in study region </td> </tr> </tbody> </table> --- class: inverse, middle, center # model --- # data structure for nested design <table class="table table-condensed" style="font-size: 14px; margin-left: auto; margin-right: auto;"> <thead> <tr> <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; ">Observation (k)</div></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; ">Experimental unit (j)</div></th> <th style="border-bottom:hidden;padding-bottom:0; padding-left:3px;padding-right:3px;text-align: center; " colspan="3"><div style="border-bottom: 1px solid #ddd; padding-bottom: 5px; ">Treatment (i)</div></th> </tr> <tr> <th style="text-align:center;"> </th> <th style="text-align:center;"> </th> <th style="text-align:center;"> Bt </th> <th style="text-align:center;"> Dimilin </th> <th style="text-align:center;"> Control </th> </tr> </thead> <tbody> <tr> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> \(y_{111}\) </td> <td style="text-align:center;"> \(y_{211}\) </td> <td style="text-align:center;"> \(y_{311}\) </td> </tr> <tr> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> \(y_{112}\) </td> <td style="text-align:center;"> \(y_{212}\) </td> <td style="text-align:center;"> \(y_{312}\) </td> </tr> <tr> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> \(y_{113}\) </td> <td style="text-align:center;"> \(y_{213}\) </td> <td style="text-align:center;"> \(y_{313}\) </td> </tr> <tr> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> \(y_{121}\) </td> <td style="text-align:center;"> \(y_{221}\) </td> <td style="text-align:center;"> \(y_{321}\) </td> </tr> <tr> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> \(y_{122}\) </td> <td style="text-align:center;"> \(y_{222}\) </td> <td style="text-align:center;"> \(y_{322}\) </td> </tr> <tr> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> \(y_{123}\) </td> <td style="text-align:center;"> \(y_{223}\) </td> <td style="text-align:center;"> \(y_{323}\) </td> </tr> </tbody> </table> --- # model `$$\Large y_{ijk} = \mu + \alpha_i + \beta_{ij} + \epsilon_{ijk}$$` `$$\large \beta_{ij} \sim normal(0, \sigma^2_\beta)$$` `$$\large \epsilon_{ijk} \sim normal(0, \sigma^2)$$` -- `$$i = 1, ..., a \;(treatment \;levels)$$` `$$j = 1, ..., b \;(whole \; units)$$` `$$k = 1, ..., n \;(subunits)$$` -- - `\(\mu =\)` grand mean - `\(\alpha_i =\)` effect of the `\(i\)`th treatment - `\(\beta_{ij} =\)` **random** effect of the `\(ij\)`th whole unit - `\(\epsilon_{ijk} =\)` residual, unexplained variation --- # hypotheses #### Main hypothesis of interest `$$\large H_0 : \alpha_1 = \alpha_2 = ... = \alpha_a = 0$$` `$$\large H_a : At \;least \;one \;inequality$$` #### Secondary hypothesis `$$\large H_0 : \sigma^2_\beta = 0$$` `$$\large H_a : \sigma^2_\beta > 0$$` --- class: inverse, middle, center # procedure --- # anova table <br/> <table class="table table-condensed" style="font-size: 18px; width: auto !important; margin-left: auto; margin-right: auto;"> <thead> <tr> <th style="text-align:center;"> Source </th> <th style="text-align:center;"> Symbol </th> <th style="text-align:center;"> df </th> <th style="text-align:center;"> SS </th> </tr> </thead> <tbody> <tr> <td style="text-align:center;"> Among treatment </td> <td style="text-align:center;"> \(SS_a\) </td> <td style="text-align:center;"> \(a-1\) </td> <td style="text-align:center;"> \(bn \sum_i (\bar{y}_{i} - \bar{y}.)^2\) </td> </tr> <tr> <td style="text-align:center;"> Among whole units within treatments </td> <td style="text-align:center;"> \(SS_b\) </td> <td style="text-align:center;"> \(a(b-1)\) </td> <td style="text-align:center;"> \(n \sum_i \sum_j (\bar{y}_{ij} - \bar{y}_{i})^2\) </td> </tr> <tr> <td style="text-align:center;"> Among subunits within whole units </td> <td style="text-align:center;"> \(SS_e\) </td> <td style="text-align:center;"> \(ab(n-1)\) </td> <td style="text-align:center;"> \(\sum_i \sum_j \sum_k (y_{ijk} - \bar{y}_{ij})^2\) </td> </tr> </tbody> </table> -- #### What are the associated mean squares and F statistics? --- # anova table <br/> <table class="table table-condensed" style="font-size: 18px; width: auto !important; margin-left: auto; margin-right: auto;"> <thead> <tr> <th style="text-align:center;"> Source </th> <th style="text-align:center;"> MS </th> <th style="text-align:center;"> F </th> </tr> </thead> <tbody> <tr> <td style="text-align:center;"> Among treatment </td> <td style="text-align:center;"> \(\frac{SS_a}{a-1}\) </td> <td style="text-align:center;"> \(\frac{MS_a}{MS_b}\) </td> </tr> <tr> <td style="text-align:center;"> Among whole units within treatments </td> <td style="text-align:center;"> \(\frac{SS_b}{a(b-1)}\) </td> <td style="text-align:center;"> \(\frac{MS_b}{MS_e}\) </td> </tr> <tr> <td style="text-align:center;"> Among subunits within whole units </td> <td style="text-align:center;"> \(\frac{SS_e}{ab(n-1)}\) </td> <td style="text-align:center;"> </td> </tr> </tbody> </table> --- class: center, middle ## Consequences of using incorrect df? --- class: center, middle, inverse ## Pseudoreplication!!!! -- #### Using subsamples as the experimental unit in an F-test means that you are using the incorrect error degrees of freedom --- # why use a nested design? #### In the subsampling scenario, the only thing a nested design is good for, of and by itself, is testing whether or not there is signficant variation among the experimental units within a treatment level -- #### Additional subsamples will not add any power to your design; they only allow you to estimate the response variable in each experimental unit better -- #### The F-statistic you get for the treatment effect above is identical to what you would get if you used the mean of the response variable for each experimental unit as the data --- class: inverse, center, middle # example --- # example .pull-left[ <table class="table table-condensed" style="font-size: 8px; margin-left: auto; margin-right: auto;"> <thead> <tr> <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; ">Observation (k)</div></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; ">Experimental unit within treatment (j)</div></th> <th style="border-bottom:hidden;padding-bottom:0; padding-left:3px;padding-right:3px;text-align: center; " colspan="3"><div style="border-bottom: 1px solid #ddd; padding-bottom: 5px; ">Treatment (i)</div></th> </tr> <tr> <th style="text-align:center;"> </th> <th style="text-align:center;"> </th> <th style="text-align:center;"> Bt </th> <th style="text-align:center;"> Dimilin </th> <th style="text-align:center;"> Control </th> </tr> </thead> <tbody> <tr> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 16.0 </td> <td style="text-align:center;"> 12.3 </td> <td style="text-align:center;"> 18.5 </td> </tr> <tr> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 16.0 </td> <td style="text-align:center;"> 13.0 </td> <td style="text-align:center;"> 18.0 </td> </tr> <tr> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 15.8 </td> <td style="text-align:center;"> 12.7 </td> <td style="text-align:center;"> 18.4 </td> </tr> <tr> <td style="text-align:center;"> 4 </td> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 14.2 </td> <td style="text-align:center;"> 12.0 </td> <td style="text-align:center;"> 18.1 </td> </tr> <tr> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 13.9 </td> <td style="text-align:center;"> 14.0 </td> <td style="text-align:center;"> 18.7 </td> </tr> <tr> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 14.2 </td> <td style="text-align:center;"> 13.1 </td> <td style="text-align:center;"> 19.0 </td> </tr> <tr> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 13.5 </td> <td style="text-align:center;"> 13.5 </td> <td style="text-align:center;"> 18.8 </td> </tr> <tr> <td style="text-align:center;"> 4 </td> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 13.4 </td> <td style="text-align:center;"> 13.4 </td> <td style="text-align:center;"> 18.5 </td> </tr> <tr> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> 14.0 </td> <td style="text-align:center;"> 13.0 </td> <td style="text-align:center;"> 19.5 </td> </tr> <tr> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> 13.1 </td> <td style="text-align:center;"> 12.4 </td> <td style="text-align:center;"> 17.5 </td> </tr> <tr> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> 13.5 </td> <td style="text-align:center;"> 12.8 </td> <td style="text-align:center;"> 19.1 </td> </tr> <tr> <td style="text-align:center;"> 4 </td> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> 15.4 </td> <td style="text-align:center;"> 13.8 </td> <td style="text-align:center;"> 20.9 </td> </tr> </tbody> </table> ] .pull-right[ ] --- # example .pull-left[ <table class="table table-condensed" style="font-size: 8px; margin-left: auto; margin-right: auto;"> <thead> <tr> <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; ">Observation (k)</div></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; ">Experimental unit within treatment (j)</div></th> <th style="border-bottom:hidden;padding-bottom:0; padding-left:3px;padding-right:3px;text-align: center; " colspan="3"><div style="border-bottom: 1px solid #ddd; padding-bottom: 5px; ">Treatment (i)</div></th> </tr> <tr> <th style="text-align:center;"> </th> <th style="text-align:center;"> </th> <th style="text-align:center;"> Bt </th> <th style="text-align:center;"> Dimilin </th> <th style="text-align:center;"> Control </th> </tr> </thead> <tbody> <tr> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 16.0 </td> <td style="text-align:center;"> 12.3 </td> <td style="text-align:center;"> 18.5 </td> </tr> <tr> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 16.0 </td> <td style="text-align:center;"> 13.0 </td> <td style="text-align:center;"> 18.0 </td> </tr> <tr> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 15.8 </td> <td style="text-align:center;"> 12.7 </td> <td style="text-align:center;"> 18.4 </td> </tr> <tr> <td style="text-align:center;"> 4 </td> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 14.2 </td> <td style="text-align:center;"> 12.0 </td> <td style="text-align:center;"> 18.1 </td> </tr> <tr> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 13.9 </td> <td style="text-align:center;"> 14.0 </td> <td style="text-align:center;"> 18.7 </td> </tr> <tr> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 14.2 </td> <td style="text-align:center;"> 13.1 </td> <td style="text-align:center;"> 19.0 </td> </tr> <tr> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 13.5 </td> <td style="text-align:center;"> 13.5 </td> <td style="text-align:center;"> 18.8 </td> </tr> <tr> <td style="text-align:center;"> 4 </td> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 13.4 </td> <td style="text-align:center;"> 13.4 </td> <td style="text-align:center;"> 18.5 </td> </tr> <tr> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> 14.0 </td> <td style="text-align:center;"> 13.0 </td> <td style="text-align:center;"> 19.5 </td> </tr> <tr> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> 13.1 </td> <td style="text-align:center;"> 12.4 </td> <td style="text-align:center;"> 17.5 </td> </tr> <tr> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> 13.5 </td> <td style="text-align:center;"> 12.8 </td> <td style="text-align:center;"> 19.1 </td> </tr> <tr> <td style="text-align:center;"> 4 </td> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> 15.4 </td> <td style="text-align:center;"> 13.8 </td> <td style="text-align:center;"> 20.9 </td> </tr> </tbody> </table> ] .pull-right[ `$$\large y_{ijk} = \mu$$` <img src="14_nested_files/figure-html/unnamed-chunk-8-1.png" width="504" style="display: block; margin: auto;" /> ] --- # example .pull-left[ <table class="table table-condensed" style="font-size: 8px; margin-left: auto; margin-right: auto;"> <thead> <tr> <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; ">Observation (k)</div></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; ">Experimental unit within treatment (j)</div></th> <th style="border-bottom:hidden;padding-bottom:0; padding-left:3px;padding-right:3px;text-align: center; " colspan="3"><div style="border-bottom: 1px solid #ddd; padding-bottom: 5px; ">Treatment (i)</div></th> </tr> <tr> <th style="text-align:center;"> </th> <th style="text-align:center;"> </th> <th style="text-align:center;"> Bt </th> <th style="text-align:center;"> Dimilin </th> <th style="text-align:center;"> Control </th> </tr> </thead> <tbody> <tr> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 16.0 </td> <td style="text-align:center;"> 12.3 </td> <td style="text-align:center;"> 18.5 </td> </tr> <tr> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 16.0 </td> <td style="text-align:center;"> 13.0 </td> <td style="text-align:center;"> 18.0 </td> </tr> <tr> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 15.8 </td> <td style="text-align:center;"> 12.7 </td> <td style="text-align:center;"> 18.4 </td> </tr> <tr> <td style="text-align:center;"> 4 </td> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 14.2 </td> <td style="text-align:center;"> 12.0 </td> <td style="text-align:center;"> 18.1 </td> </tr> <tr> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 13.9 </td> <td style="text-align:center;"> 14.0 </td> <td style="text-align:center;"> 18.7 </td> </tr> <tr> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 14.2 </td> <td style="text-align:center;"> 13.1 </td> <td style="text-align:center;"> 19.0 </td> </tr> <tr> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 13.5 </td> <td style="text-align:center;"> 13.5 </td> <td style="text-align:center;"> 18.8 </td> </tr> <tr> <td style="text-align:center;"> 4 </td> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 13.4 </td> <td style="text-align:center;"> 13.4 </td> <td style="text-align:center;"> 18.5 </td> </tr> <tr> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> 14.0 </td> <td style="text-align:center;"> 13.0 </td> <td style="text-align:center;"> 19.5 </td> </tr> <tr> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> 13.1 </td> <td style="text-align:center;"> 12.4 </td> <td style="text-align:center;"> 17.5 </td> </tr> <tr> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> 13.5 </td> <td style="text-align:center;"> 12.8 </td> <td style="text-align:center;"> 19.1 </td> </tr> <tr> <td style="text-align:center;"> 4 </td> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> 15.4 </td> <td style="text-align:center;"> 13.8 </td> <td style="text-align:center;"> 20.9 </td> </tr> </tbody> </table> ] .pull-right[ `$$\large y_{ijk} = \mu + \alpha_i$$` <img src="14_nested_files/figure-html/unnamed-chunk-10-1.png" width="504" style="display: block; margin: auto;" /> ] --- # example .pull-left[ <table class="table table-condensed" style="font-size: 8px; margin-left: auto; margin-right: auto;"> <thead> <tr> <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; ">Observation (k)</div></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; ">Experimental unit within treatment (j)</div></th> <th style="border-bottom:hidden;padding-bottom:0; padding-left:3px;padding-right:3px;text-align: center; " colspan="3"><div style="border-bottom: 1px solid #ddd; padding-bottom: 5px; ">Treatment (i)</div></th> </tr> <tr> <th style="text-align:center;"> </th> <th style="text-align:center;"> </th> <th style="text-align:center;"> Bt </th> <th style="text-align:center;"> Dimilin </th> <th style="text-align:center;"> Control </th> </tr> </thead> <tbody> <tr> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 16.0 </td> <td style="text-align:center;"> 12.3 </td> <td style="text-align:center;"> 18.5 </td> </tr> <tr> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 16.0 </td> <td style="text-align:center;"> 13.0 </td> <td style="text-align:center;"> 18.0 </td> </tr> <tr> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 15.8 </td> <td style="text-align:center;"> 12.7 </td> <td style="text-align:center;"> 18.4 </td> </tr> <tr> <td style="text-align:center;"> 4 </td> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 14.2 </td> <td style="text-align:center;"> 12.0 </td> <td style="text-align:center;"> 18.1 </td> </tr> <tr> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 13.9 </td> <td style="text-align:center;"> 14.0 </td> <td style="text-align:center;"> 18.7 </td> </tr> <tr> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 14.2 </td> <td style="text-align:center;"> 13.1 </td> <td style="text-align:center;"> 19.0 </td> </tr> <tr> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 13.5 </td> <td style="text-align:center;"> 13.5 </td> <td style="text-align:center;"> 18.8 </td> </tr> <tr> <td style="text-align:center;"> 4 </td> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 13.4 </td> <td style="text-align:center;"> 13.4 </td> <td style="text-align:center;"> 18.5 </td> </tr> <tr> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> 14.0 </td> <td style="text-align:center;"> 13.0 </td> <td style="text-align:center;"> 19.5 </td> </tr> <tr> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> 13.1 </td> <td style="text-align:center;"> 12.4 </td> <td style="text-align:center;"> 17.5 </td> </tr> <tr> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> 13.5 </td> <td style="text-align:center;"> 12.8 </td> <td style="text-align:center;"> 19.1 </td> </tr> <tr> <td style="text-align:center;"> 4 </td> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> 15.4 </td> <td style="text-align:center;"> 13.8 </td> <td style="text-align:center;"> 20.9 </td> </tr> </tbody> </table> ] .pull-right[ `$$\large y_{ijk} = \mu + \alpha_i + \beta_{ij}$$` <img src="14_nested_files/figure-html/unnamed-chunk-12-1.png" width="504" style="display: block; margin: auto;" /> ] --- # example .pull-left[ <table class="table table-condensed" style="font-size: 8px; margin-left: auto; margin-right: auto;"> <thead> <tr> <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; ">Observation (k)</div></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; ">Experimental unit within treatment (j)</div></th> <th style="border-bottom:hidden;padding-bottom:0; padding-left:3px;padding-right:3px;text-align: center; " colspan="3"><div style="border-bottom: 1px solid #ddd; padding-bottom: 5px; ">Treatment (i)</div></th> </tr> <tr> <th style="text-align:center;"> </th> <th style="text-align:center;"> </th> <th style="text-align:center;"> Bt </th> <th style="text-align:center;"> Dimilin </th> <th style="text-align:center;"> Control </th> </tr> </thead> <tbody> <tr> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 16.0 </td> <td style="text-align:center;"> 12.3 </td> <td style="text-align:center;"> 18.5 </td> </tr> <tr> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 16.0 </td> <td style="text-align:center;"> 13.0 </td> <td style="text-align:center;"> 18.0 </td> </tr> <tr> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 15.8 </td> <td style="text-align:center;"> 12.7 </td> <td style="text-align:center;"> 18.4 </td> </tr> <tr> <td style="text-align:center;"> 4 </td> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 14.2 </td> <td style="text-align:center;"> 12.0 </td> <td style="text-align:center;"> 18.1 </td> </tr> <tr> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 13.9 </td> <td style="text-align:center;"> 14.0 </td> <td style="text-align:center;"> 18.7 </td> </tr> <tr> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 14.2 </td> <td style="text-align:center;"> 13.1 </td> <td style="text-align:center;"> 19.0 </td> </tr> <tr> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 13.5 </td> <td style="text-align:center;"> 13.5 </td> <td style="text-align:center;"> 18.8 </td> </tr> <tr> <td style="text-align:center;"> 4 </td> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 13.4 </td> <td style="text-align:center;"> 13.4 </td> <td style="text-align:center;"> 18.5 </td> </tr> <tr> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> 14.0 </td> <td style="text-align:center;"> 13.0 </td> <td style="text-align:center;"> 19.5 </td> </tr> <tr> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> 13.1 </td> <td style="text-align:center;"> 12.4 </td> <td style="text-align:center;"> 17.5 </td> </tr> <tr> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> 13.5 </td> <td style="text-align:center;"> 12.8 </td> <td style="text-align:center;"> 19.1 </td> </tr> <tr> <td style="text-align:center;"> 4 </td> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> 15.4 </td> <td style="text-align:center;"> 13.8 </td> <td style="text-align:center;"> 20.9 </td> </tr> </tbody> </table> ] .pull-right[ `$$\large y_{ijk} = \mu + \alpha_i + \beta_{ij} + \epsilon_{ijk}$$` <img src="14_nested_files/figure-html/unnamed-chunk-14-1.png" width="504" style="display: block; margin: auto;" /> ] --- # example .pull-left[ <table class="table table-condensed" style="font-size: 8px; margin-left: auto; margin-right: auto;"> <thead> <tr> <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; ">Observation (k)</div></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; ">Experimental unit within treatment (j)</div></th> <th style="border-bottom:hidden;padding-bottom:0; padding-left:3px;padding-right:3px;text-align: center; " colspan="3"><div style="border-bottom: 1px solid #ddd; padding-bottom: 5px; ">Treatment (i)</div></th> </tr> <tr> <th style="text-align:center;"> </th> <th style="text-align:center;"> </th> <th style="text-align:center;"> Bt </th> <th style="text-align:center;"> Dimilin </th> <th style="text-align:center;"> Control </th> </tr> </thead> <tbody> <tr> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 16.0 </td> <td style="text-align:center;"> 12.3 </td> <td style="text-align:center;"> 18.5 </td> </tr> <tr> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 16.0 </td> <td style="text-align:center;"> 13.0 </td> <td style="text-align:center;"> 18.0 </td> </tr> <tr> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 15.8 </td> <td style="text-align:center;"> 12.7 </td> <td style="text-align:center;"> 18.4 </td> </tr> <tr> <td style="text-align:center;"> 4 </td> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 14.2 </td> <td style="text-align:center;"> 12.0 </td> <td style="text-align:center;"> 18.1 </td> </tr> <tr> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 13.9 </td> <td style="text-align:center;"> 14.0 </td> <td style="text-align:center;"> 18.7 </td> </tr> <tr> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 14.2 </td> <td style="text-align:center;"> 13.1 </td> <td style="text-align:center;"> 19.0 </td> </tr> <tr> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 13.5 </td> <td style="text-align:center;"> 13.5 </td> <td style="text-align:center;"> 18.8 </td> </tr> <tr> <td style="text-align:center;"> 4 </td> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 13.4 </td> <td style="text-align:center;"> 13.4 </td> <td style="text-align:center;"> 18.5 </td> </tr> <tr> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> 14.0 </td> <td style="text-align:center;"> 13.0 </td> <td style="text-align:center;"> 19.5 </td> </tr> <tr> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> 13.1 </td> <td style="text-align:center;"> 12.4 </td> <td style="text-align:center;"> 17.5 </td> </tr> <tr> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> 13.5 </td> <td style="text-align:center;"> 12.8 </td> <td style="text-align:center;"> 19.1 </td> </tr> <tr> <td style="text-align:center;"> 4 </td> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> 15.4 </td> <td style="text-align:center;"> 13.8 </td> <td style="text-align:center;"> 20.9 </td> </tr> </tbody> </table> ] -- .pull-right[ <table class="table table-condensed" style="font-size: 18px; width: auto !important; margin-left: auto; margin-right: auto;"> <thead> <tr> <th style="text-align:center;"> Source </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> </tr> </thead> <tbody> <tr> <td style="text-align:center;"> Among treatment </td> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> 215.4 </td> <td style="text-align:center;"> 107.7 </td> <td style="text-align:center;"> ? </td> </tr> <tr> <td style="text-align:center;"> Among whole units </td> <td style="text-align:center;"> 6 </td> <td style="text-align:center;"> 11.2 </td> <td style="text-align:center;"> 1.9 </td> <td style="text-align:center;"> ? </td> </tr> <tr> <td style="text-align:center;"> Residual </td> <td style="text-align:center;"> 27 </td> <td style="text-align:center;"> 13.9 </td> <td style="text-align:center;"> 0.5 </td> <td style="text-align:center;"> </td> </tr> </tbody> </table> ] --- # nested design in r If we use the `aov()` function like in previous examples, `R` will not use the correct df .vsmall-code[ ```r aov.wrong <- aov(larvae ~ Treatment + Plot, data = mothdata2) summary(aov.wrong) ``` ``` ## Df Sum Sq Mean Sq F value Pr(>F) ## Treatment 2 215.4 107.7 208.89 <2e-16 *** ## Plot 6 11.2 1.9 3.61 0.0093 ** ## Residuals 27 13.9 0.5 ## --- ## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 ``` ] -- Instead, we have to use: .vsmall-code[ ```r aov.correct <- aov(larvae ~ Treatment + Error(Plot), data = mothdata2) summary(aov.correct) ``` ``` ## ## Error: Plot ## Df Sum Sq Mean Sq F value Pr(>F) ## Treatment 2 215.4 107.7 57.9 0.00012 *** ## Residuals 6 11.2 1.9 ## --- ## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 ## ## Error: Within ## Df Sum Sq Mean Sq F value Pr(>F) ## Residuals 27 13.9 0.516 ``` ] --- # nested design as a linear model As we have seen throughout the semester, data from nested designs can be fit as linear models -- Just like for the `aov()` function, the `lm()` function will improperly calculate the F-statistic using `\(MS_e\)` -- Fitting the linear model requires treating the whole units as random effects, which `lm()` cannot do - instead, you must use functions designed for fitting random-effect models - we will explore this more in lab --- # connections to what's ahead <br/> #### Later, we will deal with designs where one effect is nested within another, and the experimental units are actually at two different scales (a split-plot design) <br/> -- #### Also, we will consider designs where the whole unit is sampled repeatedly through time, and the time factor will be another type of subunit (a repeated measures design) --- # summary - Nested designs involve multiple measurements of the response variable at each experimental unit -- - This is usually done out of necessity because it is too diffcult to thoroughly measure the response variable at the level of the whole unit -- - Increasing `\(\large n\)`, the number of subunits per whole unit, does not increase power. It only allows you to estimate the response variable better within each experimental unit -- - Pseudoreplication occurs when `\(MS_e\)` is used in the denominator of the *F* test for the treatment effect --- # looking ahead <br/> ### **Next time**: Split-plot designs <br/> ### **Reading**: Quinn & Keough 11.1-11.2