Skip to content

Commit

Permalink
incomplete block design chapter figure and formatting changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Sidhuharp97 committed Jan 5, 2025
1 parent 5d8b2b4 commit e8ea9ff
Show file tree
Hide file tree
Showing 8 changed files with 99 additions and 40 deletions.
10 changes: 7 additions & 3 deletions chapters/incomplete-block-design.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,19 @@ dat <- agridat::weiss.incblock

```{r, fig.height= 9, echo=FALSE}
desplot::desplot(dat,
block ~ col+row,
text=gen, cex=1, out1=block,
out2=gen, out2.gpar=list(col = "gray50", lwd = 1, lty = 1),
main="Incomplete block design")
desplot::desplot(dat, yield~col*row,
text=gen, shorten='none', cex=.6, out1=block,
aspect=252/96, # true aspect
main="weiss.incblock")
```


#### Data integrity checks

We will start inspecting the data set firstly by looking at the class of variables:

```{r}
Expand All @@ -100,7 +104,7 @@ The variables we need for the model are block, gen and yield. The block and gen

Next, let's check the independent variables. We can look at this by running a cross tabulations among block and gen factors.

```{r}
```{r, echo=FALSE}
table(dat$block, dat$gen)
```

Expand Down
28 changes: 26 additions & 2 deletions chapters/split-plot-design.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,34 @@ Both the overall error and the rep effects are assumed to be normally distribute

In these model, the error terms, $\epsilon$ are assumed to be "iid", that is, independently and identically distributed. This means they have constant variance and they each individual error term is independent from the others.
:::
```{r, echo=FALSE, fig.height=3.5}
library(FielDHub)
spd <- split_plot(
wp = c("A", "B", "C"),
sp = c("1", "2", "3"),
reps = 3,
type = 1,
plotNumber = 1,
l = 1,
seed = 12
)
plot(spd)
```

![Split Plot CRD Design](/img/split_plot_CRD.jpeg){fig-align="center" width="500"}
```{r, echo=FALSE, , fig.height=3.5}
spd1 <- split_plot(
wp = c("A", "B", "C"),
sp = c("1", "2", "3"),
reps = 3,
type = 2,
plotNumber = 1,
l = 1,
seed = 12
)
plot(spd1)
```

![Split Plot RCBD Design](/img/Split_plot_RCBD.jpeg){fig-align="center" width="500"}

## Analysis Examples

Expand Down
50 changes: 37 additions & 13 deletions docs/chapters/intro.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
<meta name="quarto:offset" content="../">
<link href="../chapters/analysis-tips.html" rel="next">
<link href="../index.html" rel="prev">
<link href="../img/logo_transparent.png" rel="icon" type="image/png">
<script src="../site_libs/quarto-html/quarto.js"></script>
<script src="../site_libs/quarto-html/popper.min.js"></script>
<script src="../site_libs/quarto-html/tippy.umd.min.js"></script>
Expand Down Expand Up @@ -162,48 +163,59 @@
<span class="menu-text"><span class="chapter-number">3</span>&nbsp; <span class="chapter-title">Mixed Model Background</span></span></a>
</div>
</li>
<li class="sidebar-item">
<li class="sidebar-item sidebar-item-section">
<div class="sidebar-item-container">
<a class="sidebar-item-text sidebar-link text-start" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-1" role="navigation" aria-expanded="true">
<span class="menu-text">Experiment designs</span></a>
<a class="sidebar-item-toggle text-start" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-1" role="navigation" aria-expanded="true" aria-label="Toggle section">
<i class="bi bi-chevron-right ms-2"></i>
</a>
</div>
<ul id="quarto-sidebar-section-1" class="collapse list-unstyled sidebar-section depth1 show">
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../chapters/rcbd.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class="chapter-number">4</span>&nbsp; <span class="chapter-title">Randomized Complete Block Design</span></span></a>
</div>
</li>
<li class="sidebar-item">
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../chapters/factorial-design.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class="chapter-number">5</span>&nbsp; <span class="chapter-title">Factorial RCBD Design</span></span></a>
</div>
</li>
<li class="sidebar-item">
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../chapters/split-plot-design.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class="chapter-number">6</span>&nbsp; <span class="chapter-title">Split Plot Design</span></span></a>
</div>
</li>
<li class="sidebar-item">
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../chapters/split-split-plot.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class="chapter-number">7</span>&nbsp; <span class="chapter-title">Split-Split Plot Design</span></span></a>
</div>
</li>
<li class="sidebar-item">
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../chapters/strip-plot.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class="chapter-number">8</span>&nbsp; <span class="chapter-title">Strip Plot Design</span></span></a>
</div>
</li>
<li class="sidebar-item">
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../chapters/incomplete-block-design.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class="chapter-number">9</span>&nbsp; <span class="chapter-title">Incomplete Block Design</span></span></a>
</div>
</li>
<li class="sidebar-item">
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../chapters/lattice-design.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class="chapter-number">10</span>&nbsp; <span class="chapter-title">Lattice Design</span></span></a>
<a href="../chapters/latin-design.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class="chapter-number">10</span>&nbsp; <span class="chapter-title">Latin Square Design</span></span></a>
</div>
</li>
</ul>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../chapters/repeated-measures.html" class="sidebar-item-text sidebar-link">
Expand All @@ -212,14 +224,26 @@
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../chapters/advanced-analytical-options.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class="chapter-number">12</span>&nbsp; <span class="chapter-title">Advanced Analysis</span></span></a>
<a href="../chapters/means-and-contrasts.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class="chapter-number">12</span>&nbsp; <span class="chapter-title">Marginal Means and Contrasts</span></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../chapters/variance-components.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class="chapter-number">13</span>&nbsp; <span class="chapter-title">Variance and Variance Components</span></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../chapters/troubleshooting.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class="chapter-number">14</span>&nbsp; <span class="chapter-title">Troubleshooting</span></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../chapters/additional-resources.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class="chapter-number">13</span>&nbsp; <span class="chapter-title">Additional Resources</span></span></a>
<span class="menu-text"><span class="chapter-number">15</span>&nbsp; <span class="chapter-title">Additional Resources</span></span></a>
</div>
</li>
<li class="sidebar-item">
Expand Down Expand Up @@ -269,7 +293,7 @@ <h1 class="title"><span class="chapter-number">1</span>&nbsp; <span class="chapt
</header>


