-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsoftware.qmd
135 lines (85 loc) · 4.5 KB
/
software.qmd
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
---
title: "Software"
---
```{r, echo=FALSE, message=FALSE}
```
Code for most lab projects is available either on the [lab GitHub page](https://github.com/Middleton-Lab) or [my personal GitHub page](https://github.com/kmiddleton).
Here are some R packages that are potentially of use.
## `abd`: Analysis of Biological Data
Collaborating with Randall Pruim (Calvin College), I co-developed an R package ([`abd`](https://github.com/Middleton-Lab/abd)) to accompany the first edition of [*The Analysis of Biological Data*](https://www.macmillanlearning.com/college/us/product/Analysis-of-Biological-Data/p/1936221489) by Michael Whitlock and Dolph Schluter. This is an excellent textbook (now in its second edition, still remarkably inexpensive) for teaching advanced undergraduate and introductory graduate statistics. The new edition of this book has [associated R code](https://whitlockschluter.zoology.ubc.ca/), mostly making this package redundant. But I still like having the datasets from the book handy. I use them for teaching and demos really often, like the distribution of counts of desert birds or hemoglobin levels in different populations.
```{r, message=FALSE}
library(ggplot2)
library(abd)
ggplot(DesertBirds, aes(count)) +
geom_histogram(bins = 30, fill = "darkred") +
labs(x = "Count", y = "Number of Species") +
cowplot::theme_cowplot()
```
```{r, message=FALSE}
library(ggplot2)
library(abd)
ggplot(Hemoglobin, aes(x = hemoglobin, y = relative.frequency)) +
geom_bar(stat = "identity", fill = "darkred") +
labs(x = "Hemoglobin", y = "Relative Frequency") +
facet_grid(group ~ .) +
cowplot::theme_cowplot()
```
### Installation
The package can be installed via CRAN
```{r, eval=FALSE}
install.packages("abd")
```
or directly from GitHub:
```{r, eval=FALSE}
remotes::install_github("Middleton-Lab/abd")
```
We have had a lot of dependency creep over the years, so the number of packages that get installed alongside `abd` can be quite large.
### `abdData`
The `abd` package has quite a few dependencies resulting from its use of the `mosaic` package.
The data from `abd` is arguably its most useful feature. A more streamlined version of `abd` with only the data is available via [`abdData`](https://github.com/Middleton-Lab/abdData), which can be installed with
```{r, eval=FALSE}
remotes::install_github("Middleton-Lab/abdData")
```
[The `abdData` user manual is available online.](https://middleton-lab.github.io/abdData/index.html)
<hr />
## `jnt`: Johnson-Neyman Technique
The Johnson-Neyman technique is used to determine the region of an analysis of covariance where the slopes are not significantly between the covariate. This allows the determination of bounds of a region of "equal" slope despite the presence of a "significant" slope (by whatever definition of "significant" you choose).
We used this approach in Lavin SR, Karasov WH, Ives AR, Middleton KM, Garland T Jr (2008) Morphometrics of the avian small intestine compared with that of nonflying mammals: A phylogenetic approach. *Physiol Biochem Zool* 81: 526-550.
### References
1. Johnson PO and Neyman J (1936) Tests of certain linear hypotheses and their application to some educational problems. *Statistical Research Memoirs* 1: 57-93.
2. Hunka S and Leighton J (1997) Defining Johnson-Neyman regions of significance in three-covariate ANCOVA using Mathematica. *Journal of Educational and Behavioral Statistics* 22: 361-387.
3. White CR (2003) The influence of foraging mode and arid adaptation on the basal metabolic rates of burrowing mammals. *Physiol Biochem Zool* 76: 122-134.
4. White CR (2003) Allometric analysis beyond heterogenous regression slopes: Use of the Johnson-Neyman Technique in comparative biology. *Physiol Biochem Zool* 76: 135-140.
### Demo
```{r}
library(jnt)
set.seed(1234)
n <- 50
x1 <- rnorm(n)
y1 <- x1 + rnorm(n, sd = 0.2)
x2 <- rnorm(n)
y2 <- 1.25 * x2 + rnorm(n, sd = 0.2)
df1 <- data.frame(x = x1, y = y1)
df2 <- data.frame(x = x2, y = y2)
(jnt.out <- jnt(df1, df2))
plot(jnt.out)
```
### Installation
`jnt` can be installed directly from GitHub:
```{r, eval=FALSE}
remotes::install_github("Middleton-Lab/jnt")
```
<hr />
## `MuscleTernary`: Ternary plots for 3D data
### Installation
`MuscleTernary` can be installed directly from GitHub:
```{r, eval=FALSE}
remotes::install_github("Middleton-Lab/MuscleTernary")
```
<hr />
## `binning`: Binning for mouse wheel activity data
### Installation
`binning` can be installed directly from GitHub:
```{r, eval=FALSE}
remotes::install_github("Middleton-Lab/binning")
```