-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.Rmd
98 lines (81 loc) · 5.8 KB
/
index.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
---
title: "Mixed Models for Agriculture in R"
output:
html_document:
includes:
in_header: header.html
after_body: footer.html
params:
hilang:
- sas
---
```{r echo=FALSE, message=FALSE, warning=FALSE}
# packages for better formatting tables for html output
library(kableExtra); library(formattable)
library(dplyr); library(tibble); library(tidyr)
```
# Hi there!{.tabset .tabset-fade .tabset-pills}
This is a project under construction. Our aim is to provide a cookbook with mixed model analyses of typical examples in life sciences (focus on agriculture/biology) and compare the possibilities or rather limitations of the R-packages
* [`nlme`](https://CRAN.R-project.org/package=nlme){target="_blank"}
* [`lme4`](https://CRAN.R-project.org/package=lme4){target="_blank"}
* [`glmmTMB`](https://CRAN.R-project.org/package=glmmTMB){target="_blank"}
* [`sommer`](https://CRAN.R-project.org/package=sommer){target="_blank"}
to each other, but also to SAS' [`PROC MIXED`](https://documentation.sas.com/?docsetId=statug&docsetTarget=statug_mixed_syntax.htm&docsetVersion=14.3&locale=en){target="_blank"}.
Find chapters by navigating the menu at the top of the page. Each chapter focuses on a certain aspect of mixed modelling. Within each chapter, switch between tabs with codes from the different packages via these buttons:
## nlme
## lme4
## glmmTMB
## sommer
## SAS
# Chapters
```{r echo=FALSE, message=FALSE, warning=FALSE}
contents <- rbind(
c("R-side", "Heterogeneous err. var.", "yes", "no", "kind of", "yes", "yes"),
c("R-side", "First-order autoregressive", "yes", "no", "kind of", "not really", "yes"),
c("R-side", "Fixed scalar (Smith's weights)", "in progress", "in progress", "in progress", "in progress", "yes"),
c("R-side", "Fixed matrix (fully efficient weighting)", "in progress", "in progress", "in progress", "in progress", "yes"),
c("G-side", "Fixed matrix (kinship/pedigree)", "in progress", "in progress", "in progress", "in progress", "in progress"),
c("G-side", "Unstructured", "in progress", "in progress", "in progress", "in progress", "in progress"),
c("G-side", "First-order factor analytic", "in progress", "in progress", "in progress", "in progress", "in progress"),
c("ModelFit", "log-likelihood, AIC, BIC", "in progress", "in progress", "in progress", "in progress", "in progress"),
c("ANOVA", "with DF adjustments", "in progress", "in progress", "in progress", "in progress", "in progress"),
c("BLUPs", "raw/conditional predicted()", "in progress", "in progress", "in progress", "in progress", "in progress"),
c("BLUEs", "raw/conditional emmeans()", "in progress", "in progress", "in progress", "in progress", "in progress"),
c("Extract", "estimated R-side matrix", "in progress", "in progress", "in progress", "in progress", "in progress"),
c("Extract", "estimated G-side matrix", "in progress", "in progress", "in progress", "in progress", "in progress"),
c("Extract", "MMEq solutions", "in progress", "in progress", "in progress", "in progress", "in progress")
) %>% data.frame
names(contents) <- c("Topic", "Chapter", "nlme", "lme4", "glmmTMB", "sommer", "SAS")
contents %>%
#mutate_at(vars(Topic:Chapter), ~cell_spec(., bold=TRUE)) %>%
mutate_at(vars(nlme:SAS),
~cell_spec(.,
color=case_when(.=="in progress" ~ "#003f75ff",
TRUE ~ "white"),
background=case_when(.=="yes" ~ "green",
.=="kind of" ~ "#7CB342",
.=="not really" ~ "#FB8C00",
.=="no" ~ "red",
TRUE ~ "white"))) %>%
kable(escape = FALSE) %>%
kable_styling(bootstrap_options = c("hover","responsive"),
position = "left",
full_width = FALSE) %>%
column_spec(1, bold = T) %>%
collapse_rows(columns=1, valign = "top") %>%
add_header_above(c(" ", " ", "Possible in"=5))
```
<br/>
# Approach
In addition to the *chapters*, there are *summaries* for certain topics where we felt additional info may be beneficial, but should not bloat the chapters themselves. Just like chapters, summaries can be found by navigating the menu at the top of the page.
Where possible, we try to use example data/analyses for our chapters that have been published in peer-reviewed journals.
In terms of R syntax, we generally try to follow the approach presented on the ["R for Data Science" website](https://r4ds.had.co.nz/){target="_blank"}, making use of:
[<img src="https://raw.githubusercontent.com/rstudio/hex-stickers/master/PNG/dplyr.png" width="80">](https://CRAN.R-project.org/package=dplyr)
[<img src="https://raw.githubusercontent.com/rstudio/hex-stickers/master/PNG/ggplot2.png" width="80">](https://CRAN.R-project.org/package=ggplot2)
[<img src="https://raw.githubusercontent.com/rstudio/hex-stickers/master/PNG/pipe.png" width="80">](https://r4ds.had.co.nz/pipes.html)
[<img src="https://raw.githubusercontent.com/rstudio/hex-stickers/master/PNG/purrr.png" width="80">](https://CRAN.R-project.org/package=purrr)
[<img src="https://raw.githubusercontent.com/rstudio/hex-stickers/master/PNG/scales.png" width="80">](https://CRAN.R-project.org/package=scales)
[<img src="https://raw.githubusercontent.com/rstudio/hex-stickers/master/PNG/stringr.png" width="80">](https://CRAN.R-project.org/package=stringr)
[<img src="https://raw.githubusercontent.com/rstudio/hex-stickers/master/PNG/tibble.png" width="80">](https://CRAN.R-project.org/package=tibble)
[<img src="https://raw.githubusercontent.com/rstudio/hex-stickers/master/PNG/tidyr.png" width="80">](https://CRAN.R-project.org/package=tidyr)
[<img src="https://raw.githubusercontent.com/rstudio/hex-stickers/master/PNG/tidyverse.png" width="80">](https://CRAN.R-project.org/package=tidyverse)