<p>This guide is focused on frequent implementations of mixed models in R, covering different scenarios common in the agricultural sciences.</p>
<p>This guide is focused on frequentist implementations of mixed models in R, covering different scenarios common in the agricultural and life sciences.</p>
<p>This is not intended to be a guide to the theory of mixed models, it is focused on implementations of models only.</p>
<section id="terms" class="level2" data-number="1.1">
<h2 data-number="1.1" class="anchored" data-anchor-id="terms"><span class="header-section-number">1.1</span> Terms</h2>
Expand Down
28 changes: 17 additions & 11 deletions docs/chapters/split-plot-design.html
Original file line number Diff line number Diff line change
Expand Up @@ -370,18 +370,24 @@ <h2 data-number="6.1" class="anchored" data-anchor-id="details-for-split-plot-de
<p>In these model, the error terms, <span class="math inline">\(\epsilon\)</span> are assumed to be “iid”, that is, independently and identically distributed. This means they have constant variance and they each individual error term is independent from the others.</p>
</div>
</div>
<div class="quarto-figure quarto-figure-center">
<div class="cell">
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="..\img/split_plot_CRD.jpeg" class="img-fluid figure-img" width="500"></p>
<figcaption>Split Plot CRD Design</figcaption>
<p><img src="split-plot-design_files/figure-html/unnamed-chunk-2-1.png" class="img-fluid figure-img" width="672"></p>
</figure>
</div>
<div class="quarto-figure quarto-figure-center">
</div>
</div>
<div class="cell">
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="..\img/Split_plot_RCBD.jpeg" class="img-fluid figure-img" width="500"></p>
<figcaption>Split Plot RCBD Design</figcaption>
<p><img src="split-plot-design_files/figure-html/unnamed-chunk-3-1.png" class="img-fluid figure-img" width="672"></p>
</figure>
</div>
</div>
</div>
</section>
<section id="analysis-examples" class="level2 page-columns page-full" data-number="6.2">
<h2 data-number="6.2" class="anchored" data-anchor-id="analysis-examples"><span class="header-section-number">6.2</span> Analysis Examples</h2>
Expand Down Expand Up @@ -484,7 +490,7 @@ <h4 data-number="6.2.1.1" class="anchored" data-anchor-id="data-integrity-checks
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="split-plot-design_files/figure-html/unnamed-chunk-8-1.png" class="img-fluid figure-img" width="672"></p>
<p><img src="split-plot-design_files/figure-html/unnamed-chunk-10-1.png" class="img-fluid figure-img" width="672"></p>
</figure>
</div>
</div>
Expand Down Expand Up @@ -568,7 +574,7 @@ <h4 data-number="6.2.1.3" class="anchored" data-anchor-id="check-model-assumptio
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="split-plot-design_files/figure-html/unnamed-chunk-11-1.png" class="img-fluid figure-img" width="672"></p>
<p><img src="split-plot-design_files/figure-html/unnamed-chunk-13-1.png" class="img-fluid figure-img" width="672"></p>
</figure>
</div>
</div>
Expand All @@ -580,7 +586,7 @@ <h4 data-number="6.2.1.3" class="anchored" data-anchor-id="check-model-assumptio
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="split-plot-design_files/figure-html/unnamed-chunk-12-1.png" class="img-fluid figure-img" width="672"></p>
<p><img src="split-plot-design_files/figure-html/unnamed-chunk-14-1.png" class="img-fluid figure-img" width="672"></p>
</figure>
</div>
</div>
Expand Down Expand Up @@ -879,7 +885,7 @@ <h4 data-number="6.2.2.3" class="anchored" data-anchor-id="check-model-assumptio
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="split-plot-design_files/figure-html/unnamed-chunk-24-1.png" class="img-fluid figure-img" width="672"></p>
<p><img src="split-plot-design_files/figure-html/unnamed-chunk-26-1.png" class="img-fluid figure-img" width="672"></p>
</figure>
</div>
</div>
Expand All @@ -891,7 +897,7 @@ <h4 data-number="6.2.2.3" class="anchored" data-anchor-id="check-model-assumptio
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="split-plot-design_files/figure-html/unnamed-chunk-25-1.png" class="img-fluid figure-img" width="672"></p>
<p><img src="split-plot-design_files/figure-html/unnamed-chunk-27-1.png" class="img-fluid figure-img" width="672"></p>
</figure>
</div>
</div>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -292,13 +292,13 @@ <h1 class="unnumbered">Preface</h1>
<p><img src="img/cover.jpg" class="img-fluid"></p>
<p><em>“Path in the Wilderness” by Erich Taeubel, Jr.</em></p>
<p>Running mixed models in R is no easy task. There are dozens of packages supporting these aims, each with varying functionality, syntax, and conventions. The linear mixed model ecosystem in R consists of over 80 libraries that either construct and solve mixed model equations or helper packages the process the results from mixed model analysis. These libraries provide a patchwork of overlapping and unique functionality regarding the fundamental structure of mixed models: allowable distributions, nested and crossed random effects, heterogeneous error structures and other facets. No single library has all possible functionality enabled.</p>
<p>This patchwork of packages makes it very challenging for statisticians to conduct mixed model analysis and to teach others how to run mixed models in R. The purpose of this guide to to provide some recipes for handling common analytical scenario’s that require mixed models. As a field guide, it is intended to be succinct, and help researchers meet their analytic goals.</p>
<p>This patchwork of packages makes it very challenging for statisticians to conduct mixed model analysis and to teach others how to run mixed models in R. The purpose of this guide to to provide some recipes for handling common analytical scenario’s that require mixed models. As a field guide, it is intended to be succinct, and to help researchers meet their analytic goals.</p>
<p>In general, the content from this website may not be copied or reproduced without attribution. However, the example code and required data sets to run the code are <a href="https://opensource.org/license/mit/">MIT licensed</a>. These can be accessed on <a href="https://github.com/IdahoAgStats/mixed-models-in-R/tree/main/data">GitHub</a>.</p>
<section id="what-this-does-not-cover" class="level2">
<h2 class="anchored" data-anchor-id="what-this-does-not-cover">What This Does Not Cover</h2>
<ul>
<li><p>Generalized linear models. We do address cases of unequal variance, but if another distribution and/or a link function is required for the model, that is not addressed in this guide.</p></li>
<li><p>Basic principles of experimental design. We assume you know this, but if you do not, please check out the <a href="https://emitanaka.org/edibble-book/">Grammar of Experimental Design</a>.</p></li>
<li><p>Generalized linear models where the response variable does not follow a normal distribution. We do address cases of unequal variance, but if another distribution and/or a link function is required for the model, that is not addressed in this guide.</p></li>
<li><p>Basic principles of experimental design. We assume you know this, but if you do not, please check out the <a href="https://emitanaka.org/edibble-book/">Grammar of Experimental Design</a> for guidance on these topics.</p></li>
<li><p>Instructions in using R. We assume familiarity with R. If you need help in learning R, there are numerous guides, including our <a href="https://idahoagstats.github.io/r-for-ag-scientists/">introductory R course</a>.</p></li>
</ul>
</section>
Expand Down
Loading

0 comments on commit e8ea9ff

Please sign in to comment.