Skip to content

Commit

Permalink
book up
Browse files Browse the repository at this point in the history
  • Loading branch information
TGuillerme committed Nov 12, 2024
1 parent e4ed02c commit ee9824f
Show file tree
Hide file tree
Showing 106 changed files with 4,900 additions and 4,170 deletions.
11 changes: 11 additions & 0 deletions inst/References.bib
Original file line number Diff line number Diff line change
Expand Up @@ -374,3 +374,14 @@ @article{aguilera2004
URL = {http://wscg.zcu.cz/wscg2004/Papers_2004_Short/N29.pdf}
}


@article{guillerme2023innovation,
title={Innovation and elaboration on the avian tree of life},
author={Guillerme, Thomas and Bright, Jen A and Cooney, Christopher R and Hughes, Emma C and Varley, Zo{\"e} K and Cooper, Natalie and Beckerman, Andrew P and Thomas, Gavin H},
journal={Science Advances},
volume={9},
number={43},
pages={eadg1641},
year={2023},
publisher={American Association for the Advancement of Science}
}
27 changes: 7 additions & 20 deletions inst/gitbook/03_specific-tutorials.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -201,18 +201,6 @@ boot.matrix(BeckLee_mat50, bootstraps = 20,

> Note that using the `rarefaction` argument also bootstraps the data. In these examples, the function bootstraps the data (without rarefaction) AND also bootstraps the data with the different rarefaction levels.
One other argument is `dimensions` that specifies how many dimensions from the matrix should be used for further analysis.
When missing, all dimensions from the ordinated matrix are used.

```{r, eval=TRUE}
## Using the first 50% of the dimensions
boot.matrix(BeckLee_mat50, dimensions = 0.5)
## Using the first 10 dimensions
boot.matrix(BeckLee_mat50, dimensions = 10)
```
Of course, one could directly supply the subsets generated above (using `chrono.subsets` or `custom.subsets`) to this function.

```{r, eval=TRUE}
## Creating subsets of crown and stem mammals
crown_stem <- custom.subsets(BeckLee_mat50,
Expand All @@ -233,7 +221,6 @@ time_slices <- chrono.subsets(data = BeckLee_mat99,
boot.matrix(time_slices, bootstraps = 100)
```


### Bootstrapping with probabilities

It is also possible to specify the sampling probability in the bootstrap for each elements.
Expand Down Expand Up @@ -1403,7 +1390,7 @@ This can be done by plotting `dispRity` objects with no calculated disparity!
For example, we might be interested in looking at how the distribution of elements change as a function of the distributions of different sub-settings.
For example custom subsets *vs.* time subsets:

```{r, fig.width=8, fig.height=4}
```{r, fig.width=12, fig.height=6}
## Making the different subsets
cust_subsets <- custom.subsets(BeckLee_mat99,
crown.stem(BeckLee_tree,
Expand Down Expand Up @@ -1432,7 +1419,7 @@ Groups that don't overlap on two set dimensions can totally overlap in all other
For `dispRity` objects that do contain disparity data, the default option is to plot your disparity data.
However you can always force the `preview` option using the following:

```{r, fig.height = 16, fig.width = 8}
```{r, fig.height = 12, fig.width = 6}
par(mfrow = c(2,1))
## Default plotting
plot(disparity_time_slices, main = "Disparity through time")
Expand All @@ -1452,7 +1439,7 @@ But you can also decide to _only_ colour the circles in blue using `points.col =

Here is an example with multiple elements (lines and points) taken from the [disparity with trees](#dispRitree) section below:

```{r}
```{r, fig.height = 12, fig.width = 12}
## Loading some demo data:
## An ordinated matrix with node and tip labels
data(BeckLee_mat99)
Expand Down Expand Up @@ -2012,7 +1999,7 @@ Note that, as expected, this central tendency is the same in both metrics!

Another, maybe more intuitive way, to compare both approaches for measuring disparity is to plot the distributions:

```{r, fig.width=8, fig.height=8}
```{r, fig.width=8, fig.height=4}
## Graphical parameters
op <- par(bty = "n", mfrow = c(1, 2))
Expand Down Expand Up @@ -2228,7 +2215,7 @@ summary(dispRity(three_tree, metric = c(sum, variances)))

This results show the effect of considering a tree distribution: in the first case (`one_tree`) the time slice at 3.95 Mya has a sum of variances of 2.9 but this values goes down to 0.256 in the second case (`three_tree`) which is due to the differences in branch lengths distributions:

```{r, print = FALSE}
```{r, print = FALSE, fig.width = 4, fig.height = 12}
par(mfrow = c(3,1))
slices <- c(7.9, 3.95, 0)
fun.plot <- function(tree) {
Expand Down Expand Up @@ -2321,7 +2308,6 @@ plot(sum_edge_length)

Of course this can be done with multiple trees and be combined with an approach using multiple matrices (see [here](#multi.input))!


## Disparity of variance-covariance matrices (covar) {#covar}

Variance-covariance matrices are sometimes a useful way to summarise multidimensional data.
Expand All @@ -2332,6 +2318,7 @@ For example, you might have a multidimensional dataset where your observations h
You can then analyse this data using a glmm with something like `my_data ~ observations + phylogeny + redisduals`.
For more info on these models [start here](https://en.wikipedia.org/wiki/Generalized_linear_mixed_model).
For more details on running these models, I suggest using the `MCMCglmm` package (@MCMCglmm) from @hadfield2010 (but see also @mulTree).
For an example use of this code, see @guillerme2023innovation.

### Creating a `dispRity` object with a `$covar` component

Expand Down Expand Up @@ -2377,7 +2364,7 @@ One useful thing to do with these objects is then to visualise them in 2D.
Here we can use the `covar.plot` function (that has many different options that just `plot.dispRity` for plotting covar objects) to plot the trait space, the 95% confidence interval ellipses of the variance-covariance matrices and the major axes from these ellipses.
See the `?covar.plot` help page for all the options available:

```{r}
```{r, fig.height = 12, fig.width = 12}
par(mfrow = c(2,2))
## The traitspace
covar.plot(my_covar, col = c("orange", "darkgreen", "blue"), main = "Trait space")
Expand Down
4 changes: 2 additions & 2 deletions inst/gitbook/05_other-functionalities.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ The function works by taking a node (or a list of nodes), a tree and a sliding v
The node will be moved "up" (towards the tips) for the given sliding value.
You can move the node "down" (towards the roots) using a negative value.

```{r}
```{r, fig.height = 12, fig.width = 4}
set.seed(42)
## Generating simple coalescent tree
tree <- rcoal(5)
Expand All @@ -502,7 +502,7 @@ The `remove.zero.brlen` is a "clever" wrapping function that uses the `slide.nod
This function will slide nodes up or down in successive postorder traversals (i.e. going down the tree clade by clade) in order to minimise the number of nodes to slide while making sure there are no silly negative branch lengths produced!
By default it is trying to slide the nodes using 1% of the minimum branch length to avoid changing the topology too much.

```{r}
```{r, fig.height = 12, fig.width = 4}
set.seed(42)
## Generating a tree
tree <- rtree(20)
Expand Down
89 changes: 60 additions & 29 deletions inst/gitbook/_book/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<meta name="author" content="Thomas Guillerme ([email protected])" />


<meta name="date" content="2024-03-08" />
<meta name="date" content="2024-11-12" />

<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
Expand All @@ -49,38 +49,38 @@



<script src="libs/accessible-code-block-0.0.1/empty-anchor.js"></script>
<link href="libs/anchor-sections-1.1.0/anchor-sections.css" rel="stylesheet" />
<link href="libs/anchor-sections-1.1.0/anchor-sections-hash.css" rel="stylesheet" />
<script src="libs/anchor-sections-1.1.0/anchor-sections.js"></script>
<script src="libs/htmlwidgets-1.6.2/htmlwidgets.js"></script>
<script src="libs/rglWebGL-binding-1.2.8/rglWebGL.js"></script>
<link href="libs/rglwidgetClass-1.2.8/rgl.css" rel="stylesheet" />
<script src="libs/rglwidgetClass-1.2.8/rglClass.src.js"></script>
<script src="libs/rglwidgetClass-1.2.8/utils.src.js"></script>
<script src="libs/rglwidgetClass-1.2.8/buffer.src.js"></script>
<script src="libs/rglwidgetClass-1.2.8/subscenes.src.js"></script>
<script src="libs/rglwidgetClass-1.2.8/shaders.src.js"></script>
<script src="libs/rglwidgetClass-1.2.8/shadersrc.src.js"></script>
<script src="libs/rglwidgetClass-1.2.8/textures.src.js"></script>
<script src="libs/rglwidgetClass-1.2.8/projection.src.js"></script>
<script src="libs/rglwidgetClass-1.2.8/mouse.src.js"></script>
<script src="libs/rglwidgetClass-1.2.8/init.src.js"></script>
<script src="libs/rglwidgetClass-1.2.8/pieces.src.js"></script>
<script src="libs/rglwidgetClass-1.2.8/draw.src.js"></script>
<script src="libs/rglwidgetClass-1.2.8/controls.src.js"></script>
<script src="libs/rglwidgetClass-1.2.8/selection.src.js"></script>
<script src="libs/rglwidgetClass-1.2.8/rglTimer.src.js"></script>
<script src="libs/rglwidgetClass-1.2.8/pretty.src.js"></script>
<script src="libs/rglwidgetClass-1.2.8/axes.src.js"></script>
<script src="libs/rglwidgetClass-1.2.8/animation.src.js"></script>
<script src="libs/CanvasMatrix4-1.2.8/CanvasMatrix.src.js"></script>
<script src="libs/htmlwidgets-1.6.4/htmlwidgets.js"></script>
<script src="libs/rglWebGL-binding-1.3.12/rglWebGL.js"></script>
<link href="libs/rglwidgetClass-1.3.12/rgl.css" rel="stylesheet" />
<script src="libs/rglwidgetClass-1.3.12/rglClass.src.js"></script>
<script src="libs/rglwidgetClass-1.3.12/utils.src.js"></script>
<script src="libs/rglwidgetClass-1.3.12/buffer.src.js"></script>
<script src="libs/rglwidgetClass-1.3.12/subscenes.src.js"></script>
<script src="libs/rglwidgetClass-1.3.12/shaders.src.js"></script>
<script src="libs/rglwidgetClass-1.3.12/shadersrc.src.js"></script>
<script src="libs/rglwidgetClass-1.3.12/textures.src.js"></script>
<script src="libs/rglwidgetClass-1.3.12/projection.src.js"></script>
<script src="libs/rglwidgetClass-1.3.12/mouse.src.js"></script>
<script src="libs/rglwidgetClass-1.3.12/init.src.js"></script>
<script src="libs/rglwidgetClass-1.3.12/pieces.src.js"></script>
<script src="libs/rglwidgetClass-1.3.12/draw.src.js"></script>
<script src="libs/rglwidgetClass-1.3.12/controls.src.js"></script>
<script src="libs/rglwidgetClass-1.3.12/selection.src.js"></script>
<script src="libs/rglwidgetClass-1.3.12/rglTimer.src.js"></script>
<script src="libs/rglwidgetClass-1.3.12/pretty.src.js"></script>
<script src="libs/rglwidgetClass-1.3.12/axes.src.js"></script>
<script src="libs/rglwidgetClass-1.3.12/animation.src.js"></script>
<script src="libs/CanvasMatrix4-1.3.12/CanvasMatrix.src.js"></script>


<style type="text/css">
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span { line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
pre.sourceCode { margin: 0; }
@media screen {
Expand Down Expand Up @@ -114,7 +114,7 @@
code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
code span.at { color: #7d9029; } /* Attribute */
code span.bn { color: #40a070; } /* BaseN */
code span.bu { } /* BuiltIn */
code span.bu { color: #008000; } /* BuiltIn */
code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
code span.ch { color: #4070a0; } /* Char */
code span.cn { color: #880000; } /* Constant */
Expand All @@ -127,7 +127,7 @@
code span.ex { } /* Extension */
code span.fl { color: #40a070; } /* Float */
code span.fu { color: #06287e; } /* Function */
code span.im { } /* Import */
code span.im { color: #008000; font-weight: bold; } /* Import */
code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
code span.kw { color: #007020; font-weight: bold; } /* Keyword */
code span.op { color: #666666; } /* Operator */
Expand All @@ -145,6 +145,28 @@

div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
</style>
<style type="text/css">
/* Used with Pandoc 2.11+ new --citeproc when CSL is used */
div.csl-bib-body { }
div.csl-entry {
clear: both;
}
.hanging div.csl-entry {
margin-left:2em;
text-indent:-2em;
}
div.csl-left-margin {
min-width:2em;
float:left;
}
div.csl-right-inline {
margin-left:2em;
padding-left:1em;
}
div.csl-indent {
margin-left: 2em;
}
</style>

<link rel="stylesheet" href="style.css" type="text/css" />
</head>
Expand Down Expand Up @@ -205,7 +227,11 @@
<li class="chapter" data-level="4.1.2" data-path="details-of-specific-functions.html"><a href="details-of-specific-functions.html#time-slicing"><i class="fa fa-check"></i><b>4.1.2</b> Time-slicing</a></li>
</ul></li>
<li class="chapter" data-level="4.2" data-path="details-of-specific-functions.html"><a href="details-of-specific-functions.html#custom-subsets"><i class="fa fa-check"></i><b>4.2</b> Customised subsets</a></li>
<li class="chapter" data-level="4.3" data-path="details-of-specific-functions.html"><a href="details-of-specific-functions.html#bootstraps-and-rarefactions"><i class="fa fa-check"></i><b>4.3</b> Bootstraps and rarefactions</a></li>
<li class="chapter" data-level="4.3" data-path="details-of-specific-functions.html"><a href="details-of-specific-functions.html#bootstraps-and-rarefactions"><i class="fa fa-check"></i><b>4.3</b> Bootstraps and rarefactions</a>
<ul>
<li class="chapter" data-level="4.3.1" data-path="details-of-specific-functions.html"><a href="details-of-specific-functions.html#bootstrapping-with-probabilities"><i class="fa fa-check"></i><b>4.3.1</b> Bootstrapping with probabilities</a></li>
<li class="chapter" data-level="4.3.2" data-path="details-of-specific-functions.html"><a href="details-of-specific-functions.html#bootstrapping-dimensions"><i class="fa fa-check"></i><b>4.3.2</b> Bootstrapping dimensions</a></li>
</ul></li>
<li class="chapter" data-level="4.4" data-path="details-of-specific-functions.html"><a href="details-of-specific-functions.html#disparity-metrics"><i class="fa fa-check"></i><b>4.4</b> Disparity metrics</a>
<ul>
<li class="chapter" data-level="4.4.1" data-path="details-of-specific-functions.html"><a href="details-of-specific-functions.html#the-function-dimension-levels"><i class="fa fa-check"></i><b>4.4.1</b> The function dimension-levels</a></li>
Expand Down Expand Up @@ -247,6 +273,11 @@
<li class="chapter" data-level="4.12.2" data-path="details-of-specific-functions.html"><a href="details-of-specific-functions.html#visualising-covar-objects"><i class="fa fa-check"></i><b>4.12.2</b> Visualising covar objects</a></li>
<li class="chapter" data-level="4.12.3" data-path="details-of-specific-functions.html"><a href="details-of-specific-functions.html#disparity-analyses-with-a-covar-component"><i class="fa fa-check"></i><b>4.12.3</b> Disparity analyses with a <code>$covar</code> component</a></li>
</ul></li>
<li class="chapter" data-level="4.13" data-path="details-of-specific-functions.html"><a href="details-of-specific-functions.html#disparity-and-distances"><i class="fa fa-check"></i><b>4.13</b> Disparity and distances</a>
<ul>
<li class="chapter" data-level="4.13.1" data-path="details-of-specific-functions.html"><a href="details-of-specific-functions.html#disparity-data-is-a-distance"><i class="fa fa-check"></i><b>4.13.1</b> Disparity data is a distance</a></li>
<li class="chapter" data-level="4.13.2" data-path="details-of-specific-functions.html"><a href="details-of-specific-functions.html#disparity-metric-is-a-distance"><i class="fa fa-check"></i><b>4.13.2</b> Disparity metric is a distance</a></li>
</ul></li>
</ul></li>
<li class="chapter" data-level="5" data-path="making-stuff-up.html"><a href="making-stuff-up.html"><i class="fa fa-check"></i><b>5</b> Making stuff up!</a>
<ul>
Expand Down Expand Up @@ -295,7 +326,7 @@
<ul>
<li class="chapter" data-level="7.3.1" data-path="the-guts-of-the-disprity-package.html"><a href="the-guts-of-the-disprity-package.html#matrix"><i class="fa fa-check"></i><b>7.3.1</b> <code>$matrix</code></a></li>
<li class="chapter" data-level="7.3.2" data-path="the-guts-of-the-disprity-package.html"><a href="the-guts-of-the-disprity-package.html#call"><i class="fa fa-check"></i><b>7.3.2</b> <code>$call</code></a></li>
<li class="chapter" data-level="7.3.3" data-path="the-guts-of-the-disprity-package.html"><a href="the-guts-of-the-disprity-package.html#subsets"><i class="fa fa-check"></i><b>7.3.3</b> <code>$subsets</code></a></li>
<li class="chapter" data-level="7.3.3" data-path="the-guts-of-the-disprity-package.html"><a href="the-guts-of-the-disprity-package.html#subsets-1"><i class="fa fa-check"></i><b>7.3.3</b> <code>$subsets</code></a></li>
<li class="chapter" data-level="7.3.4" data-path="the-guts-of-the-disprity-package.html"><a href="the-guts-of-the-disprity-package.html#disparity"><i class="fa fa-check"></i><b>7.3.4</b> <code>$disparity</code></a></li>
</ul></li>
</ul></li>
Expand Down
Loading

0 comments on commit ee9824f

Please sign in to comment.