├── tutorial
├── images
│ ├── README.md
│ ├── 2 mods.png
│ ├── 3trees.png
│ ├── 2 models.png
│ ├── 3bigtrees.png
│ ├── ancniche1.png
│ ├── ancniche2.png
│ ├── clipdemo.png
│ ├── rarefied.png
│ ├── respplot1.png
│ ├── respplot2.png
│ ├── respplot3.png
│ ├── respplot4.png
│ ├── treeplot.png
│ ├── treeplot1.png
│ ├── treeplot2.png
│ ├── 2 mods rare.png
│ ├── binarydemo.png
│ ├── bio1 w pts.png
│ ├── simpletree.png
│ ├── currentmodels1.png
│ ├── currentmodels2.png
│ ├── currentmodels3.png
│ ├── currentmodels4.png
│ ├── currentmodels5.png
│ ├── multipleclimates.png
│ ├── multipletimeslices.png
│ └── machurukuLogoShamelessFrog.jpg
├── climate.zip
├── basslerigroup.csv
├── basslerigroup.treefile
├── tutorial.R
├── posterior.trees
└── readme.md
├── machuruku.Rproj
├── DESCRIPTION
├── NAMESPACE
├── man
├── machu.ace.load.Rd
├── machu.occ.rarefy.Rd
├── machu.treeplot.Rd
├── machu.plotmap.Rd
├── machu.respplot.Rd
├── machu.1.tip.resp.Rd
├── machu.tree.unc.Rd
├── machu.2.ace.Rd
├── machu.top.env.Rd
└── machu.3.anc.niche.Rd
└── README.md
/tutorial/images/README.md:
--------------------------------------------------------------------------------
1 | Just for pics
2 |
--------------------------------------------------------------------------------
/tutorial/climate.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wxguillo/machuruku/HEAD/tutorial/climate.zip
--------------------------------------------------------------------------------
/tutorial/images/2 mods.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wxguillo/machuruku/HEAD/tutorial/images/2 mods.png
--------------------------------------------------------------------------------
/tutorial/images/3trees.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wxguillo/machuruku/HEAD/tutorial/images/3trees.png
--------------------------------------------------------------------------------
/tutorial/images/2 models.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wxguillo/machuruku/HEAD/tutorial/images/2 models.png
--------------------------------------------------------------------------------
/tutorial/images/3bigtrees.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wxguillo/machuruku/HEAD/tutorial/images/3bigtrees.png
--------------------------------------------------------------------------------
/tutorial/images/ancniche1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wxguillo/machuruku/HEAD/tutorial/images/ancniche1.png
--------------------------------------------------------------------------------
/tutorial/images/ancniche2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wxguillo/machuruku/HEAD/tutorial/images/ancniche2.png
--------------------------------------------------------------------------------
/tutorial/images/clipdemo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wxguillo/machuruku/HEAD/tutorial/images/clipdemo.png
--------------------------------------------------------------------------------
/tutorial/images/rarefied.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wxguillo/machuruku/HEAD/tutorial/images/rarefied.png
--------------------------------------------------------------------------------
/tutorial/images/respplot1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wxguillo/machuruku/HEAD/tutorial/images/respplot1.png
--------------------------------------------------------------------------------
/tutorial/images/respplot2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wxguillo/machuruku/HEAD/tutorial/images/respplot2.png
--------------------------------------------------------------------------------
/tutorial/images/respplot3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wxguillo/machuruku/HEAD/tutorial/images/respplot3.png
--------------------------------------------------------------------------------
/tutorial/images/respplot4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wxguillo/machuruku/HEAD/tutorial/images/respplot4.png
--------------------------------------------------------------------------------
/tutorial/images/treeplot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wxguillo/machuruku/HEAD/tutorial/images/treeplot.png
--------------------------------------------------------------------------------
/tutorial/images/treeplot1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wxguillo/machuruku/HEAD/tutorial/images/treeplot1.png
--------------------------------------------------------------------------------
/tutorial/images/treeplot2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wxguillo/machuruku/HEAD/tutorial/images/treeplot2.png
--------------------------------------------------------------------------------
/tutorial/images/2 mods rare.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wxguillo/machuruku/HEAD/tutorial/images/2 mods rare.png
--------------------------------------------------------------------------------
/tutorial/images/binarydemo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wxguillo/machuruku/HEAD/tutorial/images/binarydemo.png
--------------------------------------------------------------------------------
/tutorial/images/bio1 w pts.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wxguillo/machuruku/HEAD/tutorial/images/bio1 w pts.png
--------------------------------------------------------------------------------
/tutorial/images/simpletree.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wxguillo/machuruku/HEAD/tutorial/images/simpletree.png
--------------------------------------------------------------------------------
/tutorial/images/currentmodels1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wxguillo/machuruku/HEAD/tutorial/images/currentmodels1.png
--------------------------------------------------------------------------------
/tutorial/images/currentmodels2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wxguillo/machuruku/HEAD/tutorial/images/currentmodels2.png
--------------------------------------------------------------------------------
/tutorial/images/currentmodels3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wxguillo/machuruku/HEAD/tutorial/images/currentmodels3.png
--------------------------------------------------------------------------------
/tutorial/images/currentmodels4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wxguillo/machuruku/HEAD/tutorial/images/currentmodels4.png
--------------------------------------------------------------------------------
/tutorial/images/currentmodels5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wxguillo/machuruku/HEAD/tutorial/images/currentmodels5.png
--------------------------------------------------------------------------------
/tutorial/images/multipleclimates.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wxguillo/machuruku/HEAD/tutorial/images/multipleclimates.png
--------------------------------------------------------------------------------
/tutorial/images/multipletimeslices.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wxguillo/machuruku/HEAD/tutorial/images/multipletimeslices.png
--------------------------------------------------------------------------------
/tutorial/images/machurukuLogoShamelessFrog.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wxguillo/machuruku/HEAD/tutorial/images/machurukuLogoShamelessFrog.jpg
--------------------------------------------------------------------------------
/machuruku.Rproj:
--------------------------------------------------------------------------------
1 | Version: 1.0
2 |
3 | RestoreWorkspace: No
4 | SaveWorkspace: No
5 | AlwaysSaveHistory: Default
6 |
7 | EnableCodeIndexing: Yes
8 | UseSpacesForTab: Yes
9 | NumSpacesForTab: 2
10 | Encoding: UTF-8
11 |
12 | RnwWeave: Sweave
13 | LaTeX: pdfLaTeX
14 |
15 | AutoAppendNewline: Yes
16 | StripTrailingWhitespace: Yes
17 | LineEndingConversion: Posix
18 |
19 | BuildType: Package
20 | PackageUseDevtools: Yes
21 | PackageInstallArgs: --no-multiarch --with-keep.source
22 | PackageRoxygenize: rd,collate,namespace
23 |
--------------------------------------------------------------------------------
/DESCRIPTION:
--------------------------------------------------------------------------------
1 | Package: machuruku
2 | Title: Ancestral niche reconstruction
3 | Version: 2.0.4
4 | Date: 2025-01-06
5 | Authors@R: c(
6 | person("Wilson", "Guillory", email = "wxg1@rutgers.edu", role = c("aut", "cre")),
7 | person("Jason", "Brown", email = "jason.brown@siu.edu", role = "aut"))
8 | Description: Reconstruct and visualize ancestral niches
9 | License: GPL (>= 3)
10 | Encoding: UTF-8
11 | LazyData: true
12 | Roxygen: list(markdown = TRUE)
13 | RoxygenNote: 7.3.2
14 | Imports: ape, dismo, dplyr, gbm, mgsub, phytools, raster, scales, sf, sn, sp, terra, treeio, spatstat.geom, TeachingDemos
15 | URL: https://github.com/wxguillo/machuruku/
16 |
--------------------------------------------------------------------------------
/NAMESPACE:
--------------------------------------------------------------------------------
1 | # Generated by roxygen2: do not edit by hand
2 |
3 | export(machu.1.tip.resp)
4 | export(machu.2.ace)
5 | export(machu.3.anc.niche)
6 | export(machu.ace.load)
7 | export(machu.occ.rarefy)
8 | export(machu.plotmap)
9 | export(machu.respplot)
10 | export(machu.top.env)
11 | export(machu.tree.unc)
12 | export(machu.treeplot)
13 | import(RColorBrewer)
14 | import(TeachingDemos)
15 | import(ape)
16 | import(dismo)
17 | import(dplyr)
18 | import(gbm)
19 | import(mgsub)
20 | import(phytools)
21 | import(raster)
22 | import(scales)
23 | import(sf)
24 | import(sn)
25 | import(sp)
26 | import(terra)
27 | import(treeio)
28 | importFrom(spatstat.geom,nndist)
29 |
--------------------------------------------------------------------------------
/man/machu.ace.load.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/machuruku_code.R
3 | \name{machu.ace.load}
4 | \alias{machu.ace.load}
5 | \title{Load saved ace outputs from .csv file}
6 | \usage{
7 | machu.ace.load(file)
8 | }
9 | \arguments{
10 | \item{file}{String specifying the file to load.}
11 | }
12 | \value{
13 | A list of one element per scenario, either one or more timeslices or all tips and nodes, each a table of reconstructed climate response parameters.
14 | }
15 | \description{
16 | Loads outputs saved with the 'csv.name' argument of machu.2.ace() into a format compatible with machu.3.anc.niche().
17 | }
18 | \details{
19 | Because of the idiosyncrasies of the machu.2.ace() code, the result of machu.ace.load() is not technically identical to one obtained from the former function. Both should be compatible with machu.3.anc.niche(), but let me know if you encounter bugs.
20 | }
21 | \examples{
22 | ace <- machu.ace.load("ace.csv")
23 | }
24 |
--------------------------------------------------------------------------------
/man/machu.occ.rarefy.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/machuruku_code.R
3 | \name{machu.occ.rarefy}
4 | \alias{machu.occ.rarefy}
5 | \title{Rarefy occurrence points}
6 | \usage{
7 | machu.occ.rarefy(
8 | in.pts,
9 | colxy = 2:3,
10 | rarefy.dist = 0,
11 | rarefy.units = "km",
12 | plot = F,
13 | verbose = T
14 | )
15 | }
16 | \arguments{
17 | \item{in.pts}{Input dataframe.}
18 |
19 | \item{colxy}{Columns corresponding to longitude, then latitude. Default = 2:3.}
20 |
21 | \item{rarefy.dist}{Distance to rarefy points (values need to be in km (recommended) or decimal degrees). See associated parameter rarefy.units. Default = 0.}
22 |
23 | \item{rarefy.units}{The units of the rarefy.dist parameter, either "km" for kilometers or "dd" for decimal degrees. Default = "km".}
24 |
25 | \item{plot}{Creates an optional plot visualizing the points removed and kept. Default = F.}
26 |
27 | \item{verbose}{If verbose=T, text boxes displaying progress will be displayed. Default = T.}
28 | }
29 | \value{
30 | A dataframe with rarefied occurrence data.
31 | }
32 | \description{
33 | Rarefy spatial occurrence points to reduce spatial autocorrelation and model bias. This is a modified version of humboldt.occ.rarefy() from humboldt.
34 | }
35 | \details{
36 | A script to systematically select localities within a specified area at specified spatial resolution. The outcome is always the same and is not random. This reduces sampling biases in downstream analyses- you should do it! Output is a reduced dataset with less spatial autocorrelation.
37 | }
38 | \examples{
39 | ##remove occurrences closer than a minimum distance to each other (remove aggregation). Setting min.dist=0 will remove no occurrence.
40 | occ <- machu.occ.rarefy(in.pts = occ, colxy = 2:3, rarefy.dist = 50, rarefy.units = "km")
41 | }
42 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # machuruku
2 | Machuruku is an R package for reconstructing the ancestral distributions of lineages with phylogenetic niche modeling. The package takes present-day occurrence data, a time-calibrated phylogeny, and past and present climate data to infer and visualize the ancient niches of species.
3 | ## Jan 6 2025: Machuruku 2.0.4 released
4 | Several bug fixes and (tiny) new features.
5 | ### June 5 2024: Machuruku 2.0.3 released
6 | Small patch fixing a bug in machu.1.tip.resp().
7 | ### August 7 2023: Machuruku 2.0 released
8 | The new version of Machuruku is now available via Github. Machuruku 2.0 has been rewritten from the ground up, with quicker code, cleaner graphics, and the ability to reconstruct and project multiple timeslices and paleoclimates all in one command. Visit the revamped [tutorial](https://github.com/wxguillo/machuruku/tree/main/tutorial#machuruku-the-tutorial-20) for an in-depth guide to using Machuruku 2.0.
9 | ### Install
10 | To install Machuruku, simply use the `install_github()` function from `devtools`:
11 | ```
12 | install.packages("devtools")
13 | devtools::install_github("wxguillo/machuruku")
14 | ```
15 | You may encounter an error trying to install the "Treeio" package, which is not on CRAN. Install it with the following and try the above installation again:
16 | ```
17 | if (!require("BiocManager", quietly = TRUE))
18 | install.packages("BiocManager")
19 | BiocManager::install("treeio")
20 | ```
21 | Load up Machuruku by running:
22 | ```
23 | library(machuruku)
24 | ```
25 | You can test if the function worked by typing `machu` into the console (in RStudio) and seeing if all of the functions appear in autofill.
26 |
27 | ### *Software citation and associated manuscript:*
28 | > Guillory WG, Brown JL. 2021. A new method for integrating ecological niche modeling with phylogenetics to estimate ancestral distributions. Systematic Biology, 70(5):1033-1045. [Link.](https://academic.oup.com/sysbio/advance-article-abstract/doi/10.1093/sysbio/syab016/6171196) (Email me at wxg1@rutgers.edu for PDF)
29 |
30 | 
31 |
--------------------------------------------------------------------------------
/tutorial/basslerigroup.csv:
--------------------------------------------------------------------------------
1 | species,long_DD,lat_DD
2 | bassleri,-76.9412,-6.77107
3 | bassleri,-76.856444,-6.922417
4 | bassleri,-76.83384304,-6.899267966
5 | bassleri,-76.82824401,-6.896087034
6 | bassleri,-76.783333,-6.216667
7 | bassleri,-76.77518333,-6.355816667
8 | bassleri,-76.760604,-6.67039
9 | bassleri,-76.757121,-6.390835
10 | bassleri,-76.74799,-6.407599
11 | bassleri,-76.744531,-6.408326
12 | bassleri,-76.74032103,-6.867241971
13 | bassleri,-76.74032103,-6.867241971
14 | bassleri,-76.73501302,-6.865056977
15 | bassleri,-76.73002596,-6.862282986
16 | bassleri,-76.72911111,-6.293361111
17 | bassleri,-76.727389,-6.346818
18 | bassleri,-76.696807,-6.32062
19 | bassleri,-76.695669,-6.30899
20 | bassleri,-76.694319,-6.309207
21 | bassleri,-76.62159,-6.63376
22 | bassleri,-76.619851,-6.617181
23 | bassleri,-76.6044444,-6.3781409
24 | bassleri,-76.576848,-6.590906
25 | bassleri,-76.363357,-6.35768
26 | bassleri,-76.34884668,-6.454666676
27 | bassleri,-76.347539,-6.456591
28 | bassleri,-76.346706,-6.452766
29 | bassleri,-76.30297,-6.47152
30 | bassleri,-76.29122729,-6.420741258
31 | bassleri,-76.288211,-6.369338
32 | bassleri,-76.23663001,-6.694973409
33 | bassleri,-76.187057,-6.615531
34 | bassleri,-76.18056,-6.61667
35 | bassleri,-76.14583271,-6.558522061
36 | bassleri,-76.10316,-6.541788
37 | bassleri,-75.96421614,-6.571876947
38 | bassleri,-75.92120055,-6.527889809
39 | pepperi,-76.814603,-7.365329
40 | pepperi,-76.810738,-7.347468
41 | pepperi,-76.69394,-7.569276
42 | pepperi,-76.69333333,-7.566083333
43 | pepperi,-76.681314,-7.832224
44 | pepperi,-76.68030556,-7.617805556
45 | pepperi,-76.67711111,-8.308416667
46 | pepperi,-76.672636,-7.89132
47 | pepperi,-76.667542,-7.70379
48 | pepperi,-76.664801,-7.427395
49 | silverstonei,-76.096094,-8.487367
50 | silverstonei,-75.834701,-9.188031
51 | silverstonei,-75.832237,-9.22039
52 | silverstonei,-75.803502,-9.161159
53 | silverstonei,-75.803502,-9.161159
54 | silverstonei,-75.8,-9.1
55 | silverstonei,-75.796886,-9.19637
56 | silverstonei,-75.793541,-9.187694
57 | silverstonei,-75.792986,-9.182495
58 | silverstonei,-75.788889,-9.188889
59 | silverstonei,-76.163904,-8.466559
60 | silverstonei,-75.685422,-9.117451
61 | silverstonei,-75.741865,-9.198972
62 | silverstonei,-76.178936,-9.308604
63 | silverstonei,-75.5833,-9.05
64 | yoshina,-76.26118216,-7.033138881
65 | yoshina,-76.092042,-7.036022
66 | yoshina,-76.090802,-7.036715
67 | yoshina,-76.07806,-6.9422
68 | yoshina,-76.047381,-7.11757
69 | yoshina,-75.92175099,-6.588565987
70 | yoshina,-75.920459,-6.588714011
71 | yoshina,-75.91939,-6.588993
72 | yoshina,-75.917354,-6.588226
73 | yoshina,-74.95977,-7.198741
74 | yoshina,-74.950656,-7.195998
75 |
--------------------------------------------------------------------------------
/man/machu.treeplot.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/machuruku_code.R
3 | \name{machu.treeplot}
4 | \alias{machu.treeplot}
5 | \title{Plot trees to visualize each step in the Machuruku process}
6 | \usage{
7 | machu.treeplot(
8 | tree,
9 | timeslice = NULL,
10 | nodelabs = T,
11 | nodelabsize = 0.5,
12 | col = "red",
13 | x.u.lim = NULL,
14 | x.l.lim = NULL,
15 | timelabs = T,
16 | timelabsize = 0.8,
17 | timelaboffset = -0.35,
18 | decimals = 2
19 | )
20 | }
21 | \arguments{
22 | \item{tree}{Tree input. Can be a single tree in phylo format, or a list of trees. Untested with other formats.}
23 |
24 | \item{timeslice}{Numeric vector with the timeslices to plot, if any.}
25 |
26 | \item{nodelabs}{Whether to plot labels identifying each node. Default = T.}
27 |
28 | \item{nodelabsize}{This is given to the circle.exp arg of phytools::labelnodes(). Default = 0.5, which is optimized for simple trees.}
29 |
30 | \item{col}{Color of the timeslices. Default = "red".}
31 |
32 | \item{x.u.lim}{Upper limit of the x-axis (i.e. right side of plot). By default this is the order of magnitude of the tree height, which is usually enough to accommodate decently sized taxon names. If you have longer names you can manually adjust this value.}
33 |
34 | \item{x.l.lim}{Lower limit of the x-axis (i.e. left side of plot). By default this is scaled by the order of magnitude of the tree height. If you have your own scale in mind you can override the default.}
35 |
36 | \item{timelabs}{Whether to plot divergence time labels at each node. Default = T.}
37 |
38 | \item{timelabsize}{Size of div time labels. Default = 0.8, which is optimized for simple trees.}
39 |
40 | \item{timelaboffset}{Offset of div time labels from their respective nodes. Default = -0.35, which is optimized for simple trees. Making this number more negative will offset the labels further to the right.}
41 |
42 | \item{decimals}{Specify number of decimal places displayed in the node (divergence time) labels. Default = 2.}
43 | }
44 | \value{
45 | Plots a tree or tree with node labels, divergence times, and time-slices.
46 | }
47 | \description{
48 | Visualize trees to help with interpreting Machuruku analysis and results. Will plot a single tree or multiple trees (i.e. the results of machu.tree.unc) on the same axis. Node numbers/IDs and divergence times can be visualized. Timeslices can be plotted to visualize which "branch-taxa" may be returned at a given time-slice.
49 | }
50 | \details{
51 | This function tends to generate warnings that shouldn't affect the output. You can turn them off with options(warn=-1).
52 | }
53 | \examples{
54 | # plot tree by itself
55 | machu.treeplot(tree)
56 | # plot with three timeslices
57 | machu.treeplot(tree, c(1e6, 2e6, 3e6))
58 | }
59 |
--------------------------------------------------------------------------------
/man/machu.plotmap.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/machuruku_code.R
3 | \name{machu.plotmap}
4 | \alias{machu.plotmap}
5 | \title{Map model output from machu.3.anc.niche()}
6 | \usage{
7 | machu.plotmap(
8 | model,
9 | col = 1,
10 | axes = T,
11 | title = T,
12 | title.cex = 1,
13 | to.scale = F,
14 | plot = "separately",
15 | plot.asp = 16/9
16 | )
17 | }
18 | \arguments{
19 | \item{model}{Output from machu.3.anc.niche(), a list of lists of SpatRasters, generally one per taxon per timeslice. Subsettable, though this may interfere with the format of titles.}
20 |
21 | \item{col}{Desired color ramp, usually a numeric value from 1 to 6. 1 = base; 2 = plasma; 3 = viridis; 4 = l17 pure white; 5 = r3 pure blue; 6 = black and white. Ramps can also be specified with strings, e.g. "viridis" or "v". Custom color ramps (character vectors with length > 1) can also be supplied, for example by the colorRampPalette function. Default = 1 ("base").}
22 |
23 | \item{axes}{Whether to display axes (lat/long). Default = T.}
24 |
25 | \item{title}{Whether to display titles. These are supposed to take the format "timeslice, taxon", but certain input formats from machu.3.anc.niche, or subsetting the input, may interfere with this. Default = T.}
26 |
27 | \item{title.cex}{Specify size of titles. Default = 1.}
28 |
29 | \item{to.scale}{Whether to color each raster according to the same scale (i.e., the min and max value among all rasters) so that they can be directly compared. Default = F.}
30 |
31 | \item{plot}{How to arrange plots of multiple climate variables. When "separate", plot each in its own window. When "together", plot all in the same window, using n2mfrow to calculate the best arrangement given a specified aspect ratio ('plot.asp'). Default = "separately".}
32 |
33 | \item{plot.asp}{Aspect ratio used to calculate the best arrangement of plots when plot="together". Default = 16/9.}
34 | }
35 | \value{
36 | Plots of niche models in various configurations.
37 | }
38 | \description{
39 | Plot one or more niche models using model output from machu.3.anc.niche(). User can specify color ramps inspired by the viridis package and plot maps in various configurations.
40 | }
41 | \details{
42 | Titles may not display properly (timeslice, taxon) depending on the input format from machu.3.anc.niche and the amount of subsetting of the input.
43 |
44 | Implementing scale bars was more trouble than I wanted to deal with so currently they are not supported with this function. Using the plot() function will automatically generate one for your raster though.
45 |
46 | When to.scale=T, the function calculates the minimum and maximum suitability value among all the input rasters, and scales the color for each one using this range. This enables the rasters to be directly compared; as such, when to.scale=F, comparing the rasters can be misleading.
47 | }
48 | \examples{
49 | # plot all models, separately, with default color ramp, axes, and titles
50 | machu.plotmap(model)
51 | # together
52 | machu.plotmap(model, plot="t")
53 | # no axes or titles
54 | machu.plotmap(model, plot="t", axes=F, title=F)
55 | # plot all rasters on the same color scale
56 | machu.plotmap(model, plot="t", axes=F, title=F, to.scale=T)
57 |
58 | # plot only the first raster, using the "viridis" color ramp
59 | machu.plotmap(model[[1]][[1]], col=3)
60 |
61 | # plot only rasters from the first timeslice/scenario, using a custom "Mardi Gras" color ramp
62 | mardi.gras <- colorRampPalette(c("purple", "forestgreen", "gold"))(256)
63 | machu.plotmap(model[[1]], col=mardi.gras, plot="t")
64 | }
65 |
--------------------------------------------------------------------------------
/man/machu.respplot.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/machuruku_code.R
3 | \name{machu.respplot}
4 | \alias{machu.respplot}
5 | \title{Visualize response curves of taxa to climate variables}
6 | \usage{
7 | machu.respplot(
8 | x,
9 | taxa = NULL,
10 | clim = NULL,
11 | lty = 1,
12 | lwd = 1,
13 | col = NULL,
14 | fill = F,
15 | plot = "separate",
16 | plot.asp = 16/9,
17 | legend.cex = 1
18 | )
19 | }
20 | \arguments{
21 | \item{x}{Main input, either output from machu.1.tip.resp() or from machu.2.ace(). In the case of the latter it must be a single subsetted list element, i.e. ace[\link{1}]. If uncertainty was included from the machu.2.ace analysis, the plots will visualize it.}
22 |
23 | \item{taxa}{Taxa to be plotted, a character or numeric vector specifying the desired taxa names or indices. If NULL, all taxa will be plotted.}
24 |
25 | \item{clim}{Climate variables to be plotted, a character vector. If NULL, all climate variables will be plotted.}
26 |
27 | \item{lty}{Line type for the plots. Default = 1 (solid line).}
28 |
29 | \item{lwd}{Line width for the plots. Default = 1.}
30 |
31 | \item{col}{Colors for the plots. If NULL, defaults to the "Set2" palette from RColorBrewer.}
32 |
33 | \item{fill}{Whether to fill the area beneath each response curve. Default = F.}
34 |
35 | \item{plot}{How to arrange plots of multiple climate variables. When "separate", plot each in its own window. When "together", plot all in the same window, using n2mfrow to calculate the best arrangement given a specified aspect ratio ('plot.asp'). Default = "separate"}
36 |
37 | \item{plot.asp}{Aspect ratio used to calculate the best arrangement of plots when plot="together". Default = 16/9.}
38 |
39 | \item{legend.cex}{Size of the taxon legend. Default = 1.}
40 | }
41 | \value{
42 | Displays a plot or plots showing the response of the specified taxa to the specified climate variable(s).
43 | }
44 | \description{
45 | Visualize response curves for taxa and climate variables. The main input can be either a "response table" (machu.1.tip.resp() output), for visualizing present-day taxa, or "ace table" (subsetted machu.2.ace() output), for visualizing ancestral taxa. In the case when uncertainty for reconstructed parameters is retained by machu.2.ace() (when unc=T), the function will visualize this uncertainty by reconstructing every possible combination of skew-normal distribution parameters (n=27) plus the median distribution as a thick dashed line.
46 | }
47 | \examples{
48 | # Plot the responses of every taxon to every climate variable, together in the same window
49 | machu.respplot(resp, plot="t")
50 | # Plot the response of only the first taxon to the first climate variable, filling in the area under the curve
51 | dev.off()
52 | machu.respplot(resp, taxa=1, clim="bio1", fill=T)
53 | # Plot the response of the first three taxa to the first three climate variables, in separate windows
54 | machu.respplot(resp, taxa=1:3, clim=c("bio1", "bio2", "bio3"), fill=T, plot="s")
55 |
56 | # Plot the response of ancestral taxa at 1 Ma, without uncertainty
57 | ace <- machu.2.ace(resp, tree, timeslice=1e6)
58 | machu.respplot(ace[[1]], fill=T, plot="t")
59 | # Plot the response of ancestral taxa at 1 Ma, with uncertainty
60 | dev.off()
61 | ace <- machu.2.ace(resp, tree, timeslice=1e6, unc=T)
62 | machu.respplot(ace[[1]], fill=T, plot="t")
63 |
64 | # Compare the responses of present-day to ancestral (nodal) taxa with respect to the first climate variable
65 | dev.off()
66 | ace <- machu.2.ace(resp, tree)
67 | machu.respplot(ace[[1]], clim="bio1", fill=T)
68 | }
69 |
--------------------------------------------------------------------------------
/tutorial/basslerigroup.treefile:
--------------------------------------------------------------------------------
1 | #NEXUS
2 | [R-package treeio, Mon Feb 25 11:28:19 2019]
3 |
4 | BEGIN TAXA;
5 | DIMENSIONS NTAX = 4;
6 | TAXLABELS
7 | bassleri
8 | pepperi
9 | silverstonei
10 | yoshina
11 | ;
12 | END;
13 | BEGIN TREES;
14 | TRANSLATE
15 | 1 bassleri,
16 | 2 pepperi,
17 | 3 silverstonei,
18 | 4 yoshina
19 | ;
20 | tree TREE1 = (((1[&height=3.25999272756837e-15,height_0.95_HPD={0,7.105427357601e-15},height_median=3.5527136788005e-15,height_range={0,2.1316282072803e-14},length=2.26755353688295,length_0.95_HPD={1.03077477550461,3.66571928153369},length_median=2.1792168263977,length_range={0.342903878944521,7.90675448110852},rate=0.000919315409686793,rate_0.95_HPD={0.000394766517393127,0.00154338630813145},rate_median=0.000870970829253903,rate_range={0.000231033905621041,0.00663208946858529}]:2.267553537,4[&height=3.25999272756837e-15,height_0.95_HPD={0,7.105427357601e-15},height_median=3.5527136788005e-15,height_range={0,2.1316282072803e-14},length=2.26755353688295,length_0.95_HPD={1.03077477550461,3.66571928153369},length_median=2.1792168263977,length_range={0.342903878944521,7.90675448110852},rate=0.000974952863754105,rate_0.95_HPD={0.000402891061622334,0.00168235193654613},rate_median=0.000911900497687993,rate_range={0.000226948759758967,0.00548342434456074}]:2.267553537)[&height=2.26755353688295,height_0.95_HPD={1.03077477550461,3.66571928153369},height_median=2.17921682639771,height_range={0.342903878944522,7.90675448110852},length=0.442861898223361,length_0.95_HPD={0.0157926108197657,1.03149856518258},length_median=0.375049498486032,length_range={2.18611080278208e-05,4.19169823687587},posterior=1,rate=0.0009230335295811,rate_0.95_HPD={0.000346369841227789,0.00163856447870245},rate_median=0.000859364256736646,rate_range={0.000190683461357139,0.00501938119343541}]:0.4428618982,2[&height=3.278075017915e-15,height_0.95_HPD={0,7.105427357601e-15},height_median=3.5527136788005e-15,height_range={0,2.1316282072803e-14},length=2.71041543510632,length_0.95_HPD={1.31219070222769,4.25558182222323},length_median=2.6155413631052,length_range={0.457371494693906,8.57431264912568},rate=0.000939931460670043,rate_0.95_HPD={0.000396676986985984,0.00157852665554756},rate_median=0.000888926194463224,rate_range={0.000201841793524262,0.00510590989357856}]:2.710415435)[&height=2.71041543510632,height_0.95_HPD={1.31219070222769,4.25558182222323},height_median=2.6155413631052,height_range={0.457371494693907,8.57431264912568},length=7.65399058672133,length_0.95_HPD={4.59231070324951,10.9109562208124},length_median=7.55800965816621,length_range={2.05582715454573,17.2030008443713},posterior=1,rate=0.000574012193392192,rate_0.95_HPD={0.000283525687298964,0.000888260148946371},rate_median=0.000553260067166774,rate_range={0.000164796724556472,0.00209881972113488}]:8.866762814,3[&height=3.2695765881409e-15,height_0.95_HPD={0,7.105427357601e-15},height_median=3.5527136788005e-15,height_range={0,2.1316282072803e-14},length=11.5771782489236,length_0.95_HPD={7.11293525116327,16.2073401636718},length_median=11.4578185903385,length_range={2.79956059875788,24.037931362354},rate=0.000488762269753386,rate_0.95_HPD={0.000270301842636014,0.000735061191379538},rate_median=0.000471716095433808,rate_range={0.000166500618552396,0.00209881972113488}]:11.57717825)[&height=11.5771782489236,height_0.95_HPD={7.11293525116327,16.2073401636718},height_median=11.4578185903385,height_range={2.79956059875788,24.037931362354},length=10.1857446566677,length_0.95_HPD={6.11063360124662,14.4965149692287},length_median=10.0964735517171,length_range={2.43797554339297,20.7033438269508},posterior=1,rate=0.0014362939725399,rate_0.95_HPD={0.000838402932135657,0.00217025568172616},rate_median=0.00138217224215513,rate_range={0.000543710710815007,0.00515224286088598}];
21 | END;
22 |
--------------------------------------------------------------------------------
/man/machu.1.tip.resp.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/machuruku_code.R
3 | \name{machu.1.tip.resp}
4 | \alias{machu.1.tip.resp}
5 | \title{Calculate tip climate response curves}
6 | \usage{
7 | machu.1.tip.resp(
8 | occ,
9 | clim,
10 | sp.col = 1,
11 | col.xy = 2:3,
12 | plot = "n",
13 | plot.points = F,
14 | plot.asp = 16/9,
15 | output.bioclim = F,
16 | jitter = F,
17 | verbose = F
18 | )
19 | }
20 | \arguments{
21 | \item{occ}{Occurrence data for each species, formatted as a dataframe. Each species must have at least 10 points.}
22 |
23 | \item{clim}{A single RasterStack of present-day climate data. A SpatRaster object is also acceptable.}
24 |
25 | \item{sp.col}{Integer specifying which column of the input occurrence data corresponds to species ID. Default = 1.}
26 |
27 | \item{col.xy}{vector specifying long (x) and lat (y) of occurrence data. Default = 2:3.}
28 |
29 | \item{plot}{Whether and how to make plots of present-day Bioclim models for each taxon. "separate": plot each model in its own window. "together": plot all models in the same window, arranged dynamically at a given aspect ratio. "n": default (no plot).}
30 |
31 | \item{plot.points}{If TRUE, plot each taxon's occurrence data on top of its corresponding niche model. Default = F.}
32 |
33 | \item{plot.asp}{Aspect ratio used to calculate the best arrangement of plots when plot="together". Default = 16/9.}
34 |
35 | \item{output.bioclim}{If TRUE, output a Bioclim niche model raster for each taxon instead of climate response curves.}
36 |
37 | \item{jitter}{If TRUE, slightly jitter climate response values after sampling. Use this to avoid certain errors that arise from low-variability climate responses}
38 |
39 | \item{verbose}{If TRUE, print progress updates to the screen.}
40 | }
41 | \value{
42 | Table consisting of the response of each species to the climate data. Each response is represented by a skew-normal distribution. Alternatively, the function can output the actual Bioclim niche models.
43 | }
44 | \description{
45 | For each taxon, construct a Bioclim species distribution model and estimate a response curve for each climate variable.
46 | }
47 | \details{
48 | This function uses the function dismo::bioclim() to construct present-day Bioclim niche models. It is only compatible with the older Raster package, so a SpatRaster object (from the newer Terra package) will automatically be converted before being passed to the rest of the function.
49 |
50 | Unfortunately the constraints of the 'sn::selm()' function disallow any taxa having fewer than 10 occurrence points. To that end, this function contains a utility to randomly sample occurrence points within the minimum convex polygon comprised of the occurrence data for species, up to n=10. When the plotting functionality is activated (i.e. plot="s" or plot="t"), these random points are drawn in red. In this case, the output of the function will be a list that contains the normal output (response table or niche models) as well as the occurrence data table with the newly added random points. Obviously, it is better to have at least 10 real occurrence points; however for rare species, or range-limited species after spatial rarefication, that may be difficult or impossible.
51 |
52 | The sn::selm function that is used to construct skew-normal distributions from sampled climate response values sometimes returns errors ("missing value where TRUE/FALSE needed") when the variation in the sampled climate responses is low. A simple workaround is to slightly jitter the climate response values, which introduces enough variation to let selm do its job, while only minimally affecting the result. Use jitter=T to turn this option on.
53 | }
54 | \examples{
55 | ## acceptable 'clim' formats
56 | # Single RasterStack (raster) (preferred)
57 | clim <- stack(list.files(rasterfolder, pattern="T0_", full.names=T))
58 | # Single SpatRaster (terra)
59 | clim <- c(rast(list.files(rasterfolder, pattern="T0_", full.names=T)))
60 |
61 | # basic
62 | response.table <- machu.1.tip.resp(occ, clim)
63 | # plot all plots separately
64 | response.table <- machu.1.tip.resp(occ, clim, plot="s")
65 | # plot all plots together, with points, at an aspect ratio of 16:10 (you have a 1600p screen)
66 | response.table <- machu.1.tip.resp(occ, clim, plot="t", plot.points=T, plot.asp=16/10)
67 | }
68 |
--------------------------------------------------------------------------------
/man/machu.tree.unc.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/machuruku_code.R
3 | \name{machu.tree.unc}
4 | \alias{machu.tree.unc}
5 | \title{Account for uncertainty in divergence time estimation}
6 | \usage{
7 | machu.tree.unc(tree, burnin = 0.1, conf = 0.95, inc = 10000, verbose = T)
8 | }
9 | \arguments{
10 | \item{tree}{Primary input. Can be a single treedata object (loaded via treeio::read.beast) or a string indicating a nexus-style treefile containing multiple trees (i.e. a Bayesian posterior distribution).}
11 |
12 | \item{burnin}{Percentage of trees to skip at the start of the multiple-trees file since MCMC algorithms take a while to converge. Must be between 0 and 1. Pertains only when the input is a Bayesian posterior of multiple trees. Default = 0.1.}
13 |
14 | \item{conf}{Confidence level from which to calculate HPD limits for the tree heights in a multiple-trees file. Must be between 0 and 1. Pertains only when the input is a Bayesian posterior of multiple trees. Default = 0.1.}
15 |
16 | \item{inc}{Increment at which to report progress, i.e. when every 'inc' trees are processed. Pertains only when the input is a Bayesian posterior of multiple trees, and verbose = TRUE. Default = 10000.}
17 |
18 | \item{verbose}{Report progress and checks to screen. Default = TRUE.}
19 | }
20 | \value{
21 | A list of three 'phylo' objects characterizing uncertainty in divergence times.
22 | }
23 | \description{
24 | Create a list of three trees that represent uncertainty in divergence times for downstream analysis
25 | }
26 | \details{
27 | This function generates a list of three trees that characterize the uncertainty of divergence time estimation. These trees can then be used in machu.2.ace() to explore scenarios in which varying numbers of taxa may have been present at a certain timeslice, given divergence time uncertainty.
28 |
29 | The function has two modes, depending on what input is provided. When a single tree is provided, the function outputs the input tree, plus two additional trees, constructed from the upper and lower confidence limits provided to characterize divergence time uncertainty by time calibration software such as BEAST. The 'phylo' object (from ape::read.tree) usually used to represent phylogenetic trees in R does not store this information, so the input must be in the 'treedata' format (from treeio::read.beast). Currently the function is compatible with output from BEAST and BEAST-adjacent software such as SNAPP, as well as output from MEGA calibrated with the RelTime method.
30 |
31 | The other mode characterizes uncertainty directly from a Bayesian posterior of trees. The function identifies the trees in the posterior with total tree heights closest to the median and the highest posterior density (HPD) limits of the distribution of tree heights. Because a tree posterior can consist of millions of trees, rather than overwhelm R by loading them all into an object (i.e. 'treedataList' from treeio), the function reads the trees directly from a file one at a time. Thus this mode is activated by specifying a filename; the file should be output from BEAST or BEAST-adjacent software, generally a .trees file in NEXUS format (open the file in a text editor to check, and examine the example file provided by the tutorial). The method consists of three "passes" through the posterior distribution of trees. In the first pass, the number of trees is simply counted, and the number of samples to skip as burn-in, given the burnin percentage specified by the user, is calculated. In the second pass, total tree heights are calculated for each tree, and the median and HPD limits at the confidence level specified are calculated for this distribution. In the third pass, the trees with total heights closest to the median and HPD limits are found, and sent to the output list.
32 |
33 | Because different software or even versions of the same software may output subtly variable versions of the same formats, I can't guarantee that this function can read in your multiple-tree nexus file. In some cases the issue may be easily fixed with a patch - contact me (WXG) with bugs.
34 | }
35 | \examples{
36 | # load a tree and store divergence time uncertainty info
37 | tree <- treeio::read.beast("tree.treefile")
38 | # characterize uncertainty
39 | trees <- machu.tree.unc(tree)
40 | # plot trees to visualize uncertainty
41 | machu.treeplot(trees)
42 |
43 | # characterize uncertainty from a posterior of trees and treat the first 20\% as burn-in
44 | trees <- machu.tree.unc("posterior.trees", burnin=0.2)
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/man/machu.2.ace.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/machuruku_code.R
3 | \name{machu.2.ace}
4 | \alias{machu.2.ace}
5 | \title{Perform ancestral character estimation of response curves}
6 | \usage{
7 | machu.2.ace(
8 | tip.resp,
9 | tree,
10 | timeslice = NULL,
11 | unc = F,
12 | csv.name = NULL,
13 | ace.method = "REML",
14 | verbose = F
15 | )
16 | }
17 | \arguments{
18 | \item{tip.resp}{Output of machu.1.tip.resp().}
19 |
20 | \item{tree}{Phylogenetic tree, a phylo object. Must be ultrametric, and taxon names must match those of 'tip.resp' exactly.}
21 |
22 | \item{timeslice}{A numeric vector giving the timeslices to extract reconstructed climate response values from. If NULL, provides values for the tips and nodes of the tree. All values must be less than the overall height of the tree.}
23 |
24 | \item{unc}{If TRUE, output upper and lower confidence intervals for each climate response value. Default = F.}
25 |
26 | \item{csv.name}{A string that specifies the output CSV file's location and name. Should include .csv extension. Will be saved to getwd() unless another path is specified.}
27 |
28 | \item{ace.method}{A string that specifies to ape::ace() which 'method' to use. Options are "REML" and "ML". See ?ape::ace for more details. Default = "REML".}
29 |
30 | \item{verbose}{Print progress updates and output file location/name to screen. Default = F.}
31 | }
32 | \value{
33 | A list of one element per scenario, either one or more timeslices or all tips and nodes, each a table of reconstructed climate response parameters.
34 | }
35 | \description{
36 | Extract reconstructed response curve parameters at a given set of timeslices, or at each tip and node
37 | }
38 | \details{
39 | This function uses ace() from the package "ape" to generate climate response curves at each node of a time-calibrated phylogeny, and extracts the values along the branches at a particular time if so desired. By default, the output is a set of climate response curve parameters for each node and each tip in the tree. However, each node occurs at different poitns in time, making paleoclimatic projections tricky. Thus the user can also provide one or more timeslices with the 'timeslice' parameter. The function will find each branch present at each timeslice and interpolate the response curve parameters along the branches to those points in time. The function can also record uncertainty in ancestral character estimation with the 'unc' parameter.
40 |
41 | You can use phytools::force.ultrametric() to fix small deviations from ultrametricity in your tree. If you are using an alternative tree format from ape's 'phylo' format, the function will automatically attempt to convert it to phylo. If it fails, the function will probably break down the line. Try to convert to 'phylo' yourself before using it in the function.
42 |
43 | You should use a dated tree with this function, otherwise your projections into paleoclimate data will not make much sense. If you're really desperate, you can try ape::chronos() to get a quick-and-dirty dated tree, but I doubt it would be acceptable for publication. Really you should be using the output of time-calibration software such as BEAST or RelTime.
44 |
45 | The 'timeslice' parameter uses linear interpolation to calculate values for each "branch-taxon". For example, timeslice=1e6 will detect which branches exist at 1 Ma, and perform a linear interpolation of climate response values using the values at the subtending nodes/tips. See Guillory & Brown (2021) for a more detailed explanation. Of course, make sure to specify timeslices in the relative scale your tree's node ages are coded in. For example, BEAST node ages are often in units of millions of years, so "1" would be equivalent to the "1e6" I use in my example.
46 |
47 | The 'unc' parameter behavior has been changed for machuruku 2.0. Now setting unc=T only extracts the upper and lower 95\% confidence intervals for each climate response parameter provided by ace(). These are automatically incorporated into the Bioclim calculations in machu.3.anc.niche(), producing more conservative niche models. When "tips and nodes" are returned (not timeslices), the tips do not have associated confidence intervals because they are held over from the 'tip.resp' input, not produced via ace().
48 |
49 | Use machu.ace.load() to reload outputs saved with 'csv.name'.
50 | }
51 | \examples{
52 | # return timeslices for 1 and 3 Ma
53 | ace <- machu.2.ace(tip.resp, tree, timeslice=c(1e6, 3e6))
54 | # same as above, with uncertainty
55 | ace <- machu.2.ace(tip.resp, tree, timeslice=c(1e6, 3e6), unc=T)
56 | # return only tips and nodes
57 | ace <- machu.2.ace(tip.resp, tree)
58 | # same as above, saving output to getwd()
59 | ace <- machu.2.ace(tip.resp, tree, csv.name="ace.csv")
60 | }
61 |
--------------------------------------------------------------------------------
/man/machu.top.env.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/machuruku_code.R
3 | \name{machu.top.env}
4 | \alias{machu.top.env}
5 | \title{Select top environmental variables}
6 | \usage{
7 | machu.top.env(
8 | occ,
9 | clim,
10 | sp.col = 1,
11 | col.xy = 2:3,
12 | learning.rt = 0.01,
13 | steps = 50,
14 | method = "contrib",
15 | nvars.save = 5,
16 | contrib.greater = 5,
17 | pa.ratio = 4,
18 | verbose = F
19 | )
20 | }
21 | \arguments{
22 | \item{occ}{Occurrence data for all taxa. Identical to input for machu.1.tip.resp(). Dataframe, with columns in the order of species, x/long, y/lat.}
23 |
24 | \item{clim}{Climate data for all taxa. Identical to input for machu.1.tip.resp(). A RasterStack of corresponding climate variables. SpatRaster (from Terra) is also acceptable}
25 |
26 | \item{sp.col}{Specify which column of the input occurrence data corresponds to species ID. Default = 1.}
27 |
28 | \item{col.xy}{vector specifying long (x) and lat (y) of occurrence data. Default = 2:3.}
29 |
30 | \item{learning.rt}{Value from 0.001 to 0.01 for building the ENMs, start with 0.01 and if prompted, change to 0.001. Default = 0.01.}
31 |
32 | \item{steps}{Numbers of trees to add at each cycle for modelling each taxon. Start with 50 and if you run into problems gradually decrease, stopping at 1. Default = 50.}
33 |
34 | \item{method}{This determines how important environmental variables are selected.There are three options: "estimate", "contrib", "nvars". If method="estimate", the boosted regression tree algorithm will choose the number of variables to include by systematically removing variables until average change in the model exceeds the original standard error of deviance explained. This is the most computationally intensive method. If method="contrib", variables above a relative influence value will be kept. See associated parameter 'contrib.greater'. If method="nvars", a fixed number of user specified variables will be kept. See associated parameter 'nvars.save'. The kept variables are selected by their relative influence. The 'nvars.save'-highest contributing variables for each taxon are retained and pooled, then ranked, and the 'nvars.save'-highest contributing variables for the whole pool are finally retained.}
35 |
36 | \item{nvars.save}{If method="nvars",this variable is required. It is the number of the top variables to save. The kept variables are selected by their relative influence in predicting the species distribution, selecting for the highest contributing variables. Often the total variables retained is lower due to identical variables select among both species. The default value is 5. This value will be ignored if method="estimate" or "contrib".}
37 |
38 | \item{contrib.greater}{If method="contrib", this variable is required. The kept variables are selected for their relative influence in predicting the species' distribution. Here, users select variables equal to or above an input model contribution value. The default value for this method is 5 (= variables with 5 percent or higher contribution to model of either species are kept). This value will be ignored if method="estimate" or "nvars".}
39 |
40 | \item{pa.ratio}{Ratio of pseudoabsences to occurrence points, typically this is 4. The default value is 4. There have to be at least 50 total points (occ+pseudoabsences) for the model to work; if the sum does not total to 50, the difference is taken as the number of pseudoabsences, rather than the value of occ*pa.ratio.}
41 |
42 | \item{verbose}{Tf TRUE, print progress to the screen. Default = F.}
43 | }
44 | \value{
45 | Prints the important climate variables to the screen. You can then combine them into a new RasterStack or SpatRaster object.
46 | }
47 | \description{
48 | Perform a boosted regression tree analysis to identify the most important climate variables for your taxon set.
49 | }
50 | \details{
51 | This function is a modified version of humboldt.top.env() from the package Humboldt. It runs generalized boosted regression models (a machine learning ENM algorithm) to select top parameters for inclusion your analyses. This is important because you want the models to reflect variables that are relevant to the species' distribution. Alternatively, you can run Maxent outside of R and manually curate the variables you include (also recommended).
52 | }
53 | \examples{
54 | ## acceptable 'clim' formats
55 | # Single RasterStack (raster) (preferred)
56 | clim <- stack(list.files(rasterfolder, pattern="T0_", full.names=T))
57 | # Single SpatRaster (terra)
58 | clim <- c(rast(list.files(rasterfolder, pattern="T0_", full.names=T)))
59 |
60 | # identify the top 6 climate variables across all taxa
61 | machu.top.env(occ, clim, method = "nvars", nvars.save = 6)
62 | # identify all climate variables with a contribution greater than 10\%
63 | machu.top.env(occ, clim, method = "contrib", contrib.greater = 10)
64 | }
65 |
--------------------------------------------------------------------------------
/tutorial/tutorial.R:
--------------------------------------------------------------------------------
1 | library(machuruku)
2 |
3 | ######## load the data
4 | # set working directory
5 | setwd("YOUR/DIRECTORY/tutorial")
6 |
7 | # load tree
8 | library(ape)
9 | tree <- read.nexus("basslerigroup.treefile")
10 | plot(tree)
11 |
12 | # load occurrence data
13 | occ <- read.csv("basslerigroup.csv")
14 |
15 | # load climate data
16 | library(terra)
17 | current <- rast(list.files("climate/current", full.names=T))
18 | mis19 <- rast(list.files("climate/mis19", full.names=T))
19 | mpwp <- rast(list.files("climate/mpwp", full.names=T))
20 | m2 <- rast(list.files("climate/m2", full.names=T))
21 |
22 | # plot climate
23 | plot(current$bio_1)
24 | # add occurrence data
25 | taxa <- unique(occ$species)
26 | cols <- c("cyan", "yellow", "red", "orange")
27 | for (i in taxa) points(subset(occ, species==i)$long, subset(occ, species==i)$lat,
28 | col = cols[which(taxa==i)],
29 | pch=19, cex=0.75)
30 | legend(-81, -11, legend = taxa, col = cols, pch=19, bty="n")
31 |
32 | ######### quick start
33 | # visualize tree with timeslice at 3.3 Ma
34 | machu.treeplot(tree, timeslice=3.3)
35 | # estimate tip response curves
36 | resp <- machu.1.tip.resp(occ, current)
37 | # estimate ancestral niches at timeslice
38 | ace <- machu.2.ace(resp, tree, timeslice=3.3, unc=T)
39 | # project ancestral niches into paleoclimate data
40 | mod <- machu.3.anc.niche(ace, m2)
41 | # visualize ancestral niches
42 | machu.plotmap(mod, plot="together", plot.asp=20/9, axes=F, to.scale=T)
43 |
44 | ######### detailed guide
45 | ### 1. estimate tip response curves
46 | resp <- machu.1.tip.resp(occ, current, verbose=T)
47 | resp[,1:6]
48 | # visualize response curves for two variables
49 | machu.respplot(resp, clim=c("bio_1", "bio_10"), plot="t")
50 | # visualize response curves for all variables
51 | machu.respplot(resp, plot="t", legend.cex=0.6)
52 | # visualize niche models
53 | machu.1.tip.resp(occ, current, plot="t")
54 | dev.off()
55 | machu.1.tip.resp(occ, current, plot="s", plot.points=T)
56 | # output niche models instead of response table
57 | mod <- machu.1.tip.resp(occ, current, output.bioclim=T)
58 | par(mfrow=c(2,2), mar=c(0,0,2,0))
59 | lapply(1:4, function(x) plot(mod[[x]], axes=F, legend=F, box=F, main=names(mod)[x]))
60 |
61 | # rarefy occurrence data
62 | dev.off()
63 | occ.r <- machu.occ.rarefy(occ, rarefy.dist=10, plot=T)
64 | resp <- machu.1.tip.resp(occ.r, current, plot="t", plot.points=T, verbose=T)
65 |
66 | # select most important climate variables
67 | # contribution method
68 | micv.contrib <- machu.top.env(occ.r, current, method="contrib", contrib.greater=5, verbose=T)
69 | micv.contrib
70 | # nvars method
71 | micv.nvars <- machu.top.env(occ.r, current, method="nvars", nvars.save=7, verbose=T)
72 | micv.nvars
73 | # estimate method
74 | micv.est <- machu.top.env(occ.r, current, method="estimate", verbose=T)
75 | micv.est
76 | # reduce climate datasets to only most important variables
77 | current.reduced <- current[[micv.nvars]]
78 | mis19.reduced <- mis19[[micv.nvars]]
79 | mpwp.reduced <- mpwp[[micv.nvars]]
80 | m2.reduced <- m2[[micv.nvars]]
81 | # re-run tip response table with reduced climate dataset and rarefied occurrence data
82 | resp <- machu.1.tip.resp(occ.r, current.reduced, plot="t", plot.points=T)
83 |
84 | ### 2. estimate ancestral niches
85 | # visualize time-slices
86 | dev.off()
87 | options(warn=-1)
88 | machu.treeplot(tree, timeslice = c(0.787,3.205,3.3))
89 | machu.treeplot(tree, timeslice = c(0.787,3.205,3.3), x.l.lim = 13, x.u.lim=-3, nodelabsize = 0.35, col = "skyblue", timelaboffset = -0.2)
90 |
91 | # estimate ancestral niches at timeslices
92 | resp <- resp[[2]]
93 | ace.ts <- machu.2.ace(resp, tree, timeslice=c(0.787,3.205,3.3))
94 | ace.ts
95 | names(ace.ts)
96 | ace.ts[[1]][,1:8]
97 | ace.ts[[2]][,1:8]
98 |
99 | # estimate ancestral niches at each node
100 | ace.n <- machu.2.ace(resp, tree)
101 | names(ace.n)
102 | ace.n[[1]][,1:7]
103 | # visualize niche evolution
104 | machu.respplot(ace.n[[1]], clim="bio_12", fill=T)
105 |
106 | # include uncertainty
107 | ace.ts.u <- machu.2.ace(resp, tree, timeslice=c(0.787,3.205,3.3), unc=T)
108 | ace.ts.u[[1]][,1:11]
109 | # visualize uncertainty
110 | machu.respplot(ace.ts.u[[1]], clim="bio_12")
111 |
112 | # characterize divergence time uncertainty
113 | # reload tree as 'treedata' object
114 | library(treeio)
115 | beast <- read.beast("basslerigroup.treefile")
116 | beast
117 | do.call(rbind, as_tibble(beast)$height_0.95_HPD)
118 | # run tree-uncertainty utility from a single input tree
119 | beast.trees <- machu.tree.unc(beast)
120 | names(beast.trees)
121 | beast.trees
122 | # visualize trees
123 | machu.treeplot(beast.trees, timeslice=c(0.787,3.205,3.3), nodelabsize=0.5, timelaboffset=-0.15, col="skyblue")
124 | # re-run machu.2.ace with the new trees for comparison
125 | ace.lCItree <- machu.2.ace(resp, beast.trees$lCItree, timeslice=3.3)
126 | ace.inputtree <- machu.2.ace(resp, beast.trees$inputtree, timeslice=3.3)
127 | ace.uCItree <- machu.2.ace(resp, beast.trees$uCItree, timeslice=3.3)
128 | # count number of taxa in each of the new outputs
129 | c(nrow(ace.lCItree[[1]]), nrow(ace.inputtree[[1]]), nrow(ace.uCItree[[1]]))
130 |
131 | # run tree-uncertainty utility from a posterior
132 | post.trees <- machu.tree.unc("posterior.trees")
133 | # visualize trees
134 | machu.treeplot(post.trees, timelabs=F, nodelabs=F)
135 |
136 | # save ace output
137 | ace.ts <- machu.2.ace(resp, tree, timeslice=c(0.787,3.205,3.3), csv.name="ace_ts.csv")
138 | read.csv("ace_ts.csv")[,1:7]
139 | # load ace output
140 | ace.ts <- machu.ace.load("ace_ts.csv")
141 |
142 | ### 3. project ancestral niche models into paleoclimate
143 | # multiple timeslices into multiple paleoclimates
144 | clim <- list(mis19.reduced, mpwp.reduced, m2.reduced)
145 | mod.ts <- machu.3.anc.niche(ace.ts, clim, verbose=T)
146 | mod.ts
147 | names(mod.ts)
148 | names(mod.ts[[1]])
149 | sapply(mod.ts, length)
150 | machu.plotmap(mod.ts, plot="t", axes=F, title.cex=0.85, to.scale=T, plot.asp=20/9)
151 |
152 | # projecting while accounting for uncertainty
153 | mod.ts.u <- machu.3.anc.niche(ace.ts.u, clim, verbose=T)
154 | machu.plotmap(mod.ts.u, plot="t", axes=F, title.cex=0.85, to.scale=T, plot.asp=20/9)
155 |
156 | # clipping niche models
157 | mod.ts.u.nc <- machu.3.anc.niche(ace.ts.u[3], clim[[3]], clip.Q=F) # no clipping
158 | mod.ts.u.c95 <- machu.3.anc.niche(ace.ts.u[3], clim[[3]], clip.Q=T) # default clipping (95%)
159 | mod.ts.u.c50 <- machu.3.anc.niche(ace.ts.u[3], clim[[3]], clip.Q=T, clip.amt=0.5) # stringent clipping (50%)
160 | # combine and visualize
161 | clip.demo <- c(mod.ts.u.nc, mod.ts.u.c95, mod.ts.u.c50)
162 | names(clip.demo) <- c("no clipping", "clipping at 95%", "clipping at 50%")
163 | machu.plotmap(clip.demo, plot="t", axes=F, to.scale=T, plot.asp=1)
164 |
165 | # producing binary models
166 | mod.ts.u.b95 <- machu.3.anc.niche(ace.ts.u[3], clim[[3]], resp.curv=F) # default clipping (95%)
167 | mod.ts.u.b75 <- machu.3.anc.niche(ace.ts.u[3], clim[[3]], resp.curv=F, clip.amt=0.75) # stringent clipping (75%)
168 | # combine and visualize
169 | binary.demo <- c(mod.ts.u.b95, mod.ts.u.b75)
170 | names(binary.demo) <- c("clipping at 95%", "clipping at 75%")
171 | machu.plotmap(binary.demo, plot="t", title.cex=0.8, axes=F, plot.asp=1)
172 |
173 | # one timeslice into multiple paleoclimates
174 | clim <- list(mis19.reduced, mpwp.reduced, m2.reduced)
175 | mod.multipc <- machu.3.anc.niche(ace.n, clim, taxa=1:4, clip.Q=F, verbose=T)
176 | # visualize
177 | machu.plotmap(mod.multipc, col=2, plot="t", axes=F, to.scale=T)
178 |
179 | # multiple timeslices into a single paleoclimate
180 | mod.multi.ts <- machu.3.anc.niche(ace.ts.u, m2.reduced, clip.Q=F, verbose=T)
181 | # visualize
182 | machu.plotmap(mod.multi.ts, col=3, plot="t", axes=F, to.scale=T)
183 |
184 | # differing numbers of timeslices and paleoclimates (all >1)
185 | machu.3.anc.niche(ace.ts[1:2], clim, verbose=T) %>% invisible
186 |
187 | # save outputs to folder
188 | machu.3.anc.niche(ace.ts, clim, output.folder=getwd(), verbose=T) %>% invisible
189 | list.files(pattern=".tif")
190 |
--------------------------------------------------------------------------------
/man/machu.3.anc.niche.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/machuruku_code.R
3 | \name{machu.3.anc.niche}
4 | \alias{machu.3.anc.niche}
5 | \title{Convert ancestral response values to niche models}
6 | \usage{
7 | machu.3.anc.niche(
8 | ace,
9 | clim,
10 | taxa = NULL,
11 | raster.sets = NULL,
12 | resp.curv = T,
13 | clip.Q = T,
14 | clip.amt = 0.95,
15 | clip.samples = 10000,
16 | ocean = NA,
17 | output.folder = NULL,
18 | verbose = F
19 | )
20 | }
21 | \arguments{
22 | \item{ace}{Output of machu.2.ace(). Can be subsetted.}
23 |
24 | \item{clim}{Paleoclimatic data. The best format is SpatRaster from the terra package, or a list of SpatRasters (via the function list()). A group of SpatRasters from multiple timeslices joined with c() is acceptable, but requires the use of raster.sets to differentiate. A RasterStack or list of RasterStacks (via list()) from the raster package is also acceptable.}
25 |
26 | \item{taxa}{Optional, specifies which taxa to run. If the input is not timeslices but tips and nodes (names(ace)=="tips_and_nodes"), 'taxa' can be a numeric or character vector (i.e., 1:3, c(1,4), or c("taxon1", "taxon2")). If the input is timeslices (names(ace)!="tips_and_nodes"), only a character vector can be used. If none of the taxa are present in a given timeslice, that timeslice will be skipped.}
27 |
28 | \item{raster.sets}{Character vector with the names of the various raster sets. Only used if a single raster object containing all paleoclimates is provided for 'clim'.}
29 |
30 | \item{resp.curv}{If TRUE, create ancestral niche models with skew-normal response curves. If FALSE, assume response is a uniform distribution within certain confidence limits specified by 'clip.amt'. This produces a binary niche model. Default = T.}
31 |
32 | \item{clip.Q}{If TRUE, clip the tails of each response curve at certain confidence limits specified by 'clip.amt' (default is 0.95). Produces "cleaner" models. Default = T.}
33 |
34 | \item{clip.amt}{Float value between 0 and 1 specifying confidence limits at which clip.Q=T or resp.curv=F operates. For example, at the default (0.95), the limits are the 0.025\% and 0.975\% quantiles for each response curve.}
35 |
36 | \item{clip.samples}{The number of random samples taken by rsn() while determining confidence limits when clip.Q=T or resp.curv=F. Default = 10000. Decreasing may result in a speed boost at the cost of accuracy.}
37 |
38 | \item{ocean}{A string or numeric specifying null or "ocean" pixels in the input rasters. Default = NA.}
39 |
40 | \item{output.folder}{A string specifying a folder name to write outputs to. Outputs are only written if this argument is specified. Output will be in .tif format (GeoTiff) and given default names in the format "scenario_taxon.tif".}
41 |
42 | \item{verbose}{If TRUE, print to screen certain checks, statuses, and progress updates. Default = F.}
43 | }
44 | \value{
45 | A list of one element per scenario (timeslice or rasterset), each itself a list of one SpatRaster (ancestral niche model) per taxon.
46 | }
47 | \description{
48 | Create Bioclim niche models for each taxon in each timeslice
49 | }
50 | \details{
51 | For a single timeslice, the SpatRaster or RasterStack object should have multiple layers, each corresponding to a climate variable. The layers should be consistent in number and type across all timeslices. Within a timeslice, layers should share the same geography (i.e., ocean pixels should be the same).
52 |
53 | The function associates timeslices with rasters based on the inputs. When the same number of timeslices and rastersets are provided (length(ace)==length(clim)), the first timeslice will be matched to the first rasterset, and so on. When only one rasterset and multiple timeslices are provided, the timeslices will all be matched to the single rasterset, and vice versa. When 'ace' and 'clim' have different lengths, and lengths > 1, only the first 'x' elements of 'ace' and 'clim' will be used, 'x' being the length of the shorter input, with the first timeslice matched to the first rasterset, and so on. When verbose=TRUE, these rasterset-timeslice associations are printed to the screen.
54 |
55 | Whether uncertainty is included in the ancestral niche models depends on the 'ace' input, i.e. whether unc=T was specified in machu.2.ace(). Uncertainty is encoded by the mean, upper confidence limit, and lower confidence limit for each parameter (mean, standard deviation, and skew). When passed to machu.3.anc.niche(), multiple response curves consisting of every combination of these values (n=3^3=27) are used to construct suitabilities for each raster and then summed. This tends to produce much broader (more conservative) models than when unc=F.
56 |
57 | When uncertainty is included and resp.curv=F (i.e., binary models are produced), the behavior differs from when uncertainty is not included. A second "clipping" occurs after the multiple suitabilities for that raster (from the 27 combinations of response curve parameters) are summed, because at this point the summed suitability will still not be binary (0 or 1). Suitability values corresponding to raster pixels in the '1-clip.amt' (default=0.05) percentile of suitable values are set to 0, and all values above it are set to 1. This produces a cleaner look more in line with expectations.
58 |
59 | You can plot the output models on your own, or use machu.plotmap() to do so.
60 |
61 | The output option only outputs tiffs, and constructs automatic filenames using the raster set and taxon for each layer. This may be too limited for your purposes, in which case you should write your own script to output the file types and/or names that you desire for your project.
62 | }
63 | \examples{
64 | ## acceptable 'clim' formats
65 | # Single SpatRaster (terra)
66 | clim1 <- c(rast(list.files(rasterfolder, pattern="T1_", full.names=T)))
67 | # List of SpatRasters (preferred)
68 | clim2 <- list(c(rast(list.files(rasterfolder, pattern="T1_", full.names=T))), c(rast(list.files(rasterfolder, pattern="T2_", full.names=T))))
69 | # Multiple rastersets in a single SpatRaster (requires 'raster.sets' be specified)
70 | clim3 <- c(c(rast(list.files(rasterfolder, pattern="T1_", full.names=T))), c(rast(list.files(rasterfolder, pattern="T2_", full.names=T))))
71 | # Single RasterStack (raster)
72 | clim4 <- stack(rast(list.files(rasterfolder, pattern="T1_", full.names=T)))
73 | # List of RasterStacks
74 | clim5 <- list(stack(list.files(rasterfolder, pattern="T1_", full.names=T)), stack(list.files(rasterfolder, pattern="T2_", full.names=T)))
75 |
76 | ## various 'ace' formats
77 | # Two timeslices, no uncertainty
78 | ace_n <- machu.2.ace(resp, tree, timeslice=c(1e6, 2e6))
79 | # Two timeslices, uncertainty
80 | ace_u <- machu.2.ace(resp, tree, timeslice=c(1e6, 2e6), unc=T)
81 | # No timeslices--only tips and nodes, no uncertainty
82 | ace_t <- machu.2.ace(resp, tree)
83 |
84 | ## ways of running the actual function
85 | # run with default settings, no uncertainty, two timeslices, two rastersets in SpatRaster format
86 | output.models <- machu.3.anc.niche(ace_n, clim2)
87 | # same as above, but don't clip the models
88 | output.models <- machu.3.anc.niche(ace_n, clim2, clip.Q=F)
89 | # same as above, but produce binary models
90 | output.models <- machu.3.anc.niche(ace_n, clim2, resp.curv=F)
91 | # same as above, but make the binary models more stringent
92 | output.models <- machu.3.anc.niche(ace_n, clim2, resp.curv=F, clip.amt=0.9)
93 | # same as above, but output the models to the present working directory
94 | output.models <- machu.3.anc.niche(ace_n, clim2, resp.curv=F, clip.amt=0.9, output.folder=getwd())
95 |
96 | # run with uncertainty (default settings, two timeslices, two rastersets)
97 | output.models <- machu.3.anc.niche(ace_u, clim2)
98 |
99 | # run with two timeslices, but project them both into the same single rasterset
100 | output.models <- machu.3.anc.niche(ace_n, clim1)
101 | # run with one timeslice, but project it into two different rastersets
102 | output.models <- machu.3.anc.niche(ace_n[1], clim2)
103 |
104 | # run with only certain taxa
105 | output.models <- machu.3.anc.niche(ace_n, clim2, taxa=c("taxon1", "taxon2"))
106 |
107 | # run with no actual timeslices, only tips and nodes
108 | output.models <- machu.3.anc.niche(ace_t, clim1)
109 | # same as above, but project all taxa into multiple timeslices
110 | output.models <- machu.3.anc.niche(ace_t, clim2)
111 | # same as above, but only use the first two taxa (both are equivalent)
112 | output.models <- machu.3.anc.niche(ace_t, clim1, taxa=c("taxon1", "taxon2"))
113 | output.models <- machu.3.anc.niche(ace_t, clim1, taxa=1:2)
114 |
115 | # plot the first taxon's ancestral niche model from the first timeslice
116 | plot(output.models[[1]][[1]])
117 | }
118 |
--------------------------------------------------------------------------------
/tutorial/posterior.trees:
--------------------------------------------------------------------------------
1 | #NEXUS
2 |
3 | Begin taxa;
4 | Dimensions ntax=35;
5 | Taxlabels
6 | AaltaJLB07_802_0181_ABIB
7 | AaltaJY08_075_0692_AGJC
8 | AbassJLB07_240_02_0183_ABID
9 | AberoMAP1193_0516_AFBG
10 | AbiliLSUMZ_12802_0424_AECE
11 | AboehJLB17_22_0484_AEIE
12 | AboliUTA55353_0829_AICJ
13 | AbracIP_AF762_0178_ABHI
14 | Acain_0005_AAAF
15 | AflavIP_MTR19614_0520_AFCA
16 | AhahnIP_MTR13882_0193_ABJD
17 | AhahnJLB17_055_0458_AEFI
18 | Aigni_0287_ACIH
19 | AingeET10_086_0757_AHFH
20 | AmaceJLB17_059_0461_AEGB
21 | AmaceJLB17_074_0510_AFBA
22 | Amace_0203_ACAD
23 | AparvJLB17_065_0500_AFAA
24 | ApeppJLB015n2_0209_ACAJ
25 | ApeteJY08_076_0026_AACG
26 | ApictIP_RHO008_0453_AEFD
27 | ApictIP_TM472_0226_ACCG
28 | ApictMNCN_6152_0438_AEDI
29 | AplanJY08_014_0450_AEFA
30 | ApongJB009n1_0216_ACBG
31 | ArubrJLB017_011_0298_ACJI
32 | AshihMUSM_31691_0780_AHIA
33 | AsilvJLB017_005_0032_AADC
34 | AsimuMNCN_5557_0034_AADE
35 | Asp_0044_AAEE
36 | Asp_LSUMZ_13660_0546_AFEG
37 | AtrivJLB17_068_0504_AFAE
38 | AyoshJLB07_5_0447_AEEH
39 | Cnubi_0303_ADAD
40 | Cprat_0304_ADAE
41 | ;
42 | End;
43 | Begin trees;
44 | Translate
45 | 1 AaltaJLB07_802_0181_ABIB,
46 | 2 AaltaJY08_075_0692_AGJC,
47 | 3 AbassJLB07_240_02_0183_ABID,
48 | 4 AberoMAP1193_0516_AFBG,
49 | 5 AbiliLSUMZ_12802_0424_AECE,
50 | 6 AboehJLB17_22_0484_AEIE,
51 | 7 AboliUTA55353_0829_AICJ,
52 | 8 AbracIP_AF762_0178_ABHI,
53 | 9 Acain_0005_AAAF,
54 | 10 AflavIP_MTR19614_0520_AFCA,
55 | 11 AhahnIP_MTR13882_0193_ABJD,
56 | 12 AhahnJLB17_055_0458_AEFI,
57 | 13 Aigni_0287_ACIH,
58 | 14 AingeET10_086_0757_AHFH,
59 | 15 AmaceJLB17_059_0461_AEGB,
60 | 16 AmaceJLB17_074_0510_AFBA,
61 | 17 Amace_0203_ACAD,
62 | 18 AparvJLB17_065_0500_AFAA,
63 | 19 ApeppJLB015n2_0209_ACAJ,
64 | 20 ApeteJY08_076_0026_AACG,
65 | 21 ApictIP_RHO008_0453_AEFD,
66 | 22 ApictIP_TM472_0226_ACCG,
67 | 23 ApictMNCN_6152_0438_AEDI,
68 | 24 AplanJY08_014_0450_AEFA,
69 | 25 ApongJB009n1_0216_ACBG,
70 | 26 ArubrJLB017_011_0298_ACJI,
71 | 27 AshihMUSM_31691_0780_AHIA,
72 | 28 AsilvJLB017_005_0032_AADC,
73 | 29 AsimuMNCN_5557_0034_AADE,
74 | 30 Asp_0044_AAEE,
75 | 31 Asp_LSUMZ_13660_0546_AFEG,
76 | 32 AtrivJLB17_068_0504_AFAE,
77 | 33 AyoshJLB07_5_0447_AEEH,
78 | 34 Cnubi_0303_ADAD,
79 | 35 Cprat_0304_ADAE
80 | ;
81 |
82 | tree STATE_0 = (((((((((((((((((1[&rate=0.0017325960351205945]:1.95078817785881,(2[&rate=0.0017325960351205945]:1.5530257473971938,26[&rate=0.0013934577055161935]:1.5530257473971938)[&rate=8.407802931340941E-4]:0.3977624304616163)[&rate=7.72555999719884E-4]:1.3130357898712144,30[&rate=0.0011600006988936144]:3.2638239677300245)[&rate=0.001450667103719264]:0.87003107517027,13[&rate=0.0017325960351205945]:4.1338550429002945)[&rate=0.0011586672076271836]:1.263295795626199,12[&rate=0.0013606335685825547]:5.3971508385264935)[&rate=0.0016035007383476965]:0.1815892705616271,25[&rate=0.0011723062147284853]:5.578740109088121)[&rate=0.0011861533010314913]:0.5162420583219083,((9[&rate=0.0012145672517651243]:1.2554270896603865,20[&rate=0.0013606335685825547]:1.2554270896603865)[&rate=0.0013076816993064845]:4.080573827136753,((15[&rate=0.0010039976214661372]:3.6080164496586584,(17[&rate=0.001683853333251262]:1.154307329276187,24[&rate=0.0013606335685825547]:1.154307329276187)[&rate=8.407802931340941E-4]:2.4537091203824715)[&rate=0.0015744871031386112]:0.558808538283071,(16[&rate=0.0011586672076271836]:2.535124186156986,31[&rate=0.0011861533010314913]:2.535124186156986)[&rate=0.001342370108805053]:1.6317008017847434)[&rate=0.0017325960351205945]:1.1691759288554104)[&rate=0.0015143185819268665]:0.758981250612889)[&rate=0.0010812784005791282]:1.1120585345853673,(27[&rate=0.0010800398390645516]:6.15657064642522,29[&rate=8.93798970524592E-4]:6.15657064642522)[&rate=7.070383930703228E-4]:1.0504700555701758)[&rate=8.804974057150778E-4]:0.22185819381334237,11[&rate=9.656787574495533E-4]:7.4288988958087385)[&rate=6.019851172833986E-4]:0.36384048064466157,32[&rate=0.0011319264578639168]:7.7927393764534)[&rate=0.0015143185819268665]:0.01122370598295408,23[&rate=0.001041940779504052]:7.803963082436354)[&rate=0.0019872557333071076]:0.2136168565212575,((((4[&rate=0.0016779344140467505]:3.067485609734358,(8[&rate=0.0015744871031386112]:1.6583243840505575,22[&rate=0.001683853333251262]:1.6583243840505575)[&rate=0.0022297463898307526]:1.4091612256838006)[&rate=0.0012145672517651243]:0.7836580724319568,10[&rate=0.0014305881851445288]:3.851143682166315)[&rate=0.0012002319283250145]:1.3049442716699327,(6[&rate=0.0015713641902474753]:3.8100846718921315,21[&rate=0.0012321336700875354]:3.8100846718921315)[&rate=9.527166818754213E-4]:1.3460032819441161)[&rate=0.0011258488310738912]:2.2357059676148987,7[&rate=0.0010039976214661372]:7.391793921451146)[&rate=0.0010928589901330718]:0.6257860175064653)[&rate=8.804974057150778E-4]:0.21630524071602153,14[&rate=0.0022297463898307526]:8.233885179673633)[&rate=0.0013934577055161935]:0.07583760669216133,(5[&rate=8.407802931340941E-4]:5.05699826935783,18[&rate=7.251976536268092E-4]:5.05699826935783)[&rate=7.527248150226037E-4]:3.252724517007964)[&rate=8.560274662012234E-4]:1.1995740951410934,((3[&rate=8.804974057150778E-4]:2.2350298873866254,33[&rate=0.0010039976214661372]:2.2350298873866254)[&rate=0.0015417800694117144]:0.6219169965303393,19[&rate=0.0011600006988936144]:2.8569468839169647)[&rate=7.120866287734797E-4]:6.652349997589923)[&rate=0.0013076816993064845]:1.4458531137722055,28[&rate=5.259395332209182E-4]:10.955149995279093)[&rate=0.0019872557333071076]:6.91864901192838,35[&rate=9.681151696280567E-4]:17.873799007207474)[&rate=0.0012002319283250145]:0.277680355362083,34[&rate=0.0014416914476317838]:18.151479362569557)[&rate=1.0]:0.0;
83 | tree STATE_10000 = (((((((((((((((((1[&rate=7.942625640626505E-4]:4.71148868091746,(2[&rate=8.946957372956591E-4]:3.41128932681331,26[&rate=7.197196228967397E-4]:3.41128932681331)[&rate=0.0011048033685707819]:1.30019935410415)[&rate=9.680561008538539E-4]:1.0780715771570168,30[&rate=9.547442763830324E-4]:5.789560258074477)[&rate=5.420955619126181E-4]:1.1761964346175535,13[&rate=8.729870419969062E-4]:6.965756692692031)[&rate=0.0014078093404401874]:0.8782699307082185,12[&rate=0.0011525499091227303]:7.844026623400249)[&rate=8.645770591125314E-4]:0.8308407318977986,25[&rate=7.850405992743596E-4]:8.674867355298048)[&rate=9.215579109990052E-4]:1.1104454155416636,((9[&rate=7.850405992743596E-4]:1.7361685706089063,20[&rate=0.0010116218574342045]:1.7361685706089063)[&rate=7.222509303360713E-4]:7.180468325100285,((15[&rate=7.311204269330882E-4]:5.3041204120469505,(17[&rate=4.7674113936404204E-4]:2.9724743995612384,24[&rate=6.405527489655956E-4]:2.9724743995612384)[&rate=8.130263064633813E-4]:2.331646012485712)[&rate=8.946957372956591E-4]:1.7245980314505935,(16[&rate=8.130263064633813E-4]:4.246521218136996,31[&rate=8.645770591125314E-4]:4.246521218136996)[&rate=6.178370708230647E-4]:2.782197225360548)[&rate=9.77776676573814E-4]:1.8879184522116468)[&rate=0.0010116218574342045]:0.8686758751305206)[&rate=0.0010038307985086713]:0.8307316380072152,(27[&rate=6.271706586177946E-4]:9.884053227130599,29[&rate=6.793176637886946E-4]:9.884053227130599)[&rate=8.421918952758446E-4]:0.731991181716328)[&rate=5.788605879404311E-4]:0.1351819323418617,11[&rate=6.776080553856333E-4]:10.751226341188788)[&rate=6.593199074814663E-4]:0.06991027631137392,32[&rate=7.850405992743596E-4]:10.821136617500162)[&rate=8.421918952758446E-4]:0.005654376759910207,23[&rate=8.225966744641361E-4]:10.826790994260072)[&rate=6.444266208682967E-4]:0.867039402276351,((((4[&rate=0.0010179199941803318]:5.164008764466985,(8[&rate=9.680561008538539E-4]:2.452514630081848,22[&rate=0.0010179199941803318]:2.452514630081848)[&rate=0.0011026120488229082]:2.711494134385137)[&rate=0.0014078093404401874]:0.6383153537366342,10[&rate=9.419289717395592E-4]:5.802324118203619)[&rate=6.685126841187469E-4]:1.7078849580992737,(6[&rate=9.547442763830324E-4]:5.753302901849251,21[&rate=8.729870419969062E-4]:5.753302901849251)[&rate=8.946957372956591E-4]:1.7569061744536416)[&rate=7.222509303360713E-4]:3.5156700849025633,7[&rate=6.866254957217554E-4]:11.025879161205456)[&rate=0.0014078093404401874]:0.6679512353309676)[&rate=0.0010038307985086713]:0.17847159839574722,14[&rate=0.0013387950108590357]:11.87230199493217)[&rate=7.311204269330882E-4]:0.3908638669080027,(5[&rate=5.550536187488803E-4]:6.999082993313821,18[&rate=6.405527489655956E-4]:6.999082993313821)[&rate=5.899679319257659E-4]:5.264082868526352)[&rate=7.899979482794211E-4]:1.356115902203335,((3[&rate=6.405527489655956E-4]:3.526113257747574,33[&rate=5.672593577802015E-4]:3.526113257747574)[&rate=4.996647508988157E-4]:0.9054512956224734,19[&rate=7.311204269330882E-4]:4.431564553370047)[&rate=5.281801988635149E-4]:9.187717210673462)[&rate=8.729870419969062E-4]:1.390797636756055,28[&rate=4.2240751548768034E-4]:15.010079400799563)[&rate=0.0012157469770046742]:9.983804896465225,35[&rate=6.593199074814663E-4]:24.99388429726479)[&rate=7.489093730407064E-4]:1.8952725443256178,34[&rate=9.680561008538539E-4]:26.889156841590406)[&rate=1.0]:0.0;
84 | tree STATE_20000 = (((((((((((((((((1[&rate=0.0010936136946714978]:3.4989164733888183,(2[&rate=0.00119151855644154]:2.6509352319628823,26[&rate=0.0011226815613496113]:2.6509352319628823)[&rate=0.0013797996038997962]:0.847981241425936)[&rate=0.0010258381490572154]:0.7620427227707358,30[&rate=0.0010681686601728252]:4.260959196159554)[&rate=0.0013218023730220416]:0.8666388280196102,13[&rate=0.0012231255473728248]:5.127598024179164)[&rate=0.0012570524782327859]:0.7060606961720239,12[&rate=0.0013218023730220416]:5.833658720351188)[&rate=9.957788405298513E-4]:0.8030236209202206,25[&rate=0.0010557412246116657]:6.636682341271409)[&rate=0.00119151855644154]:1.144383363122384,((9[&rate=9.852269704873366E-4]:1.9368358970258222,20[&rate=9.957788405298513E-4]:1.9368358970258222)[&rate=0.001176443383468346]:4.995902824187323,((15[&rate=9.957788405298513E-4]:4.227560530052744,(17[&rate=7.366048113011094E-4]:2.906385471348562,24[&rate=8.821161831630281E-4]:2.906385471348562)[&rate=0.0015288812192514954]:1.3211750587041822)[&rate=0.0013136240366653105]:0.9328428360740295,(16[&rate=8.680855640084332E-4]:3.489722171606003,31[&rate=9.378664326210978E-4]:3.489722171606003)[&rate=0.0011617916490994865]:1.6706811945207707)[&rate=8.317786746200018E-4]:1.772335355086371)[&rate=0.0010807856909773623]:0.8483269831806481)[&rate=0.0012397666391929963]:0.3566079433541116,(27[&rate=8.144015930430138E-4]:7.376418772445791,29[&rate=8.144015930430138E-4]:7.376418772445791)[&rate=0.001106675591844595]:0.7612548753021136)[&rate=9.852269704873366E-4]:0.10031298691785295,11[&rate=8.680855640084332E-4]:8.237986634665758)[&rate=8.79896200790126E-4]:0.2067855237242604,32[&rate=9.840984320756611E-4]:8.444772158390018)[&rate=7.207552603458995E-4]:0.027199531934448018,23[&rate=9.148111480297592E-4]:8.471971690324466)[&rate=9.378664326210978E-4]:0.6116054996543276,((((4[&rate=0.0014610595881415624]:3.583113817901064,(8[&rate=0.0010681686601728252]:1.9021759900869502,22[&rate=0.0012570524782327859]:1.9021759900869502)[&rate=0.0018107251052653138]:1.680937827814114)[&rate=8.561484431705586E-4]:1.2481983056198658,10[&rate=0.0011966730593759437]:4.83131212352093)[&rate=0.0013797996038997962]:1.564707294143763,(6[&rate=0.0012696749634253767]:4.1908959818658165,21[&rate=0.0010681686601728252]:4.1908959818658165)[&rate=8.561484431705586E-4]:2.2051234357988765)[&rate=0.0015288812192514954]:1.8642010584030189,7[&rate=8.317786746200018E-4]:8.260220476067712)[&rate=8.317786746200018E-4]:0.8233567139110818)[&rate=7.039288001389577E-4]:0.18999631362441605,14[&rate=0.001738469066784086]:9.27357350360321)[&rate=0.0012231255473728248]:0.3433303287672178,(5[&rate=7.799853827910284E-4]:5.991526827605502,18[&rate=7.039288001389577E-4]:5.991526827605502)[&rate=8.91605641711825E-4]:3.6253770047649256)[&rate=0.0012696749634253767]:0.9002574403076196,((3[&rate=8.680855640084332E-4]:4.0915895764709225,33[&rate=6.190639470011096E-4]:4.0915895764709225)[&rate=0.0012570524782327859]:0.38491545585035336,19[&rate=6.442312115453489E-4]:4.476505032321276)[&rate=7.660926368327458E-4]:6.040656240356771)[&rate=9.493837637635008E-4]:2.721954790648871,28[&rate=4.792196095818057E-4]:13.239116063326918)[&rate=0.0018107251052653138]:6.400153496695097,35[&rate=8.680855640084332E-4]:19.639269560022015)[&rate=0.001738469066784086]:1.092825331595627,34[&rate=0.00119151855644154]:20.732094891617642)[&rate=1.0]:0.0;
85 | tree STATE_30000 = (((((((((((((((((1[&rate=7.036835742230007E-4]:5.031491605350371,(2[&rate=7.850370680052121E-4]:3.9381642555524015,26[&rate=7.389683761806267E-4]:3.9381642555524015)[&rate=8.828195773284378E-4]:1.0933273497979692)[&rate=0.0014444554337950837]:0.3351206577302017,30[&rate=9.384748865864626E-4]:5.366612263080572)[&rate=6.111290271757305E-4]:1.64437136422508,13[&rate=9.04299526876179E-4]:7.010983627305652)[&rate=0.0016207120376078286]:0.6901372449295788,12[&rate=9.384748865864626E-4]:7.701120872235231)[&rate=9.267868742746653E-4]:1.232360857187846,25[&rate=7.859373280370914E-4]:8.933481729423077)[&rate=8.723998132833658E-4]:0.8805977984993998,((9[&rate=6.8296853413965E-4]:2.6283013574811296,20[&rate=8.183337626960612E-4]:2.6283013574811296)[&rate=7.389683761806267E-4]:5.347382855620784,((15[&rate=7.573444098926784E-4]:4.300657645553682,(17[&rate=7.389683761806267E-4]:2.470042610858879,24[&rate=4.3755851808600536E-4]:2.470042610858879)[&rate=0.001100696637830807]:1.830615034694803)[&rate=0.0012593536481270795]:1.141076294350798,(16[&rate=9.04299526876179E-4]:4.2149468896618805,31[&rate=8.431573675394883E-4]:4.2149468896618805)[&rate=0.0012239245589600585]:1.2267870502425993)[&rate=7.757714137024347E-4]:2.5339502731974335)[&rate=7.389683761806267E-4]:1.8383953148205636)[&rate=0.001219622337125266]:0.6738424382567043,(27[&rate=7.036835742230007E-4]:9.430706933800842,29[&rate=7.481567803054562E-4]:9.430706933800842)[&rate=9.757142804166248E-4]:1.0572150323783394)[&rate=0.0013868151950281818]:0.06042753973259174,11[&rate=7.481567803054562E-4]:10.548349505911773)[&rate=3.822840733962059E-4]:0.5829002958718554,32[&rate=7.850370680052121E-4]:11.131249801783628)[&rate=5.996232826141465E-4]:0.08748084827846725,23[&rate=7.943547879680824E-4]:11.218730650062096)[&rate=8.828195773284378E-4]:0.39935829590921657,((((4[&rate=9.04299526876179E-4]:6.495716294660671,(8[&rate=9.04299526876179E-4]:2.9249411830086585,22[&rate=7.943547879680824E-4]:2.9249411830086585)[&rate=9.505006852310006E-4]:3.5707751116520123)[&rate=0.0011206572770946688]:0.609773662283839,10[&rate=7.859373280370914E-4]:7.10548995694451)[&rate=8.955878929371682E-4]:1.8335739723162359,(6[&rate=8.227513426251533E-4]:7.202614815411728,21[&rate=8.183337626960612E-4]:7.202614815411728)[&rate=9.88989247132463E-4]:1.7364491138490177)[&rate=0.0010128477783515556]:2.2402290728754792,7[&rate=7.455346793925609E-4]:11.179293002136225)[&rate=9.154046445567891E-4]:0.43879594383508724)[&rate=7.859373280370914E-4]:0.6302872336961034,14[&rate=0.001219622337125266]:12.248376179667416)[&rate=7.389683761806267E-4]:0.5610817434601181,(5[&rate=6.222115776586409E-4]:8.990798190985851,18[&rate=5.876059370633124E-4]:8.990798190985851)[&rate=7.455346793925609E-4]:3.8186597321416826)[&rate=9.505006852310006E-4]:1.429263021717711,((3[&rate=5.271167036028412E-4]:5.313692977980372,33[&rate=4.3755851808600536E-4]:5.313692977980372)[&rate=7.389683761806267E-4]:0.7116391616850146,19[&rate=4.3755851808600536E-4]:6.0253321396653865)[&rate=5.615395608140015E-4]:8.213388805179857)[&rate=0.0011938898143743144]:1.3701926912177953,28[&rate=4.3755851808600536E-4]:15.60891363606304)[&rate=0.0014583049452599306]:9.815701411153487,35[&rate=6.496661491806004E-4]:25.424615047216527)[&rate=0.0012239245589600585]:4.73339485163477,34[&rate=7.455346793925609E-4]:30.158009898851297)[&rate=1.0]:0.0;
86 | tree STATE_40000 = (((((((((((((((((1[&rate=0.00165692325258258]:2.292868399855109,(2[&rate=0.0018571925075931029]:1.9011282460652879,26[&rate=0.001458647936446763]:1.9011282460652879)[&rate=0.00165692325258258]:0.3917401537898211)[&rate=0.0015211236132664737]:0.948744904453446,30[&rate=0.001620764249051201]:3.241613304308555)[&rate=0.0013901220569166328]:0.8369865833327252,13[&rate=0.001669783175504984]:4.07859988764128)[&rate=0.0013039707209037143]:0.8353203200260158,12[&rate=0.0017539007355628444]:4.913920207667296)[&rate=0.0023237302888531987]:0.20630308868453362,25[&rate=0.0013901220569166328]:5.1202232963518295)[&rate=0.0015145715846511876]:0.5633749303708182,((9[&rate=7.869089894915893E-4]:1.7258588223946694,20[&rate=0.0014954091230214754]:1.7258588223946694)[&rate=0.001343525796569259]:3.4472790307926218,((15[&rate=0.0012523487493040202]:3.009310434902247,(17[&rate=0.001295788119961547]:1.222028272584045,24[&rate=0.0010636906680749503]:1.222028272584045)[&rate=0.0016139183153724233]:1.7872821623182018)[&rate=0.0018199715977897583]:0.7589121685634961,(16[&rate=0.0022098152270576326]:1.6288272685304905,31[&rate=0.0018571925075931029]:1.6288272685304905)[&rate=9.738011486976847E-4]:2.1393953349352524)[&rate=0.0013419813320550062]:1.4049152497215482)[&rate=0.0012657615177791113]:0.5104603735353566)[&rate=0.0015978735317666408]:0.5835966953905958,(27[&rate=0.0010882735289847755]:5.253192116790149,29[&rate=0.001343525796569259]:5.253192116790149)[&rate=0.0011333441366489312]:1.014002805323094)[&rate=0.0014270710113908132]:0.08455702258538178,11[&rate=0.0011034471273528841]:6.351751944698625)[&rate=9.363183731236731E-4]:0.06937585440843907,32[&rate=0.0012523487493040202]:6.421127799107064)[&rate=0.0011212818282660417]:0.113283121916961,23[&rate=0.001373816033164084]:6.534410921024025)[&rate=0.0014409525302838816]:0.48144878566321303,((((4[&rate=0.0015547480888961727]:3.8373475047278114,(8[&rate=0.001187969307466185]:2.2280434990607096,22[&rate=0.0011184599484033685]:2.2280434990607096)[&rate=0.0023016618391909455]:1.6093040056671017)[&rate=0.0014270710113908132]:0.6351607773218908,10[&rate=0.0013419813320550062]:4.472508282049702)[&rate=0.0018199715977897583]:0.8715332971562413,(6[&rate=0.0011921474838699126]:4.351368731776038,21[&rate=0.0012657615177791113]:4.351368731776038)[&rate=0.0015211236132664737]:0.9926728474299056)[&rate=0.0023016618391909455]:0.9408440774811497,7[&rate=0.0012067874761595818]:6.284885656687093)[&rate=0.0013039707209037143]:0.7309740500001451)[&rate=0.0012361499130248783]:0.3485284289878914,14[&rate=0.001669783175504984]:7.36438813567513)[&rate=0.0018199715977897583]:0.010095730545504722,(5[&rate=0.001177506257396334]:3.747913850408225,18[&rate=0.0011921474838699126]:3.747913850408225)[&rate=8.947830082412816E-4]:3.6265700158124097)[&rate=0.0013039707209037143]:1.2434751013747842,((3[&rate=8.947830082412816E-4]:2.0035915234061306,33[&rate=0.0010198019531529679]:2.0035915234061306)[&rate=0.0012361499130248783]:0.3986374302900546,19[&rate=0.0012657615177791113]:2.402228953696185)[&rate=8.247467058094839E-4]:6.2157300138992335)[&rate=0.0016801788808749594]:0.8596290279856316,28[&rate=6.091490556788906E-4]:9.47758799558105)[&rate=0.0020067121256377982]:6.351353651776931,35[&rate=0.0011034471273528841]:15.828941647357981)[&rate=0.001311009896295684]:0.9895733378735958,34[&rate=0.0016801788808749594]:16.818514985231577)[&rate=1.0]:0.0;
87 | tree STATE_50000 = (((((((((((((((((1[&rate=9.583564508566703E-4]:3.947055103501719,(2[&rate=7.392809749969046E-4]:3.305412185662518,26[&rate=8.775265902328425E-4]:3.305412185662518)[&rate=9.56455600917209E-4]:0.6416429178392011)[&rate=8.481677483513899E-4]:0.7059260891321903,30[&rate=9.76016426864096E-4]:4.652981192633909)[&rate=8.281884018636047E-4]:1.958401147123089,13[&rate=8.517655141728602E-4]:6.611382339756998)[&rate=7.959577374113641E-4]:1.648503433853433,12[&rate=8.397356809697384E-4]:8.259885773610431)[&rate=6.496378895812562E-4]:1.1904885945625345,25[&rate=6.573970309991104E-4]:9.450374368172966)[&rate=6.852799796189362E-4]:0.9409128538531988,((9[&rate=5.892708909052068E-4]:3.4100514206485517,20[&rate=5.210455155263409E-4]:3.4100514206485517)[&rate=7.060674873531006E-4]:5.830242078448583,((15[&rate=7.76099580960253E-4]:4.532353999205095,(17[&rate=7.858872265444046E-4]:1.833550767685803,24[&rate=6.243173790314437E-4]:1.833550767685803)[&rate=7.49973276181316E-4]:2.6988032315192925)[&rate=7.052558198870429E-4]:1.7456937488847553,(16[&rate=8.170718265306982E-4]:3.9748274679868816,31[&rate=7.392809749969046E-4]:3.9748274679868816)[&rate=7.76099580960253E-4]:2.303220280102969)[&rate=5.79898162451758E-4]:2.962245751007284)[&rate=8.829898791317865E-4]:1.1509937229290301)[&rate=7.052558198870429E-4]:1.3981760089253505,(27[&rate=6.889793003872737E-4]:8.10026046890966,29[&rate=7.305553718042461E-4]:8.10026046890966)[&rate=3.201280870564486E-4]:3.6892027620418553)[&rate=7.305553718042461E-4]:0.17399438701963987,11[&rate=6.243173790314437E-4]:11.963457617971155)[&rate=6.573970309991104E-4]:0.17208958076914094,32[&rate=6.573970309991104E-4]:12.135547198740296)[&rate=0.0010213226050633096]:0.3066675836206709,23[&rate=6.496378895812562E-4]:12.442214782360967)[&rate=5.590048209319254E-4]:0.8865774703537657,((((4[&rate=9.583564508566703E-4]:4.889059345346273,(8[&rate=9.217331655170599E-4]:1.8019689101926126,22[&rate=9.997739613800533E-4]:1.8019689101926126)[&rate=0.001054593958678068]:3.0870904351536606)[&rate=7.49973276181316E-4]:1.6897649557954564,10[&rate=7.57268476013356E-4]:6.578824301141729)[&rate=5.892708909052068E-4]:3.1846428163380693,(6[&rate=7.052558198870429E-4]:8.067431118324015,21[&rate=6.889793003872737E-4]:8.067431118324015)[&rate=6.496378895812562E-4]:1.696035999155784)[&rate=8.397356809697384E-4]:3.0826042187588882,7[&rate=5.892708909052068E-4]:12.846071336238687)[&rate=0.0011613313930163688]:0.48272091647604576)[&rate=5.892708909052068E-4]:0.3807717024242674,14[&rate=9.384483825733071E-4]:13.709563955139)[&rate=8.775265902328425E-4]:0.7150754261730974,(5[&rate=7.060674873531006E-4]:6.201366272021108,18[&rate=7.49973276181316E-4]:6.201366272021108)[&rate=4.30359069725975E-4]:8.22327310929099)[&rate=0.0011613313930163688]:1.2312286443034033,((3[&rate=6.265131496840288E-4]:4.785040376337537,33[&rate=5.021298761218026E-4]:4.785040376337537)[&rate=0.001054593958678068]:0.1722839768899771,19[&rate=6.581509167660443E-4]:4.957324353227514)[&rate=4.7023822837524666E-4]:10.698543672387988)[&rate=7.219860140374795E-4]:1.6001888205025132,28[&rate=3.664153992231621E-4]:17.256056846118014)[&rate=0.0012095998422091269]:8.598378738231418,35[&rate=6.581509167660443E-4]:25.85443558434943)[&rate=9.217331655170599E-4]:2.365596860604416,34[&rate=8.281884018636047E-4]:28.220032444953848)[&rate=1.0]:0.0;
88 | tree STATE_60000 = (((((((((((((((((1[&rate=0.0011259431358695271]:3.6274462772049665,(2[&rate=9.296806149088367E-4]:2.878100297217943,26[&rate=8.085019220538684E-4]:2.878100297217943)[&rate=6.771145984894717E-4]:0.7493459799870235)[&rate=5.361017694839157E-4]:1.0611939283021314,30[&rate=8.390568910563346E-4]:4.688640205507098)[&rate=8.390568910563346E-4]:1.920358609468602,13[&rate=9.840935672703161E-4]:6.6089988149757)[&rate=0.0010019396622096824]:1.2015839451300883,12[&rate=0.0010904207891735693]:7.810582760105788)[&rate=0.0010674142592737833]:0.38437321691656834,25[&rate=8.5348499632058E-4]:8.194955977022357)[&rate=9.055510383534121E-4]:0.6467009383521631,((9[&rate=8.085019220538684E-4]:2.205896777112391,20[&rate=6.275550366993994E-4]:2.205896777112391)[&rate=9.427290809601471E-4]:5.422660641370909,((15[&rate=0.0011259431358695271]:3.269399530226769,(17[&rate=8.965484944724851E-4]:1.665117727721364,24[&rate=6.29138361094081E-4]:1.665117727721364)[&rate=0.0010231946226118567]:1.604281802505405)[&rate=6.275550366993994E-4]:1.7889189912380088,(16[&rate=8.842199773777937E-4]:3.513658339944548,31[&rate=8.184306113018028E-4]:3.513658339944548)[&rate=0.0010904207891735693]:1.5446601815202299)[&rate=5.932369024985005E-4]:2.5702388970185215)[&rate=8.184306113018028E-4]:1.2130994968912203)[&rate=7.270518379651846E-4]:0.7955530630016128,(27[&rate=9.427290809601471E-4]:6.6720900883016085,29[&rate=9.368961700237439E-4]:6.6720900883016085)[&rate=5.253574898651946E-4]:2.965119890074524)[&rate=8.085019220538684E-4]:0.49154588678791455,11[&rate=6.68900266888472E-4]:10.128755865164047)[&rate=0.0011259431358695271]:0.20732782759145607,32[&rate=7.618337505423491E-4]:10.336083692755503)[&rate=3.912054494882171E-4]:0.06344844721381548,23[&rate=7.708324042727194E-4]:10.399532139969319)[&rate=4.891649995114814E-4]:0.9923867576132839,((((4[&rate=0.0010231946226118567]:5.226300797058101,(8[&rate=0.0010942672521199203]:2.095743319380465,22[&rate=0.0013038183877594302]:2.095743319380465)[&rate=8.007131611681355E-4]:3.1305574776776357)[&rate=0.0012399019543745944]:1.153163580103299,10[&rate=8.390568910563346E-4]:6.3794643771613995)[&rate=7.355926019144308E-4]:1.903263674622016,(6[&rate=9.368961700237439E-4]:6.601729440210226,21[&rate=7.538369002629116E-4]:6.601729440210226)[&rate=9.296806149088367E-4]:1.6809986115731892)[&rate=0.001449020770837128]:1.4248875190167922,7[&rate=6.68900266888472E-4]:9.707615570800208)[&rate=6.106177833153145E-4]:1.6843033267823948)[&rate=6.106177833153145E-4]:0.7227099825777348,14[&rate=0.0012914360340082168]:12.114628880160337)[&rate=0.0013038183877594302]:0.04805730654381435,(5[&rate=4.4152559998633423E-4]:6.343996497443996,18[&rate=5.721991681960729E-4]:6.343996497443996)[&rate=4.627559082207907E-4]:5.818689689260156)[&rate=9.055510383534121E-4]:1.0762343292039827,((3[&rate=6.68900266888472E-4]:3.4383219845623834,33[&rate=7.102042561975441E-4]:3.4383219845623834)[&rate=5.361017694839157E-4]:0.47196860019336606,19[&rate=7.538369002629116E-4]:3.9102905847557494)[&rate=5.463886449231143E-4]:9.328629931152385)[&rate=8.286070565289179E-4]:1.4780896940855293,28[&rate=3.912054494882171E-4]:14.717010209993663)[&rate=0.001449020770837128]:7.440069595963692,35[&rate=6.29138361094081E-4]:22.157079805957355)[&rate=6.275550366993994E-4]:8.08410446880125,34[&rate=8.085019220538684E-4]:30.241184274758606)[&rate=1.0]:0.0;
89 | tree STATE_70000 = (((((((((((((((((1[&rate=0.0012377298395160167]:3.2307317429836764,(2[&rate=0.001373477156657842]:2.597104637762057,26[&rate=9.69620400771336E-4]:2.597104637762057)[&rate=0.0015943752519903464]:0.6336271052216196)[&rate=0.0010990948097127095]:0.9099247270290287,30[&rate=8.688208611575861E-4]:4.140656470012705)[&rate=0.00108377160482356]:1.4379992044981815,13[&rate=0.0011503378296880383]:5.578655674510887)[&rate=0.0012377298395160167]:0.9097295614359373,12[&rate=0.001331507713795657]:6.488385235946824)[&rate=0.0012960115060281967]:0.46658456592206754,25[&rate=9.17223515544666E-4]:6.9549698018688915)[&rate=5.22225426882951E-4]:1.8112969209775684,((9[&rate=6.666576435364385E-4]:2.2479993356857735,20[&rate=7.29335744310186E-4]:2.2479993356857735)[&rate=8.50138648990468E-4]:5.158771020338523,((15[&rate=6.428323824445036E-4]:3.668905739237848,(17[&rate=6.550126079392882E-4]:1.872936873703963,24[&rate=0.00108377160482356]:1.872936873703963)[&rate=0.0012960115060281967]:1.795968865533885)[&rate=7.485666368121785E-4]:1.8324965035552112,(16[&rate=6.992085401833518E-4]:4.068482038591864,31[&rate=7.390179756296221E-4]:4.068482038591864)[&rate=0.0011696665715718428]:1.4329202042011948)[&rate=9.273128878993481E-4]:1.905368113231237)[&rate=0.0011152140105768061]:1.3594963668221638)[&rate=7.673528174426337E-4]:0.7060881276543984,(27[&rate=6.016668499472911E-4]:8.161481936542188,29[&rate=6.778592689930887E-4]:8.161481936542188)[&rate=7.485666368121785E-4]:1.3108729139586703)[&rate=0.0011696665715718428]:0.17142517307279448,11[&rate=6.016668499472911E-4]:9.643780023573653)[&rate=6.428323824445036E-4]:0.16181387255443624,32[&rate=7.950369777517389E-4]:9.805593896128089)[&rate=4.890737982504453E-4]:0.2740565034560536,23[&rate=7.950369777517389E-4]:10.079650399584143)[&rate=7.29335744310186E-4]:0.3436535808590495,((((4[&rate=9.587094925813308E-4]:5.084714423678225,(8[&rate=0.0012377298395160167]:2.4529464793173195,22[&rate=9.07291564373149E-4]:2.4529464793173195)[&rate=0.0011904612993338059]:2.6317679443609054)[&rate=0.001213017859122472]:0.8709294241653165,10[&rate=8.782795942858268E-4]:5.955643847843541)[&rate=9.587094925813308E-4]:1.7085655141335003,(6[&rate=9.922565214567562E-4]:5.9461182488217155,21[&rate=0.001004039901555512]:5.9461182488217155)[&rate=6.299978682200455E-4]:1.7180911131553263)[&rate=0.001373477156657842]:1.9530064013223125,7[&rate=6.666576435364385E-4]:9.617215763299354)[&rate=0.001041680355469916]:0.8060882171438379)[&rate=6.778592689930887E-4]:0.9187762666907737,14[&rate=0.0018070436428671173]:11.342080247133966)[&rate=4.315153999768506E-4]:0.24697149473545998,(5[&rate=7.390179756296221E-4]:6.706326057430839,18[&rate=6.886900317566694E-4]:6.706326057430839)[&rate=6.163497533433874E-4]:4.8827256844385865)[&rate=9.07291564373149E-4]:1.010284028794345,((3[&rate=8.688208611575861E-4]:2.984377496142241,33[&rate=9.587094925813308E-4]:2.984377496142241)[&rate=7.766296529842816E-4]:0.3465711401805365,19[&rate=7.858523914588483E-4]:3.3309486363227774)[&rate=4.890737982504453E-4]:9.268387134340994)[&rate=7.390179756296221E-4]:1.744553542206953,28[&rate=4.315153999768506E-4]:14.343889312870724)[&rate=0.0018070436428671173]:8.228425925388008,35[&rate=6.778592689930887E-4]:22.57231523825873)[&rate=8.408889496767858E-4]:1.6114972325738819,34[&rate=0.0010287101732538828]:24.183812470832613)[&rate=1.0]:0.0;
90 | tree STATE_80000 = (((((((((((((((((1[&rate=0.0010286991748353791]:4.019542292601184,(2[&rate=0.0010626799138658074]:3.15611717185043,26[&rate=0.0010861302127507094]:3.15611717185043)[&rate=8.76770776194737E-4]:0.8634251207507537)[&rate=0.0013699908831274767]:0.47156241411167343,30[&rate=0.0012087966132687093]:4.491104706712857)[&rate=0.001965448453557281]:0.6020214680350549,13[&rate=0.0014120706099728997]:5.093126174747912)[&rate=8.920378516205545E-4]:1.484340254619763,12[&rate=0.0012200849582364249]:6.577466429367675)[&rate=9.849047778049437E-4]:0.24522760901655172,25[&rate=0.0010112119506420231]:6.822694038384227)[&rate=0.0012200849582364249]:1.0921835202248626,((9[&rate=9.204423191608839E-4]:1.7181385103017401,20[&rate=0.0010112119506420231]:1.7181385103017401)[&rate=8.655867524018744E-4]:5.166759746489279,((15[&rate=9.204423191608839E-4]:4.544602221303067,(17[&rate=0.0013943470442279201]:1.2634461721930854,24[&rate=8.920378516205545E-4]:1.2634461721930854)[&rate=8.54246282426629E-4]:3.281156049109981)[&rate=0.0018674377917593467]:0.5068074750018301,(16[&rate=0.001017620480730091]:3.6856890479175295,31[&rate=0.0010940353724838542]:3.6856890479175295)[&rate=0.0014497110861542873]:1.3657206483873674)[&rate=0.0010743128722552743]:1.8334885604861224)[&rate=8.920378516205545E-4]:1.02997930181807)[&rate=0.001135683571230068]:1.1437115352989968,(27[&rate=9.311999143528612E-4]:7.938456416088714,29[&rate=8.987743939932035E-4]:7.938456416088714)[&rate=5.47496872941097E-4]:1.120132677819372)[&rate=9.096400376092741E-4]:0.2163812262104443,11[&rate=7.21282886228055E-4]:9.27497032011853)[&rate=0.001135683571230068]:0.07596645934171242,32[&rate=8.636399673753049E-4]:9.350936779460243)[&rate=0.0010626799138658074]:0.010010393817299956,23[&rate=7.359838430604985E-4]:9.360947173277543)[&rate=8.066393344382743E-4]:0.10947279559606571,((((4[&rate=0.0010940353724838542]:4.8823281697729595,(8[&rate=0.0010112119506420231]:2.9730565298601963,22[&rate=9.311999143528612E-4]:2.9730565298601963)[&rate=0.0021165290829971858]:1.9092716399127632)[&rate=9.204423191608839E-4]:1.2742584656881242,10[&rate=9.501682570026039E-4]:6.156586635461084)[&rate=0.0014207667795749473]:1.2098312842775005,(6[&rate=0.00128733256604543]:4.869429775832256,21[&rate=0.001017620480730091]:4.869429775832256)[&rate=7.047120257528775E-4]:2.4969881439063286)[&rate=0.001965448453557281]:1.133585653447371,7[&rate=8.54246282426629E-4]:8.500003573185955)[&rate=0.001017620480730091]:0.9704163956876535)[&rate=0.0010861302127507094]:0.3441949027668798,14[&rate=0.0015179744303549028]:9.814614871640488)[&rate=9.501682570026039E-4]:0.2041598525833468,(5[&rate=7.529278212547368E-4]:7.75648090349909,18[&rate=5.47496872941097E-4]:7.75648090349909)[&rate=0.0010861302127507094]:2.2622938207247456)[&rate=0.0014497110861542873]:0.8016494358872848,((3[&rate=0.0012693850145733736]:1.7920536416118682,33[&rate=0.001122903993604916]:1.7920536416118682)[&rate=7.378951889608614E-4]:0.5487622710403803,19[&rate=0.0013699908831274767]:2.3408159126522485)[&rate=7.047120257528775E-4]:8.479608247458872)[&rate=0.0014120706099728997]:1.2959155733448533,28[&rate=5.728355935480223E-4]:12.116339733455973)[&rate=0.0021015926069674062]:7.408913137278731,35[&rate=8.987743939932035E-4]:19.525252870734704)[&rate=0.001017620480730091]:3.08010691495328,34[&rate=0.0010112119506420231]:22.605359785687984)[&rate=1.0]:0.0;
91 | tree STATE_90000 = (((((((((((((((((1[&rate=0.0011146697856345511]:3.179922183810351,(2[&rate=0.0013599447973414959]:2.6994939364036425,26[&rate=0.0010211557668568007]:2.6994939364036425)[&rate=8.921837189927346E-4]:0.4804282474067083)[&rate=7.751077238336167E-4]:1.8841156171903033,30[&rate=0.0012600766674092444]:5.064037801000654)[&rate=0.0014017159553117928]:1.0177365435329273,13[&rate=9.776825123061664E-4]:6.0817743445335815)[&rate=0.001596910742652182]:0.939896137616465,12[&rate=9.029696852991009E-4]:7.021670482150046)[&rate=0.001296634039535016]:0.251142825876018,25[&rate=9.548631986890747E-4]:7.272813308026064)[&rate=0.0014390804154573071]:0.4298982057914529,((9[&rate=9.776825123061664E-4]:1.6107408504367304,20[&rate=0.0011146697856345511]:1.6107408504367304)[&rate=9.32064564615683E-4]:5.247049757475108,((15[&rate=9.32064564615683E-4]:3.4401650539125104,(17[&rate=9.029696852991009E-4]:1.6767149919496656,24[&rate=0.001211138126321276]:1.6767149919496656)[&rate=0.001024955886880275]:1.7634500619628448)[&rate=9.548631986890747E-4]:1.3733297865757796,(16[&rate=7.751077238336167E-4]:3.309899511150958,31[&rate=8.921837189927346E-4]:3.309899511150958)[&rate=8.921837189927346E-4]:1.5035953293373319)[&rate=0.0010781656653756713]:2.0442957674235487)[&rate=0.0011536741553363292]:0.8449209059056786)[&rate=0.0011673744241564134]:0.6452053629168599,(27[&rate=8.703414528023172E-4]:8.067687785727616,29[&rate=7.15993749022656E-4]:8.067687785727616)[&rate=0.0018537439486199165]:0.2802290910067615)[&rate=8.479821302039353E-4]:0.1449017722239727,11[&rate=7.15993749022656E-4]:8.49281864895835)[&rate=9.548631986890747E-4]:0.13342721354515596,32[&rate=8.854965754032527E-4]:8.626245862503506)[&rate=7.15993749022656E-4]:0.17487134948928507,23[&rate=0.001010158312351534]:8.801117211992791)[&rate=8.854965754032527E-4]:0.8412539691922039,((((4[&rate=0.001235940667296165]:4.167391430571856,(8[&rate=0.0013374717074858865]:1.999746166422864,22[&rate=0.001596910742652182]:1.999746166422864)[&rate=0.001596910742652182]:2.167645264148992)[&rate=7.61568305028205E-4]:1.1359604919543829,10[&rate=0.0010211557668568007]:5.303351922526239)[&rate=0.0012778926102378]:1.2419288398249124,(6[&rate=0.0010211557668568007]:5.722607694351582,21[&rate=0.001024955886880275]:5.722607694351582)[&rate=0.0020861817163718567]:0.8226730679995695)[&rate=8.921837189927346E-4]:2.463532945245781,7[&rate=7.474066330657254E-4]:9.008813707596932)[&rate=0.0011536741553363292]:0.6335574735880627)[&rate=9.776825123061664E-4]:0.40339013145103486,14[&rate=0.001504749830880272]:10.04576131263603)[&rate=0.0015068431874130097]:0.00773326649255246,(5[&rate=9.32064564615683E-4]:6.4307623188134855,18[&rate=7.166158807767299E-4]:6.4307623188134855)[&rate=7.474066330657254E-4]:3.6227322603150967)[&rate=0.0013374717074858865]:1.0794095157021282,((3[&rate=0.0011418072272722421]:2.143264760719118,33[&rate=9.432007129564909E-4]:2.143264760719118)[&rate=0.0015068431874130097]:0.2319639056732048,19[&rate=0.0010781656653756713]:2.375228666392323)[&rate=5.017131697477157E-4]:8.757675428438388)[&rate=0.0011273556511520446]:1.1347894921469734,28[&rate=5.017131697477157E-4]:12.267693586977684)[&rate=0.0018537439486199165]:7.6615855343408175,35[&rate=7.15993749022656E-4]:19.9292791213185)[&rate=0.001087361759012379]:3.803191460209277,34[&rate=9.32064564615683E-4]:23.732470581527778)[&rate=1.0]:0.0;
92 | tree STATE_100000 = (((((((((((((((((1[&rate=8.763796570579077E-4]:4.718414689878289,(2[&rate=9.11519495417471E-4]:3.049251305338621,26[&rate=4.6123933743129943E-4]:3.049251305338621)[&rate=9.388727771518505E-4]:1.6691633845396678)[&rate=6.859339437186345E-4]:0.8891452966326581,30[&rate=8.190202161528714E-4]:5.607559986510947)[&rate=8.867869603979451E-4]:1.5648460916249602,13[&rate=9.11519495417471E-4]:7.172406078135907)[&rate=0.001051437851695027]:1.1127228964573757,12[&rate=9.5720750312626E-4]:8.285128974593283)[&rate=5.888045927476014E-4]:0.6413051130941341,25[&rate=6.512465857722444E-4]:8.926434087687417)[&rate=8.101090923729596E-4]:1.2778256166457158,((9[&rate=9.11519495417471E-4]:2.048562150400123,20[&rate=7.164951329923874E-4]:2.048562150400123)[&rate=6.777404677628039E-4]:7.188081854735978,((15[&rate=6.611481590378632E-4]:5.794609470053158,(17[&rate=5.549846962656796E-4]:2.6781087000321686,24[&rate=5.438991185870431E-4]:2.6781087000321686)[&rate=6.940796401254559E-4]:3.116500770020989)[&rate=7.785998190986199E-4]:1.394139259980264,(16[&rate=6.859339437186345E-4]:5.045449476907851,31[&rate=7.08035643960133E-4]:5.045449476907851)[&rate=8.46750289021108E-4]:2.143299253125571)[&rate=9.388727771518505E-4]:2.0478952751026798)[&rate=5.56425988399975E-4]:0.9676156991970313)[&rate=0.001176012702716262]:0.710714030281169,(27[&rate=7.08035643960133E-4]:9.865636148488763,29[&rate=5.986980794256006E-4]:9.865636148488763)[&rate=5.888045927476014E-4]:1.0493375861255387)[&rate=6.859339437186345E-4]:0.07912482619898498,11[&rate=5.438991185870431E-4]:10.994098560813287)[&rate=3.811225323988958E-4]:0.543798055139856,32[&rate=6.777404677628039E-4]:11.537896615953143)[&rate=0.001051437851695027]:0.1716443484227348,23[&rate=7.673589559564561E-4]:11.709540964375877)[&rate=6.527146015539121E-4]:0.6806335962130365,((((4[&rate=0.001016000047248545]:5.2654341903661726,(8[&rate=9.84978028363676E-4]:2.506218589323155,22[&rate=9.70741246422868E-4]:2.506218589323155)[&rate=0.0012130809054915627]:2.7592156010430173)[&rate=0.0010330715562960442]:1.0000150609165424,10[&rate=8.46750289021108E-4]:6.265449251282715)[&rate=7.164951329923874E-4]:2.306986912455913,(6[&rate=8.46750289021108E-4]:6.77589285735778,21[&rate=6.726606308101084E-4]:6.77589285735778)[&rate=7.42688965409478E-4]:1.7965433063808476)[&rate=7.673589559564561E-4]:3.1006943549944115,7[&rate=5.78519477878238E-4]:11.67313051873304)[&rate=6.940796401254559E-4]:0.7170440418558748)[&rate=8.46750289021108E-4]:0.40055254491257486,14[&rate=0.001176012702716262]:12.790727105501489)[&rate=7.673589559564561E-4]:0.029693984882779745,(5[&rate=6.175541580298413E-4]:6.626844150840938,18[&rate=7.021916398065113E-4]:6.626844150840938)[&rate=4.6034212740488913E-4]:6.19357693954333)[&rate=8.249812745576146E-4]:1.2492714593529683,((3[&rate=5.677616732065832E-4]:2.8734015335420535,33[&rate=8.867869603979451E-4]:2.8734015335420535)[&rate=0.0010931863170754272]:0.2261755533997194,19[&rate=9.388727771518505E-4]:3.099577086941773)[&rate=3.811225323988958E-4]:10.970115462795464)[&rate=7.42688965409478E-4]:2.4559374552575015,28[&rate=3.811225323988958E-4]:16.52563000499474)[&rate=0.0015960149959000037]:7.173917839889604,35[&rate=7.508584741374353E-4]:23.699547844884343)[&rate=0.0010931863170754272]:4.934203276646471,34[&rate=7.757130872883016E-4]:28.633751121530814)[&rate=1.0]:0.0;
93 | tree STATE_110000 = (((((((((((((((((1[&rate=0.0012405623388946374]:2.7526500730416363,(2[&rate=0.0011648796848285636]:2.1820022650674407,26[&rate=9.950144966057884E-4]:2.1820022650674407)[&rate=0.0013607685106371637]:0.5706478079741957)[&rate=8.765918010412109E-4]:1.1388537714989257,30[&rate=0.0011757579116401617]:3.891503844540562)[&rate=9.491220893258173E-4]:1.8702633546493432,13[&rate=0.0011611183014412765]:5.761767199189905)[&rate=0.0011084523324444795]:1.1894357234454596,12[&rate=0.001199835911619059]:6.951202922635365)[&rate=0.0010821076397841112]:0.5938654578302023,25[&rate=9.269693819339796E-4]:7.545068380465567)[&rate=7.892056029376531E-4]:0.3801572293431814,((9[&rate=9.595623429902423E-4]:1.0928398040209795,20[&rate=0.001035281888039012]:1.0928398040209795)[&rate=9.048367499873667E-4]:6.061269863743039,((15[&rate=8.449167165341681E-4]:4.3899701838404726,(17[&rate=0.0010542878478490537]:2.193263277578125,24[&rate=7.651084080756269E-4]:2.193263277578125)[&rate=0.001035281888039012]:2.1967069062623477)[&rate=0.001460792522542848]:0.9663753187911768,(16[&rate=9.048367499873667E-4]:3.027639677825094,31[&rate=9.048367499873667E-4]:3.027639677825094)[&rate=0.001035281888039012]:2.3287058248065553)[&rate=0.0010542878478490537]:1.797764165132369)[&rate=6.950778749367654E-4]:0.7711159420447302)[&rate=7.255731141984153E-4]:1.312246903429024,(27[&rate=9.913253870932725E-4]:7.5677452435297425,29[&rate=8.449167165341681E-4]:7.5677452435297425)[&rate=7.773332282342379E-4]:1.66972726970803)[&rate=0.0010821076397841112]:0.14352104730416926,11[&rate=7.0924472961991E-4]:9.380993560541942)[&rate=0.0013202175871755077]:0.06614246409915303,32[&rate=8.449167165341681E-4]:9.447136024641095)[&rate=0.0012405623388946374]:0.09084613979079847,23[&rate=8.661209183699553E-4]:9.537982164431893)[&rate=0.0010542878478490537]:0.653527398886137,((((4[&rate=0.0012405623388946374]:3.6767482006828076,(8[&rate=0.0020252394048510054]:1.2881836256340813,22[&rate=0.0015028897498973338]:1.2881836256340813)[&rate=0.001460792522542848]:2.3885645750487265)[&rate=0.001460792522542848]:0.7714585969543353,10[&rate=0.0013607685106371637]:4.448206797637143)[&rate=8.973683834292934E-4]:1.74860313385261,(6[&rate=0.0011648796848285636]:4.805206018482048,21[&rate=0.001133272650921558]:4.805206018482048)[&rate=9.80649194294566E-4]:1.391603913007705)[&rate=0.0012459081686644479]:1.9398918390820903,7[&rate=8.322629646364333E-4]:8.136701770571843)[&rate=7.393210901642229E-4]:2.054807792746187)[&rate=8.870016236624392E-4]:0.48104685337324327,14[&rate=0.0013970414663599681]:10.672556416691274)[&rate=0.0011757579116401617]:0.11319199156567983,(5[&rate=5.276057012367528E-4]:7.830183563395429,18[&rate=5.024191610335493E-4]:7.830183563395429)[&rate=8.449167165341681E-4]:2.9555648448615246)[&rate=0.0012587562866308688]:1.4403982177154528,((3[&rate=9.950144966057884E-4]:2.9593789725579027,33[&rate=6.791090522946623E-4]:2.9593789725579027)[&rate=0.0012232668419742089]:0.3644824930316939,19[&rate=7.0924472961991E-4]:3.3238614655895966)[&rate=5.882959113662416E-4]:8.90228516038281)[&rate=9.913253870932725E-4]:2.0692575534691873,28[&rate=5.520238378782333E-4]:14.295404179441594)[&rate=0.0017995916950985116]:5.1830526801883785,35[&rate=8.449167165341681E-4]:19.478456859629972)[&rate=7.110866341930809E-4]:0.12906881044300533,34[&rate=0.0012405623388946374]:19.607525670072977)[&rate=1.0]:0.0;
94 | tree STATE_120000 = (((((((((((((((((1[&rate=0.001362531094229297]:2.86397153439632,(2[&rate=0.001243718298957519]:2.50756660444152,26[&rate=9.045866595908914E-4]:2.50756660444152)[&rate=0.001154969190246403]:0.3564049299547998)[&rate=0.0016230044141443065]:0.8562357445341475,30[&rate=0.0010427250753798187]:3.7202072789304674)[&rate=7.115387550839947E-4]:1.5191628521748513,13[&rate=0.0013097626679627467]:5.239370131105319)[&rate=0.001154969190246403]:1.1369726766156738,12[&rate=0.0014639987166084638]:6.3763428077209925)[&rate=5.977043588689674E-4]:0.670428814564139,25[&rate=9.263935049505389E-4]:7.0467716222851315)[&rate=0.0012242197988865866]:0.7952506531868888,((9[&rate=8.397851474740623E-4]:1.5908176662186273,20[&rate=0.001154969190246403]:1.5908176662186273)[&rate=9.045866595908914E-4]:5.308709670963143,((15[&rate=8.82966548498682E-4]:3.8236357531648437,(17[&rate=0.001264348192912372]:1.9703053718264392,24[&rate=9.045866595908914E-4]:1.9703053718264392)[&rate=0.0011711745731636733]:1.8533303813384046)[&rate=8.721880780161067E-4]:1.4533276622759725,(16[&rate=0.0010685159791882575]:3.0923120921736498,31[&rate=0.001005994637524431]:3.0923120921736498)[&rate=8.82966548498682E-4]:2.1846513232671665)[&rate=0.001030246122178263]:1.6225639217409542)[&rate=9.263935049505389E-4]:0.9424949382902499)[&rate=0.0010427250753798187]:0.6820763870318824,(27[&rate=8.179495943833175E-4]:7.695305849561016,29[&rate=7.493231377224727E-4]:7.695305849561016)[&rate=0.0012242197988865866]:0.8287928129428872)[&rate=0.0010427250753798187]:0.24092396906367242,11[&rate=7.370967138973044E-4]:8.765022631567575)[&rate=9.045866595908914E-4]:0.200855747330694,32[&rate=7.957369631926456E-4]:8.96587837889827)[&rate=7.844283545065407E-4]:0.10526345712859708,23[&rate=0.001030246122178263]:9.071141836026866)[&rate=7.245239777314623E-4]:1.0276657841111732,((((4[&rate=0.001559210476532616]:4.686256196315227,(8[&rate=0.001362531094229297]:1.750862651502815,22[&rate=0.0017072085597219868]:1.750862651502815)[&rate=0.0012862885520168684]:2.9353935448124124)[&rate=0.0017072085597219868]:0.6398009205112016,10[&rate=9.597218901279685E-4]:5.326057116826429)[&rate=0.0017072085597219868]:0.9560980023223067,(6[&rate=9.941773798548366E-4]:5.229083541588196,21[&rate=0.0011711745731636733]:5.229083541588196)[&rate=9.710593327129795E-4]:1.05307157756054)[&rate=9.374050517562384E-4]:2.39614248662203,7[&rate=7.957369631926456E-4]:8.678297605770766)[&rate=6.534541910744668E-4]:1.4205100143672738)[&rate=0.0011243129077979823]:0.23552575196380587,14[&rate=0.0014261855091713704]:10.334333372101845)[&rate=0.001139369595164765]:0.4707551995579333,(5[&rate=4.4378440516429363E-4]:8.087890108894731,18[&rate=5.458893073787475E-4]:8.087890108894731)[&rate=0.001005994637524431]:2.7171984627650474)[&rate=0.0012862885520168684]:1.0985905056686587,((3[&rate=0.0011711745731636733]:1.5516485170913348,33[&rate=0.0013350541513730144]:1.5516485170913348)[&rate=4.4378440516429363E-4]:1.276227807297901,19[&rate=0.0010180103832356305]:2.8278763243892358)[&rate=4.4378440516429363E-4]:9.075802752939202)[&rate=0.001362531094229297]:0.5698936507630545,28[&rate=5.083822497376413E-4]:12.473572728091492)[&rate=0.00209999920540851]:7.277221650187075,35[&rate=8.289034945289074E-4]:19.750794378278567)[&rate=0.0013350541513730144]:1.4697136770099988,34[&rate=0.0012862885520168684]:21.220508055288565)[&rate=1.0]:0.0;
95 | tree STATE_130000 = (((((((((((((((((1[&rate=0.0011603526138195617]:2.495418468292391,(2[&rate=0.0012266263743812066]:1.8730463899780332,26[&rate=0.001363033847632461]:1.8730463899780332)[&rate=8.678755594635688E-4]:0.6223720783143578)[&rate=0.0011603526138195617]:1.277287212582026,30[&rate=0.0011603526138195617]:3.772705680874417)[&rate=0.0016827216993836884]:0.7755018824547908,13[&rate=0.0014320470448549389]:4.548207563329208)[&rate=9.097082660020605E-4]:1.7079181241396943,12[&rate=0.0010832955313014577]:6.256125687468902)[&rate=6.794022832675066E-4]:0.9043057962817391,25[&rate=8.138508403670782E-4]:7.160431483750641)[&rate=9.097082660020605E-4]:1.1370216528633543,((9[&rate=8.955991973778863E-4]:1.6380282073340373,20[&rate=0.001471299501189958]:1.6380282073340373)[&rate=7.205469597276627E-4]:5.883383801098069,((15[&rate=8.955991973778863E-4]:4.596790602238539,(17[&rate=9.836065953081176E-4]:1.4072563649417225,24[&rate=0.0015146733686533969]:1.4072563649417225)[&rate=7.205469597276627E-4]:3.189534237296817)[&rate=0.0011204768506899092]:1.293126285569529,(16[&rate=7.872390316756043E-4]:4.657698421932088,31[&rate=6.653005481351151E-4]:4.657698421932088)[&rate=0.00185585647447515]:1.23221846587598)[&rate=0.0011204768506899092]:1.631495120624038)[&rate=0.0017596593651770056]:0.7760411281818893)[&rate=9.240101201358732E-4]:1.0459779656712627,(27[&rate=8.816617613297356E-4]:7.800233785984858,29[&rate=9.240101201358732E-4]:7.800233785984858)[&rate=6.509301540888275E-4]:1.5431973163004002)[&rate=0.0010152039970031522]:0.04199197218863837,11[&rate=7.606802417438498E-4]:9.385423074473897)[&rate=6.794022832675066E-4]:0.33609525605177026,32[&rate=8.542207534986748E-4]:9.721518330525667)[&rate=8.816617613297356E-4]:0.03421089641047814,23[&rate=7.339972135849961E-4]:9.755729226936145)[&rate=0.0016827216993836884]:0.3709115643084022,((((4[&rate=8.678755594635688E-4]:5.651635658779334,(8[&rate=9.836065953081176E-4]:1.9439783928485754,22[&rate=0.0016184782807600112]:1.9439783928485754)[&rate=0.0010315583923304168]:3.7076572659307585)[&rate=0.0012764283321277069]:0.8095823407704499,10[&rate=8.005279244834012E-4]:6.461217999549784)[&rate=0.001471299501189958]:1.2076335046658162,(6[&rate=8.955991973778863E-4]:5.749471624607565,21[&rate=8.678755594635688E-4]:5.749471624607565)[&rate=7.339972135849961E-4]:1.9193798796080355)[&rate=0.0015632266393999581]:1.6553271735607504,7[&rate=7.069865293842046E-4]:9.32417867777635)[&rate=9.385268671596135E-4]:0.8024621134681968)[&rate=5.72538173062276E-4]:1.2336043853509917,14[&rate=0.001332260178496137]:11.360245176595539)[&rate=0.0011015819698739831]:0.03532045429147779,(5[&rate=9.532817889916096E-4]:4.998037600942062,18[&rate=8.005279244834012E-4]:4.998037600942062)[&rate=3.3193198099214536E-4]:6.397528029944954)[&rate=0.0016827216993836884]:0.8573121659886844,((3[&rate=0.0012508707014892654]:2.7540058838429484,33[&rate=5.153605159976969E-4]:2.7540058838429484)[&rate=7.205469597276627E-4]:0.3635050942221927,19[&rate=0.0011015819698739831]:3.117510978065141)[&rate=4.672819990135021E-4]:9.13536681881056)[&rate=0.0012508707014892654]:1.108563879679524,28[&rate=3.3193198099214536E-4]:13.361441676555225)[&rate=0.00185585647447515]:8.130647384260504,35[&rate=7.473661996763967E-4]:21.49208906081573)[&rate=0.0014320470448549389]:2.9452313977744673,34[&rate=9.240101201358732E-4]:24.437320458590197)[&rate=1.0]:0.0;
96 | tree STATE_140000 = (((((((((((((((((1[&rate=0.0011685215277143005]:3.51930142040196,(2[&rate=0.0012977486224362309]:2.6355562611155716,26[&rate=8.91363247224607E-4]:2.6355562611155716)[&rate=8.116092476346537E-4]:0.8837451592863883)[&rate=6.029081746653606E-4]:1.1801440471078264,30[&rate=7.8648555282205E-4]:4.699445467509786)[&rate=0.0012073198416083768]:1.1389057883008213,13[&rate=0.001084645963251746]:5.838351255810608)[&rate=6.15687438731979E-4]:2.040124926391848,12[&rate=0.001015397709648436]:7.878476182202456)[&rate=9.534515884118075E-4]:0.44256208322635704,25[&rate=8.505111290524369E-4]:8.321038265428813)[&rate=0.0011335631294626721]:0.8002873552158203,((9[&rate=5.094853810217739E-4]:3.815933143185969,20[&rate=5.262802349163264E-4]:3.815933143185969)[&rate=0.001084645963251746]:3.907385502154102,((15[&rate=8.853100129844784E-4]:3.671895083052192,(17[&rate=0.0015249148239679102]:1.3891680939337898,24[&rate=6.772776492015955E-4]:1.3891680939337898)[&rate=9.817032816685143E-4]:2.282726989118402)[&rate=5.188451231774926E-4]:2.315226859987085,(16[&rate=9.116889469400137E-4]:4.10991137796232,31[&rate=8.505111290524369E-4]:4.10991137796232)[&rate=7.642618215218481E-4]:1.8772105650769566)[&rate=0.0012073198416083768]:1.736196702300794)[&rate=7.375273115150565E-4]:1.398006975304562)[&rate=8.37355773214094E-4]:1.3169153736586168,(27[&rate=6.65162416433358E-4]:9.098253846092275,29[&rate=6.406848140120019E-4]:9.098253846092275)[&rate=7.8648555282205E-4]:1.3399871482109749)[&rate=5.094853810217739E-4]:0.27160279674613896,11[&rate=6.029081746653606E-4]:10.709843791049389)[&rate=0.001594637219021524]:0.05188132445488414,32[&rate=6.15687438731979E-4]:10.761725115504273)[&rate=0.001594637219021524]:0.022382409254232627,23[&rate=7.375273115150565E-4]:10.784107524758506)[&rate=8.853100129844784E-4]:0.3053722272877195,((((4[&rate=0.0010660759054404887]:5.221462133864705,(8[&rate=7.375273115150565E-4]:2.86122328200297,22[&rate=7.254538284566651E-4]:2.86122328200297)[&rate=0.0017303487937523722]:2.3602388518617348)[&rate=6.65162416433358E-4]:1.0429198498546626,10[&rate=8.505111290524369E-4]:6.2643819837193675)[&rate=0.0013726261889740541]:1.3138002965802027,(6[&rate=8.243951574528154E-4]:6.060522507830158,21[&rate=0.001015397709648436]:6.060522507830158)[&rate=0.0010311171616974536]:1.517659772469412)[&rate=6.893430906367583E-4]:2.5427513510794473,7[&rate=6.15687438731979E-4]:10.120933631379017)[&rate=0.001084645963251746]:0.9685461206672077)[&rate=0.0012352075334774789]:0.2115205557630606,14[&rate=0.0013333199546204815]:11.301000307809286)[&rate=6.893430906367583E-4]:0.31544909084207085,(5[&rate=7.642618215218481E-4]:5.512611803794576,18[&rate=7.642618215218481E-4]:5.512611803794576)[&rate=4.7121254035187375E-4]:6.10383759485678)[&rate=6.480545282078578E-4]:1.3999905302616167,((3[&rate=0.0015249148239679102]:1.4804463802098713,33[&rate=0.0016818128928393213]:1.4804463802098713)[&rate=8.63882323490792E-4]:0.5061238591612232,19[&rate=0.001594637219021524]:1.9865702393710944)[&rate=3.8556021641657565E-4]:11.02986968954188)[&rate=0.001594637219021524]:1.2287485042361244,28[&rate=3.008031563088213E-4]:14.245188433149098)[&rate=0.0016818128928393213]:8.074557449698139,35[&rate=6.772776492015955E-4]:22.319745882847236)[&rate=0.001015397709648436]:4.615799933296131,34[&rate=7.8648555282205E-4]:26.935545816143367)[&rate=1.0]:0.0;
97 | tree STATE_150000 = (((((((((((((((((1[&rate=0.001070147491423981]:3.1228624554997912,(2[&rate=9.082264676471289E-4]:2.666486838536581,26[&rate=8.648504565623374E-4]:2.666486838536581)[&rate=0.001410780660406076]:0.4563756169632103)[&rate=6.265859536552113E-4]:1.5597059102986979,30[&rate=0.001142756875615886]:4.682568365798489)[&rate=7.182558707032477E-4]:1.8996911159070935,13[&rate=0.0012335259494806155]:6.582259481705583)[&rate=7.276200546880373E-4]:1.6681668723973289,12[&rate=7.992239669335931E-4]:8.250426354102911)[&rate=0.0010845111348483502]:0.6111498291881823,25[&rate=6.265859536552113E-4]:8.861576183291094)[&rate=5.995500738233161E-4]:1.1145397222379643,((9[&rate=4.7135230834392165E-4]:2.916843022370291,20[&rate=6.8232615438764E-4]:2.916843022370291)[&rate=9.393989938829415E-4]:6.454254392946854,((15[&rate=6.263789344628486E-4]:4.974406720171231,(17[&rate=6.8232615438764E-4]:1.9066367101071413,24[&rate=7.746828295995891E-4]:1.9066367101071413)[&rate=8.820893078242762E-4]:3.06777001006409)[&rate=8.19047874118271E-4]:1.6474231330058045,(16[&rate=6.263789344628486E-4]:4.651516735488799,31[&rate=6.71156326319343E-4]:4.651516735488799)[&rate=5.457347302290137E-4]:1.970313117688237)[&rate=5.995500738233161E-4]:2.7492675621401093)[&rate=0.0013569194826570455]:0.6050184902119131)[&rate=6.041009134609107E-4]:1.0283806591321962,(27[&rate=6.377483419856614E-4]:9.187852660669348,29[&rate=6.153775006864918E-4]:9.187852660669348)[&rate=7.62692267388784E-4]:1.8166439039919062)[&rate=7.62692267388784E-4]:0.33385774160803194,11[&rate=5.938160958275171E-4]:11.338354306269286)[&rate=8.434524436599081E-4]:0.3964361799829259,32[&rate=6.265859536552113E-4]:11.734790486252212)[&rate=6.153775006864918E-4]:0.02989336337446069,23[&rate=6.263789344628486E-4]:11.764683849626673)[&rate=5.577827557642776E-4]:0.7020977472481054,((((4[&rate=9.393989938829415E-4]:5.331313891688788,(8[&rate=9.728305205952026E-4]:2.608382211103005,22[&rate=0.0010810620676359748]:2.608382211103005)[&rate=0.0016008386669301598]:2.7229316805857833)[&rate=0.0014811520078641131]:0.7802828775394524,10[&rate=9.53941903817563E-4]:6.111596769228241)[&rate=0.001070147491423981]:1.9864516248380273,(6[&rate=8.820893078242762E-4]:6.667962022332132,21[&rate=9.235576741652784E-4]:6.667962022332132)[&rate=7.62692267388784E-4]:1.430086371734136)[&rate=7.992239669335931E-4]:3.352041131384409,7[&rate=4.3207421011611083E-4]:11.450089525450677)[&rate=6.153775006864918E-4]:1.0166920714241012)[&rate=0.0012698902593999846]:0.23691935283616772,14[&rate=0.001142756875615886]:12.703700949710946)[&rate=0.001028393921083231]:0.3639776891374513,(5[&rate=6.600150229307221E-4]:5.92110304670175,18[&rate=4.7135230834392165E-4]:5.92110304670175)[&rate=2.78289166607591E-4]:7.146575592146648)[&rate=0.001410780660406076]:0.7358210697679191,((3[&rate=8.19047874118271E-4]:2.835714253123686,33[&rate=0.0010487201745695534]:2.835714253123686)[&rate=9.728305205952026E-4]:0.47664150499071445,19[&rate=0.0011169564730400103]:3.3123557581144003)[&rate=2.78289166607591E-4]:10.491143950501916)[&rate=9.235576741652784E-4]:1.6102481279814782,28[&rate=2.78289166607591E-4]:15.413747836597794)[&rate=0.0014811520078641131]:9.267777273679252,35[&rate=6.051382526227987E-4]:24.681525110277047)[&rate=3.56702478192928E-4]:0.5314920425690133,34[&rate=0.0011169564730400103]:25.21301715284606)[&rate=1.0]:0.0;
98 | tree STATE_160000 = (((((((((((((((((1[&rate=8.618268538930664E-4]:4.017759180051512,(2[&rate=0.001108516422369063]:2.335067401498908,26[&rate=9.370154669405705E-4]:2.335067401498908)[&rate=6.025343442441733E-4]:1.6826917785526043)[&rate=5.829761107986216E-4]:0.5853929781982785,30[&rate=0.0011386824501373358]:4.603152158249791)[&rate=7.006688711436494E-4]:1.9019005171062977,13[&rate=0.0010811586105426757]:6.505052675356088)[&rate=8.104172960387369E-4]:1.9808751424082462,12[&rate=8.104172960387369E-4]:8.485927817764335)[&rate=6.608671313155968E-4]:0.517720429698123,25[&rate=6.70699569092588E-4]:9.003648247462458)[&rate=4.63390516753509E-4]:1.5280469183501442,((9[&rate=9.370154669405705E-4]:2.304400997165387,20[&rate=8.353647231033315E-4]:2.304400997165387)[&rate=6.413543695584033E-4]:6.941500753666586,((15[&rate=7.530727719158419E-4]:5.421118563317448,(17[&rate=7.108634467924891E-4]:2.9634058044407703,24[&rate=6.608671313155968E-4]:2.9634058044407703)[&rate=0.001011349571748817]:2.4577127588766774)[&rate=9.911454262038848E-4]:0.9493226209559769,(16[&rate=0.0014617703442367082]:2.3944333954847083,31[&rate=0.0014617703442367082]:2.3944333954847083)[&rate=7.006688711436494E-4]:3.976007788788716)[&rate=6.413543695584033E-4]:2.875460566558548)[&rate=4.63390516753509E-4]:1.2857934149806294)[&rate=8.353647231033315E-4]:0.944181501070144,(27[&rate=0.0010560892668116347]:7.234059798445631,29[&rate=7.984277383214427E-4]:7.234059798445631)[&rate=2.799987115218482E-4]:4.241816868437115)[&rate=9.721189998797726E-4]:0.1899820034930091,11[&rate=5.829761107986216E-4]:11.665858670375755)[&rate=3.3078827802434643E-4]:0.14640325984509417,32[&rate=6.608671313155968E-4]:11.81226193022085)[&rate=4.63390516753509E-4]:0.4895166997831275,23[&rate=5.323685455606895E-4]:12.301778630003977)[&rate=8.618268538930664E-4]:0.47021470327033654,((((4[&rate=9.370154669405705E-4]:6.011847201711225,(8[&rate=9.721189998797726E-4]:2.521150341199312,22[&rate=8.757254321314887E-4]:2.521150341199312)[&rate=0.0013738324242727337]:3.490696860511913)[&rate=6.70699569092588E-4]:1.6795329948979596,10[&rate=5.530289284729079E-4]:7.691380196609185)[&rate=0.001011349571748817]:1.4495437255408419,(6[&rate=9.54117627163406E-4]:6.211261704442075,21[&rate=8.104172960387369E-4]:6.211261704442075)[&rate=3.8407497134639E-4]:2.9296622177079517)[&rate=0.001307892148816145]:1.8493738285233086,7[&rate=6.413543695584033E-4]:10.990297750673335)[&rate=6.025343442441733E-4]:1.7816955826009782)[&rate=7.006688711436494E-4]:0.3210722263782788,14[&rate=0.001210615361075735]:13.093065559652592)[&rate=7.530727719158419E-4]:0.11484254807857042,(5[&rate=6.70699569092588E-4]:6.612513472970789,18[&rate=6.70699569092588E-4]:6.612513472970789)[&rate=5.530289284729079E-4]:6.595394634760374)[&rate=0.0015951431294323418]:0.9296596709721605,((3[&rate=7.006688711436494E-4]:4.082951707302803,33[&rate=6.21949874615461E-4]:4.082951707302803)[&rate=4.8804555024765646E-4]:0.1237345651111994,19[&rate=6.122513432991287E-4]:4.206686272414003)[&rate=4.204563332130318E-4]:9.930881506289321)[&rate=7.006688711436494E-4]:2.6351207020397727,28[&rate=3.3078827802434643E-4]:16.772688480743096)[&rate=0.001884489561110423]:8.131190109326884,35[&rate=6.025343442441733E-4]:24.90387859006998)[&rate=5.92781987544968E-4]:5.059385132895603,34[&rate=8.618268538930664E-4]:29.963263722965582)[&rate=1.0]:0.0;
99 | tree STATE_170000 = (((((((((((((((((1[&rate=0.002134300357627006]:2.238001358499494,(2[&rate=0.0023854084385298404]:1.7316482722328272,26[&rate=0.001808946554835757]:1.7316482722328272)[&rate=9.513369453985517E-4]:0.506353086266667)[&rate=0.0014290636308759137]:0.579028401353058,30[&rate=0.0013632004969846001]:2.817029759852552)[&rate=0.0012860719631571818]:1.4996801571315013,13[&rate=0.0016174132091259247]:4.3167099169840535)[&rate=0.0011254448819113846]:0.8279141216271766,12[&rate=0.0013632004969846001]:5.14462403861123)[&rate=9.991101041043383E-4]:0.5321223361609242,25[&rate=0.001020882588922192]:5.676746374772154)[&rate=0.001228911334832918]:0.5214103341308745,((9[&rate=0.0012440169690012724]:1.6106196317042736,20[&rate=0.0010944895811709754]:1.6106196317042736)[&rate=0.0013029244108401833]:3.8234327437064586,((15[&rate=0.0015863646945028548]:3.1221718144856005,(17[&rate=7.561896801071835E-4]:1.4032638180424677,24[&rate=0.001020882588922192]:1.4032638180424677)[&rate=0.0013777656810798177]:1.7189079964431329)[&rate=9.991101041043383E-4]:1.0840019440960553,(16[&rate=0.0013029244108401833]:2.5837822305872757,31[&rate=0.0013029244108401833]:2.5837822305872757)[&rate=9.673387894844859E-4]:1.6223915279943801)[&rate=0.0013777656810798177]:1.2278786168290763)[&rate=0.0011254448819113846]:0.7641043334922966)[&rate=0.0014666500402723704]:0.7207106168762589,(27[&rate=0.0011600315133678911]:5.439864188637902,29[&rate=0.0010944895811709754]:5.439864188637902)[&rate=0.001020882588922192]:1.4790031371413859)[&rate=8.487386652176154E-4]:0.11062377004213886,11[&rate=7.964233085844976E-4]:7.0294910958214265)[&rate=0.0014290636308759137]:0.14906510563572883,32[&rate=9.991101041043383E-4]:7.178556201457155)[&rate=0.0012440169690012724]:0.15124258338315943,23[&rate=0.0012718366610613861]:7.329798784840315)[&rate=0.0010072759350312724]:0.3615233408471257,((((4[&rate=0.0018583236283215307]:3.138751119992512,(8[&rate=0.0014666500402723704]:1.2013619131450053,22[&rate=0.0018581733690744451]:1.2013619131450053)[&rate=0.002134300357627006]:1.9373892068475067)[&rate=0.0018583236283215307]:0.36124086646676234,10[&rate=0.0018583236283215307]:3.4999919864592743)[&rate=0.001529080549954754]:1.601203593148671,(6[&rate=0.0015569889265841508]:4.063806936257384,21[&rate=0.0015569889265841508]:4.063806936257384)[&rate=0.001020882588922192]:1.0373886433505612)[&rate=0.0015863646945028548]:1.9210307334202277,7[&rate=8.487386652176154E-4]:7.022226313028173)[&rate=0.0012718366610613861]:0.6690958126592674)[&rate=0.0012718366610613861]:0.047703904300596456,14[&rate=0.002134300357627006]:7.739026029988037)[&rate=0.0018581733690744451]:0.2063989612076247,(5[&rate=9.793583118024184E-4]:4.735452958469681,18[&rate=8.687523495022319E-4]:4.735452958469681)[&rate=5.398010384306002E-4]:3.2099720327259806)[&rate=0.001650383599766414]:0.7067910317271053,((3[&rate=0.0010149367751915845]:2.1766010595601473,33[&rate=9.513369453985517E-4]:2.1766010595601473)[&rate=0.0014290636308759137]:0.25693054668481397,19[&rate=0.0013224897223583945]:2.4335316062449612)[&rate=5.398010384306002E-4]:6.218684416677806)[&rate=0.0017641207494325647]:0.6418838010780892,28[&rate=4.569194414670261E-4]:9.294099824000856)[&rate=0.001808946554835757]:7.844701186279053,35[&rate=7.964233085844976E-4]:17.13880101027991)[&rate=0.001808946554835757]:1.254953774783253,34[&rate=0.0013777656810798177]:18.393754785063162)[&rate=1.0]:0.0;
100 | tree STATE_180000 = (((((((((((((((((1[&rate=0.002658434714725245]:1.7720522163190071,(2[&rate=0.0020951819244459415]:1.2807817983435552,26[&rate=0.0017796250918943727]:1.2807817983435552)[&rate=0.001730619071681626]:0.4912704179754519)[&rate=0.0010175762474361437]:0.8750990171615172,30[&rate=0.002176492627699872]:2.6471512334805243)[&rate=0.0016080797200246398]:1.0519452077077438,13[&rate=0.0018344080628395472]:3.699096441188268)[&rate=0.0013178859511518936]:0.7630770524808819,12[&rate=0.001738954861672449]:4.46217349366915)[&rate=0.0019726535712705374]:0.4050657008884677,25[&rate=0.0013017117282842618]:4.867239194557618)[&rate=0.001738954861672449]:0.3459427151519652,((9[&rate=0.002500676793104755]:0.8017875337251639,20[&rate=0.00175329678194997]:0.8017875337251639)[&rate=0.0013017117282842618]:3.6997671523394997,((15[&rate=0.0018103671270703835]:2.4088609876144953,(17[&rate=0.00175329678194997]:1.0344800134412735,24[&rate=0.0013017117282842618]:1.0344800134412735)[&rate=0.001674027234653311]:1.3743809741732218)[&rate=0.001323127286382346]:0.9835582539651746,(16[&rate=0.0012017982324936379]:2.383002029626568,31[&rate=0.0016290539409389896]:2.383002029626568)[&rate=0.0019230376254910867]:1.0094172119531017)[&rate=0.0018344080628395472]:1.1091354444849935)[&rate=0.001155900646565511]:0.7116272236449195)[&rate=0.0014512223949885608]:0.4559226796584186,(27[&rate=0.0014273068408857152]:4.977150624284718,29[&rate=0.0013178859511518936]:4.977150624284718)[&rate=0.0016537001461773106]:0.6919539650832833)[&rate=0.002374155883696038]:0.04206879639157979,11[&rate=0.0012801786435498667]:5.711173385759581)[&rate=0.0016537001461773106]:0.04400773234161637,32[&rate=0.0014728138060652407]:5.755181118101198)[&rate=0.001355453655432818]:0.06584259984698626,23[&rate=0.0013178859511518936]:5.821023717948184)[&rate=0.0013737636220598705]:0.17081527877569513,((((4[&rate=0.0025004745948404646]:2.4195863713845234,(8[&rate=0.0020951819244459415]:1.2749731524990306,22[&rate=0.0020576266629690186]:1.2749731524990306)[&rate=0.0032099551624899876]:1.1446132188854927)[&rate=0.0018344080628395472]:0.6195723823518704,10[&rate=0.002220859652623694]:3.0391587537363938)[&rate=0.0013657625622952249]:1.2400849265718694,(6[&rate=0.001514469199671271]:3.664054533620458,21[&rate=0.0014083736051058748]:3.664054533620458)[&rate=0.002176492627699872]:0.615189146687805)[&rate=0.002500676793104755]:0.968003169888199,7[&rate=0.0013737636220598705]:5.247246850196462)[&rate=0.0015386244966530697]:0.7445921465274168)[&rate=0.0014512223949885608]:0.13735692212549022,14[&rate=0.0028720483840878022]:6.129195918849369)[&rate=0.0016537001461773106]:0.056787596300323706,(5[&rate=7.263901234019574E-4]:5.032936166938221,18[&rate=9.53624862849132E-4]:5.032936166938221)[&rate=0.002434231907028142]:1.153047348211472)[&rate=0.001674027234653311]:0.9370193707754462,((3[&rate=0.0015386244966530697]:1.7722815589754284,33[&rate=0.0010175762474361437]:1.7722815589754284)[&rate=0.0018540078878103502]:0.1045325823164438,19[&rate=0.0017114631566131915]:1.8768141412918722)[&rate=8.628246019619883E-4]:5.246188744633267)[&rate=0.0012017982324936379]:1.4876691833364024,28[&rate=6.148594497649483E-4]:8.610672069261541)[&rate=0.001674027234653311]:8.136325931083546,35[&rate=0.0010222846515919167]:16.746998000345087)[&rate=0.003016849055720263]:1.5767896339381586,34[&rate=0.001155900646565511]:18.323787634283246)[&rate=1.0]:0.0;
101 | End;
102 |
--------------------------------------------------------------------------------
/tutorial/readme.md:
--------------------------------------------------------------------------------
1 | # Machuruku: the Tutorial 2.0
2 | This is the updated tutorial coinciding with the release of Machuruku 2.0. I originally developed Machuruku ~2019 with [Jason Brown](https://www.jasonleebrown.org/), my MS advisor (2017-2020). After the release of the original version, we published [a paper](https://academic.oup.com/sysbio/article/70/5/1033/6171196) in Systematic Biology in 2021 describing the method. Machuruku was my first major R project and as such the original version bore some of the hallmarks of a novice R coder, along with some other quirks that continued to bother me as I moved on into a doctoral program. A couple years later in 2023, with much more coding experience under my belt, I decided to revisit Machuruku which quickly ballooned into rewriting the entire thing, both in service to my own projects and the community at large. The scope of the changes merits a nomenclatural leap to Machuruku version 2.0.
3 |
4 | The purpose of Machuruku remains unchanged: the package is for modeling, reconstructing, and visualizing niches in past and present climates, while accounting for evolution. Machuruku reconstructs climatic niches along a time-calibrated phylogeny and can project these niches into paleoclimatic data to visualize the potential geographic origins of lineages. The advances provided by Machuruku 2.0 are mostly practical. For example, many of the for-loops I was previously reliant on have been replaced with apply statements, which offer significant boosts in computation speed. Also boosting speed is Machuruku's new integration with the [Terra](https://github.com/rspatial/terra) R package, a faster upgrade to its predecessor Raster. The workings of the various functions provided in the package have been streamlined to be more user-friendly and flexible. There is also a potentially significant conceptual change to the way Machuruku calculates and visualizes uncertainty in ancestral niche reconstructions, which I will discuss in greater detail later.
5 |
6 | In this new tutorial, I will first provide a simple quick-start guide to using Machuruku 2.0 at its most basic. I then provide a deeper step-by-step dive into the each function and the possibilities they offer for reconstructing and visualizing ancestral niches.
7 | ## Contents
8 | * [Introduction](https://github.com/wxguillo/machuruku/tree/main/tutorial#introduction)
9 | * [Installing Machuruku](https://github.com/wxguillo/machuruku/tree/main/tutorial#installing-machuruku)
10 | * [Downloading and exploring tutorial data](https://github.com/wxguillo/machuruku/tree/main/tutorial#downloading-and-exploring-tutorial-data)
11 | * [Loading tree](https://github.com/wxguillo/machuruku/tree/main/tutorial#loading-tree)
12 | * [Loading occurrence data](https://github.com/wxguillo/machuruku/tree/main/tutorial#loading-occurrence-data)
13 | * [Loading climate data](https://github.com/wxguillo/machuruku/tree/main/tutorial#loading-climate-data)
14 | * [Quick-start Guide](https://github.com/wxguillo/machuruku/tree/main/tutorial#quick-start-guide)
15 | * [Estimating tip response curves](https://github.com/wxguillo/machuruku/tree/main/tutorial#estimating-tip-response-curves)
16 | * [Estimating ancestral niches at a time-slice](https://github.com/wxguillo/machuruku/tree/main/tutorial#estimating-ancestral-niches-at-a-time-slice)
17 | * [Projecting ancestral models into paleoclimatic data](https://github.com/wxguillo/machuruku/tree/main/tutorial#projecting-ancestral-models-into-paleoclimatic-data)
18 | * [Detailed Guide](https://github.com/wxguillo/machuruku/tree/main/tutorial#detailed-guide)
19 | * [1. Estimating tip response curves](https://github.com/wxguillo/machuruku/tree/main/tutorial#1-estimating-tip-response-curves)
20 | * [Accounting for spatial autocorrelation by rarefying occurrence data](https://github.com/wxguillo/machuruku/tree/main/tutorial#accounting-for-spatial-autocorrelation-by-rarefying-occurrence-data)
21 | * [Selecting the most important climate variables](https://github.com/wxguillo/machuruku/tree/main/tutorial#selecting-the-most-important-climate-variables)
22 | * [2. Estimating ancestral niches](https://github.com/wxguillo/machuruku/tree/main/tutorial#2-estimating-ancestral-niches)
23 | * [Visualizing timeslices](https://github.com/wxguillo/machuruku/tree/main/tutorial#visualizing-timeslices)
24 | * [Estimating ancestral niches at a time-slice](https://github.com/wxguillo/machuruku/tree/main/tutorial#estimating-ancestral-niches-at-timeslices)
25 | * [Estimating ancestral niches at each node](https://github.com/wxguillo/machuruku/tree/main/tutorial#estimating-ancestral-niches-at-each-node)
26 | * [Characterizing uncertainty in ancestral niche estimation](https://github.com/wxguillo/machuruku/tree/main/tutorial#characterizing-uncertainty-in-ancestral-niche-estimation)
27 | * [Characterizing uncertainty in divergence times from a single tree](https://github.com/wxguillo/machuruku/tree/main/tutorial#characterizing-uncertainty-in-divergence-times-from-a-single-tree)
28 | * [Characterizing uncertainty in divergence times from a posterior distribution of trees](https://github.com/wxguillo/machuruku/tree/main/tutorial#characterizing-uncertainty-in-divergence-times-from-a-posterior-distribution-of-trees)
29 | * [Saving and loading ace output](https://github.com/wxguillo/machuruku/tree/main/tutorial#saving-and-loading-ace-output)
30 | * [3. Projecting ancestral niche models into paleoclimate](https://github.com/wxguillo/machuruku/tree/main/tutorial#3-projecting-ancestral-niche-models-into-paleoclimate)
31 | * [Projecting multiple timeslices into multiple paleoclimates](https://github.com/wxguillo/machuruku/tree/main/tutorial#projecting-multiple-timeslices-into-multiple-paleoclimates)
32 | * [Projecting into paleoclimate while accounting for uncertainty](https://github.com/wxguillo/machuruku/tree/main/tutorial#projecting-into-paleoclimate-while-accounting-for-uncertainty)
33 | * [Clipping niche models](https://github.com/wxguillo/machuruku/tree/main/tutorial#clipping-niche-models)
34 | * [Making binary niche models](https://github.com/wxguillo/machuruku/tree/main/tutorial#making-binary-niche-models)
35 | * [Projecting a single scenario into multiple paleoclimates](https://github.com/wxguillo/machuruku/tree/main/tutorial#projecting-a-single-scenario-into-multiple-paleoclimates)
36 | * [Projecting multiple scenarios into a single paleoclimate](https://github.com/wxguillo/machuruku/tree/main/tutorial#projecting-multiple-scenarios-into-a-single-paleoclimate)
37 | * [Saving niche models to a folder](https://github.com/wxguillo/machuruku/tree/main/tutorial#saving-niche-models-to-a-folder)
38 | ## Introduction
39 | ### Installing Machuruku
40 | To install Machuruku, simply use the `install_github()` function from `devtools`:
41 | ```
42 | install.packages("devtools")
43 | devtools::install_github("wxguillo/machuruku")
44 | ```
45 | You may encounter an error trying to install the "Treeio" package, which is not on CRAN. Install it with the following and try the above installation again:
46 | ```
47 | if (!require("BiocManager", quietly = TRUE))
48 | install.packages("BiocManager")
49 | BiocManager::install("treeio")
50 | ```
51 | Load up Machuruku by running:
52 | ```
53 | library(machuruku)
54 | ```
55 | You can test if the function worked by typing `machu` into the console (in RStudio) and seeing if all of the functions appear in autofill.
56 | ### Downloading and exploring tutorial data
57 | I opted to provide the raw tutorial data in this repository rather than within the R package itself so that I can demonstrate how to load it. For now you will need 3 of the files:
58 | * `basslerigroup.treefile` - A nexus-formatted treefile containing the three members of the *Ameerega bassleri* group, a small clade of Amazonian dendrobatid poison frogs. This tree was time-calibrated in [BEAST 2](https://www.beast2.org/) and contains 95% HPD intervals for each node height (divergence time). It is a small subset of the UCE phylogeny of *Ameerega* presented in [Guillory et al. 2020](https://www.sciencedirect.com/science/article/pii/S1055790319304609), restricted to the *bassleri* group (*Ameerega bassleri, pepperi,* and *yoshina*) plus *A. silverstonei*, an in-genus outgroup taxon with a similar distribution.
59 | * `basslerigroup.csv` - Occurrence data for each species in our phylogeny, in decimal-degree format. The first column is the species ID (which must match that in the tree), the second is longitude (x), and the third is latitude (y).
60 | * `climate.zip` - A zipped file containing the climate data we will be using. If you unzip the file, you will get a folder called `climate/`, which in turn contains five subfolders: `current/`, `mis19/`, `mpwp/`, and `m2/`. The subfolders correspond to different time periods (present, Marine Isotope Stage 19 (Pleistocene; 0.787 Ma), Mid-Pliocene Warming Period (3.205 Ma), and Marine Isotope Stage M2 (Pliocene; 3.3 Ma). Each contains 14 raster climate layers from [Paleoclim](http://www.paleoclim.org/), which I've cropped to an area surrounding the *bassleri* group's distribution and reduced in resolution to save space.
61 |
62 | Download and place these three files in a folder anywhere on your machine, and unzip `climate.zip`. Load up R and set your working directory to this location with the `setwd()` function.
63 |
64 | #### Loading tree
65 | There are multiple ways to load trees in R, such as `ape::read.tree`, but here let's use `ape::read.nexus` to load in our time-calibrated phylogeny. Install Ape if you haven't already using `install.packages("ape")`, then run:
66 | ```
67 | # load tree
68 | library(ape)
69 | tree <- read.nexus("basslerigroup.treefile")
70 | ```
71 | Note that you shouldn't need to load in the ape package yourself, since it's exported in the namespace of machuruku already.
72 |
73 | Simply use `plot()` to visualize the tree:
74 | ```
75 | plot(tree)
76 | ```
77 | 
78 |
79 | #### Loading occurrence data
80 | Loading occurrence data is simple. Use the `read.csv` or `read.delim` function:
81 | ```
82 | # load occurrence data
83 | occ <- read.csv("basslerigroup.csv")
84 | ```
85 | We can visualize the occurrence data in a minute, after we've loaded the climate data as well.
86 |
87 | #### Loading climate data
88 | In Machuruku 2.0, I have mostly migrated the code to use the Terra function rather than its slower predecessor Raster. Terra is so much faster because, rather than trying to store the contents of a raster, which can get very large, on your machine's RAM, it simply reads them straight from the disk when need be. It also contains some new functions that can handle raster data more elegantly than the old Raster functions could. Here let's use `terra::rast`, the equivalent of the old `raster::raster`, to load our four climate datasets. Again, install Terra if you haven't already, then run:
89 | ```
90 | # load climate data
91 | library(terra)
92 | current <- rast(list.files("climate/current", full.names=T))
93 | mis19 <- rast(list.files("climate/mis19", full.names=T))
94 | mpwp <- rast(list.files("climate/mpwp", full.names=T))
95 | m2 <- rast(list.files("climate/m2", full.names=T))
96 | ```
97 | Let's visualize both the climate and the occurrence data. First plot the current-climate Bio1 raster, then the occurrence data, and finally a legend.
98 | ```
99 | # plot climate
100 | plot(current$bio_1)
101 | # add occurrence data
102 | taxa <- unique(occ$species)
103 | cols <- c("cyan", "yellow", "red", "orange")
104 | for (i in taxa) points(subset(occ, species==i)$long, subset(occ, species==i)$lat,
105 | col = cols[which(taxa==i)],
106 | pch=19, cex=0.75)
107 | legend(-81, -11, legend = taxa, col = cols, pch=19, bty="n")
108 | ```
109 | 
110 |
111 | Now we can see that the species' ranges do not really overlap, but are very close to each other. They evolved in a place with lots of topographic heterogeneity (the foothills of the Andes), which probably promoted their diversification. We might be able to see some niche evolution in this group since they occupy subtly different habitats.
112 | ## Quick-start Guide
113 | Machuruku is composed of three principal steps. In this section I'll demonstrate them without any extraneous bells-and-whistles. Let's set a phylogenetic niche modeling goal for ourselves: To see what the ancestors of the *bassleri* group and *A. silverstonei* were doing in the Late Pliocene, approximately 3.3 million years ago (the putative age of our M2 climate layers). What's important to note here is that it's highly unlikely that any of our nodes will exactly line up with the age of our paleoclimate data, e.g., none of the nodes will be 3.3 million years old. To accommodate this, Machuruku can interpolate ancestral niches along the branches subtending the desired time-slice. This can be kind of tricky to visualize, so Machuruku has a built-in function, `machu.treeplot()`, that can do it for us.
114 | ```
115 | # visualize tree with timeslice at 3.3 Ma
116 | machu.treeplot(tree, timeslice=3.3)
117 | ```
118 | 
119 |
120 | The time-slice at 3.3 Ma recovers *two* taxa, not the four at the tips, so we'll be making two ancestral niche models.
121 | ### Estimating tip response curves
122 | The first step in Machuruku is the `machu.1.tip.resp()` function. This function takes occurrence data and present-day climate data, constructs a Bioclim niche model for each taxon, and then characterizes the response of each taxon to each climate variable as a skew-normal distribution.
123 | ```
124 | # estimate tip response curves
125 | resp <- machu.1.tip.resp(occ, current)
126 | ```
127 | ### Estimating ancestral niches at a time-slice
128 | The second step is using `machu.2.ace()` to estimate ancestral niches at our desired time-slice. This step takes the response table and uses the `ace()` function from [Ape](http://ape-package.ird.fr/) to estimate the niche parameters for whatever taxa exist at our 3.3 Ma timeslice.
129 | ```
130 | # estimate ancestral niches at timeslice
131 | ace <- machu.2.ace(resp, tree, timeslice=3.3, unc=T)
132 | ```
133 | The `unc=T` argument is used to incorporate ancestral character estimation uncertainty into the final models.
134 |
135 | ### Projecting ancestral models into paleoclimatic data
136 | The final major step is to use `machu.3.anc.niche()` to project the ancestral niche models into our 3.3 Ma paleoclimate data. This step loops through each taxon in `ace` and constructs a Bioclim model for it in the provided paleoclimate data.
137 | ```
138 | # project ancestral niches into paleoclimate data
139 | mod <- machu.3.anc.niche(ace, m2)
140 | ```
141 | This produces two ancestral niche models, one for each branch-taxon present at 3.3 Ma, and projected into our 3.3 Ma paleoclimate data. We can visualize the results with a final function, `machu.plotmap()`.
142 | ```
143 | # visualize ancestral niches
144 | machu.plotmap(mod, plot="together", plot.asp=20/9, axes=F, to.scale=T)
145 | ```
146 | 
147 |
148 | We can see that the ancestor of the *bassleri* group may have existed further to the south than the present distribution of the group. On the other hand, the ancestor of *silverstonei* seems constrained to its present-day distribution.
149 | ## Detailed guide
150 | ### 1. Estimating tip response curves
151 | Given the occurrence data and present-day climate rasters, the first major step in Machuruku, `machu.1.tip.resp`, constructs niche models for each present-day taxon in the dataset, then characterizes the response of each taxon to each climate variable as a skew-normal distribution. First, the `dismo::bioclim` function is used to extract the climate values of each variable at each occurrence point for each species. Then, the `sn::selm` function fits a skew-normal distribution to each variable to describe the relationship between occurrence and climate (`fGarch::snormFit` was used before, but I found some issues with it; now the sn package is used throughout Machuruku). The skew-normal distribution is itself characterized by three components: mean, standard deviation, and skew (the upper and lower 95% confidence limits are no longer utilized). This is a modified version of the [Bioclim](https://onlinelibrary.wiley.com/doi/full/10.1111/ddi.12144) niche modeling algorithm (widely regarded as the first such algorithm), which uses uniform distributions for each variable instead of skew-normal. At its most basic, the function looks like this:
152 | ```
153 | ### 1. estimate tip response curves
154 | resp <- machu.1.tip.resp(occ, current, verbose=T)
155 | ```
156 | With the `verbose=T` option turned on, it will print the following output to the screen:
157 | ```
158 | [1] "'clim' is a SpatRaster, attempting to convert to RasterStack for compatibility with dismo::bioclim..."
159 | [1] "Processed taxon bassleri"
160 | [1] "Processed taxon pepperi"
161 | [1] "Processed taxon silverstonei"
162 | [1] "Processed taxon yoshina"
163 | ```
164 | On my machine this process took about 10 seconds to complete, the vast majority of it being the conversion of the SpatRasters to a RasterStack. `machu.1.anc.niche` will accept SpatRaster format, but will automatically convert it to the older RasterStack format for compatibility with `dismo::bioclim`.
165 |
166 | To view the results for the first two climate variables, run `resp[,1:6]`:
167 | ```
168 | bio_1_mean bio_1_stdev bio_1_skew bio_10_mean bio_10_stdev bio_10_skew
169 | bassleri 238.2260 18.64478 -1.987488 243.8598 18.48886 -1.893566
170 | pepperi 253.8157 19.63661 -183.446148 260.4739 20.25066 -183.446148
171 | silverstonei 183.9266 26.75841 183.446148 189.7586 26.46845 183.446148
172 | yoshina 249.0784 14.71177 -3.913331 254.3711 14.71131 -3.594554
173 | ```
174 | This "response table" shows the mean, standard deviation, and skew for each climate variable, for each taxon. We can visualize these distributions using the function `machu.respplot`:
175 | ```
176 | # visualize response curves for two variables
177 | machu.respplot(resp, clim=c("bio_1", "bio_10"), plot="t")
178 | ```
179 | 
180 |
181 | The `machu.respplot` function (response-plot) can plot response curves in various combinations. Here I specify the first two climate variables in `resp` by name, as well as to plot the curves "together" in one window. The curves are nearly identical because the bio1 (mean annual temp) and bio10 (mean temp of warmest quarter) bioclimatic variables are very similar. To view the response curves for *every* climate variable, we can simply omit the `clim` argument:
182 | ```
183 | # visualize response curves for all variables
184 | machu.respplot(resp, plot="t", legend.cex=0.6)
185 | ```
186 | 
187 |
188 | Another feature of `machu.1.anc.niche`, new to Machuruku 2.0, is the visualization of present-day niche models with `dismo::predict`. Activate this feature with the `plot` argument:
189 | ```
190 | # visualize niche models
191 | machu.1.tip.resp(occ, current, plot="t")
192 | ```
193 | 
194 |
195 | This is similar to `machu.respplot` where `plot="t"` (equivalent to `plot="together"`) will show every map in one window. You can also add the occurrence points to confirm that the estimated niche model lines up with the known distribution of the species:
196 | ```
197 | dev.off()
198 | machu.1.tip.resp(occ, current, plot="s", plot.points=T)
199 | ```
200 | 
201 |
202 | Here `dev.off()` is used to reset the plot window. The `plot="s"` (equivalent to `plot="separately"`) option shows every map in its own window; here I'm only showing the first one for *A. bassleri*.
203 |
204 | Finally, the function can also output these niche models instead of the response table with the `output.bioclim` option. This can be useful if you'd like to plot, save, or analyze the present-day niche models for each species on your own.
205 | ```
206 | mod <- machu.1.tip.resp(occ, current, output.bioclim=T)
207 | par(mfrow=c(2,2), mar=c(0,0,2,0))
208 | lapply(1:4, function(x) plot(mod[[x]], axes=F, legend=F, box=F, main=names(mod)[x]))
209 | ```
210 | 
211 |
212 | The output `mod` is a list where each element is a RasterLayer; the `lapply` function loops through each one and plots it after setting up a 2x2 plotting window with `par`.
213 | #### Accounting for spatial autocorrelation by rarefying occurrence data
214 | Occurrence data are often spatially autocorrelated due to systematic biases in the way we collect specimens, i.e. they tend to be clustered in easily accessible locations. Spatial autocorrelation can induce downstream impacts on niche modeling, necessitating the use of algorithms to "rarefy", or thin, occurrence data beforehand. In Machuruku, the function `machu.occ.rarefy` can do this for you.
215 | ```
216 | # rarefy occurrence data
217 | dev.off()
218 | occ.r <- machu.occ.rarefy(occ, rarefy.dist=10, plot=T)
219 | ```
220 | The `rarefy.dist` option specifies the amount of rarefication to perform; in my example, I've set it to 10 km (the default unit; decimal degrees are also available with `rarefy.units="dd"`) such that all points must be at least 10 km from any other point. Adjust this value to fit the spatial scale of your data. Also, the `plot=T` option (new for Machuruku 2.0) visualizes the extent of rarefication performed:
221 | 
222 |
223 | The function will tell you that we have gone from 73 to 33 points after rarefication. However, there is a problem: `occ.r` contains fewer than 10 occurrence data points for all species except *bassleri* now. The `selm` function that `machu.1.tip.resp` uses to fit a skew-normal distribution to the climate responses requires at least 10 points for each taxon. The best solution is simply to find more occurrence data ([GBIF](https://www.gbif.org/) is a great resource), but `machu.1.tip.resp` will automatically generate random occurrence points up to n=10 for each taxon that requires them. The random points are selected from within a minimum convex polygon surrounding the occurrence points for each species. This is a decent solution for species with a single contiguous range; less so for those with strongly disjunct distributions.
224 | If we run `machu.1.tip.resp` again, with `occ.r`, the function will generate random points.
225 | ```
226 | resp <- machu.1.tip.resp(occ.r, current, plot="t", plot.points=T, verbose=T)
227 | ```
228 | It will warn us that it is doing so:
229 | ```
230 | [1] "The following taxa have fewer than 10 occurrence points: pepperi, silverstonei, yoshina"
231 | [1] "Warning: adding random points up to n=10 for each of these species, contained within MCP defined by points."
232 | [1] "'clim' is a SpatRaster, attempting to convert to RasterStack for compatibility with dismo::bioclim..."
233 | [1] "Plotting all plots together. n2mfrow chose 2 rows and 2 columns based on an aspect ratio of 16/9"
234 | [1] "Processed taxon bassleri"
235 | [1] "Processed taxon pepperi"
236 | [1] "Processed taxon silverstonei"
237 | [1] "Processed taxon yoshina"
238 | ```
239 | When the function plots the niche models and occurrence points, the randomly generated points are highlighted in red:
240 | 
241 |
242 | Additionally, the saved output `resp` is a list containing both the normal output (in this case, a response table) as well as the modified occurrence data table with a new column `"rand"` specifying which points were randomly generated.
243 | #### Selecting the most important climate variables
244 | Another important task to do prior to creating the present-day niche models with `machu.1.top.env` is to reduce the climate dataset. Multiple correlated climate rasters being provided to the niche modeling algorithm can induce downstream biases just as spatial autocorrelation in the occurrence data can. Machuruku contains the function `machu.top.env` for identifying the most important climate variables for each taxon by constructing generalized boosted regression niche models. There are three algorithms for selecting the best variables: "contribution", "nvars", and "estimate".
245 | The "contribution" method only retains those variables that contribute more than x% of relative importance to each species. This is the default algorithm. The default minimum relative importance, specified by `contrib.greater`, is 5%.
246 | ```
247 | # select most important climate variables
248 | # contribution method
249 | micv.contrib <- machu.top.env(occ.r, current, method="contrib", contrib.greater=5, verbose=T)
250 | ```
251 | This prints progress to the screen; the function takes a bit of time to run. It requires occurrence data and present-day climate data to construct the niche models with. For occurrence data, I've provided the spatially rarefied output from before, so as not to introduce bias into the niche models the function constructs. For climate data, I've provided the same SpatRaster `current`, which the function has to convert to a RasterStack for compatibility. Once the function is finished, running `micv.contrib' displays which variables were retained:
252 | ```
253 | [1] "bio_1" "bio_11" "bio_12" "bio_13" "bio_14" "bio_15" "bio_16" "bio_18" "bio_19" "bio_4" "bio_8" "bio_9"
254 | ```
255 | This is 12 of the 14 starting variables, which is probably too many. If we want a specific number of the "best" variables, we can use the "nvars" algorithm.
256 | ```
257 | # nvars method
258 | micv.nvars <- machu.top.env(occ.r, current, method="nvars", nvars.save=7, verbose=T)
259 | ```
260 | The default value of `nvars.save`, which specifies the number of best variables to retain, is 5; here I've set it to 7. Running `micv.nvars` displays the seven variables retained:
261 | ```
262 | [1] "bio_4" "bio_15" "bio_18" "bio_14" "bio_16" "bio_13" "bio_12"
263 | ```
264 | The final algorithm is "estimate", which chooses the number of best variables by systematically removing variables until average change in the model exceeds the original standard error of deviance explained. This algorithm is more computationally intensive than the others and takes longer to finish.
265 | ```
266 | micv.est <- machu.top.env(occ.r, current, method="estimate", verbose=T)
267 | ```
268 | On my machine, it took a minute or two to finish. Running `micv.est` displays the variables retained:
269 | ```
270 | [1] "bio_1" "bio_11" "bio_12" "bio_13" "bio_14" "bio_15" "bio_16" "bio_17" "bio_18" "bio_19" "bio_4" "bio_8" "bio_9"
271 | ```
272 | In this case it retained 13 of the 14 original variables, which also isn't very helpful. Here I personally found the "nvars" method most useful, so I'm going to reduce the climate variable set to just those, and use this reduced set for the rest of the tutorial.
273 | ```
274 | # reduce climate datasets to only most important variables
275 | current.reduced <- current[[micv.nvars]]
276 | mis19.reduced <- mis19[[micv.nvars]]
277 | mpwp.reduced <- mpwp[[micv.nvars]]
278 | m2.reduced <- m2[[micv.nvars]]
279 | ```
280 | It's important to make sure that all time periods have the same set of climate variables. Next I'll re-run `machu.1.tip.resp` using the newly reduced climate dataset, as well as the spatially rarefied occurrence data from before.
281 | ```
282 | # re-run tip response table with reduced climate dataset and rarefied occurrence data
283 | resp <- machu.1.tip.resp(occ.r, current.reduced, plot="t", plot.points=T)
284 | ```
285 | 
286 |
287 | These new models are actually somewhat broader than the previous ones (this is especially visible with *yoshina*), as we've removed some of the noise from the climate dataset. The models will be slightly different anyway since we re-sampled new random occurrence points to get to 10 for each species. Now we're ready to move to the ancestral character estimation step.
288 | ### 2. Estimating ancestral niches
289 | #### Visualizing timeslices
290 | The second major step in Machuruku is using `machu.2.ace` to estimate ancestral niches for a set of taxa along the phylogenetic tree. The primary inputs are the tree and the response table from `machu.1.tip.resp`. The function uses the `ape::ace` to estimate the climate response parameters (mean, stdev, skew) for each climate variable at each node with Brownian motion. There are two possible outputs: the reconstructed values for every node in the tree (along with the tips, which remain unchanged from the `resp` input), or reconstructed values at one or more timeslices. If a timeslice is specified, `machu.2.ace` will identify whatever branches existed at that point in time, and interpolate the climate response values from the nodes or tips at either end of the branch to that point. To visualize this, use the function `machu.treeplot` and specify the dates of our three paleoclimate datasets for the `timeslice` parameter.
291 | ```
292 | # visualize time-slices
293 | dev.off()
294 | options(warn=-1)
295 | machu.treeplot(tree, timeslice = c(0.787,3.205,3.3))
296 | ```
297 | Use `dev.off()` to clear the plot window and `par` parameters, then use `options(warn=-1)` to turn off warnings since this function tends to generate ones that don't really matter. For the `timeslice` option, I've specified a `c` vector with the putative ages (in Ma) of each of our paleoclimate datasets. Here is the result:
298 |
299 | 
300 |
301 | This looks pretty good, but there are a lot of graphical options in `machu.treeplot` that can be tweaked to make the figure look better.
302 | ```
303 | machu.treeplot(tree, timeslice = c(0.787,3.205,3.3), x.l.lim = 13, x.u.lim=-3, nodelabsize = 0.35, col = "skyblue", timelaboffset = -0.2)
304 | ```
305 | Here I manually changed the vertical size of the window to make the tree more compact, and adjusted the horizontal scaling with the `x.l.lim` and `x.u.lim` parameters to better fill the space. This necessitated adjusting the size of the circles at each node with `nodelabsize`, and adjusting the position of the time labels with `timelaboffset`. Finally, I changed the color of the timeslice lines to "skyblue" with `col`, just for fun.
306 |
307 | 
308 |
309 | The `machu.treeplot` function was previously based in the ggtree R package, but this caused some issues with the code and often required a separate installation, so for Machuruku 2.0 the function is now based mostly in the [phytools](http://blog.phytools.org/) package. The function will automatically select a scale and tick mark scheme based on the order of magnitude of the age of the tree, and in general produces cleaner results.
310 |
311 | There are three timeslices visible: two near 3 Ma, which are the m2 and mpwp paleoclimate datasets, and one near 0.7 Ma, which is the mis19 dataset. The two older timeslices "slice through" two branches: the one from node 1 to *silverstonei*, and the one from node 1 to node 2. The more recent mis19 timeslice "slices through" four branches: node1-*silverstonei*, node2-*pepperi*, node3-*yoshina*, and node3-*bassleri*. As such, when projecting ancestral niche models into the m2 or mpwp dataset, there should only be two ancestral niche models, one for each of these ancestral "branch-taxa", and when projecting into the mis19 dataset, there should be four. The `machu.2.ace` function takes care of this.
312 | #### Estimating ancestral niches at timeslices
313 | To run `machu.2.ace` with one or more timeslices, specify the `timeslice` argument:
314 | ```
315 | # estimate ancestral niches at timeslices
316 | resp <- resp[[2]]
317 | ace.ts <- machu.2.ace(resp, tree, timeslice=c(0.787,3.205,3.3))
318 | ```
319 | The first line of code is simply reassigning `resp` to solely the response table, to minimize confusion. The `machu.2.ace` function takes two primary inputs: the response table (`resp`) and a time-calibrated phylogeny (`tree`). The tree must be ultrametric (i.e., all tips at the same height), and the names at each tip must match the taxa in the response table exactly (the function will make these checks for you). The `timeslice` argument is identical to that from `machu.treeplot`.
320 |
321 | The ability to specify multiple timeslices is a significant improvement for Machuruku 2.0. In the previous version only one time-slice at a time was possible, necessitating calling the function in a for loop or other repeating construct if one wanted to use multiple timeslices. This was enabled by re-coding the function as a series of nested `lapply` statements; as such the output of `machu.2.ace` is now formatted as a list, where each element corresponds to one timeslice. Running `ace.ts` shows this; each element is named after a timeslice. Running `names(ace.ts)` shows:
322 | ```
323 | [1] "timeslice_0.787" "timeslice_3.205" "timeslice_3.3"
324 | ```
325 | Let's examine this output more closely. Running `ace.ts[[1]][,1:8]` shows the first eight columns of the first element, "`timeslice_0.787`" (mis19):
326 | ```
327 | branch_start branch_end bio_4_mean bio_4_stdev bio_4_skew bio_15_mean bio_15_stdev bio_15_skew
328 | Node3-bassleri 7 1 488.8174 61.24433 45.76368 24.84982 3.640581 24.50394
329 | Node3-yoshina 7 4 464.7665 45.17915 159.7225 23.44164 7.757321 141.1891
330 | Node2-pepperi 6 2 561.1887 17.35599 165.7438 29.50367 2.949623 15.94719
331 | Node1-silverstonei 5 3 602.4069 53.03126 8.241115 40.01165 5.556379 -174.4965
332 | ```
333 | Each row in this table corresponds to a "branch-taxon" (the same ones visualized by the third (rightmost) line in the `machu.treeplot` images above). The first two columns give the indices of the nodes or tips at either end of the branch-taxon's branch, and subsequent columns represent climate response parameters for two climate variables, Bio4 (temperature seasonality) and Bio15 (precipitation seasonality). These values were linearly interpolated from the values at the nodes or tips at either end of the branch; for a timeslice exactly halfway between two nodes, the interpolated parameter value would be halfway between the nodes' values.
334 |
335 | Moving on to the second timeslice, "`timeslice_3.205`" (mpwp), running `ace.ts[[2]][,1:8]` shows that there are only two branch-taxa in this timeslice. We already knew this from visualizing the tree and timeslices with `machu.treeplot` before.
336 | ```
337 | branch_start branch_end bio_4_mean bio_4_stdev bio_4_skew bio_15_mean bio_15_stdev bio_15_skew
338 | Node1-Node2 5 6 514.5594 40.36691 119.6053 27.01833 4.706292 43.41313
339 | Node1-silverstonei 5 3 591.3218 51.4332 22.29359 38.37208 5.44911 -146.9995
340 | ```
341 | #### Estimating ancestral niches at each node
342 | The alternative mode of `machu.2.ace` is returning ancestral niche parameters for each node, instead of those branch-taxa at one or more timeslices. This is simply accomplished by omitting the `timeslice` argument:
343 | ```
344 | # estimate ancestral niches at each node
345 | ace.n <- machu.2.ace(resp, tree)
346 | ```
347 | The output of this function is a list with a single element called `"tips_and_nodes"`. This name is important in triggering downstream effects in the `machu.3.anc.niche` function. Running `ace.n[[1]][,1:7]` allows us to examine the output as before:
348 | ```
349 | times bio_4_mean bio_4_stdev bio_4_skew bio_15_mean bio_15_stdev bio_15_skew
350 | bassleri 0.000000 483.4028 69.894895 8.911683 24.38023 2.883884 4.735996
351 | pepperi 0.000000 581.1957 8.074401 183.446148 30.65780 2.239828 2.407736
352 | silverstonei 0.000000 606.0149 53.551384 3.667379 40.54528 5.591293 -183.446148
353 | yoshina 0.000000 446.5674 45.290139 183.446148 22.22352 9.188911 183.446148
354 | Node1 11.577178 552.9404 45.900022 70.949409 32.69519 5.077696 -51.792643
355 | Node2 2.710415 512.2920 40.040041 122.479628 26.68297 4.684351 49.037393
356 | Node3 2.267554 499.0037 44.970337 115.091966 25.73324 5.064125 61.692618
357 | ```
358 | The `"tips_and_nodes"` table contains 7 rows: 4 for the tips and 3 for the nodes. The climate response values for the tips are identical to those from the response table; they are included in the `machu.2.ace` output for the sake of comparison with the nodes. The first column `times` shows the divergence time for each node; this can be useful when deciding which paleoclimate dataset to project a certain node's ancestral niche model into.
359 |
360 | We can visualize the evolution of climatic responses along the tree with the `machu.respplot` function, which works with the output of `machu.2.ace` as well as `machu.1.tip.resp`.
361 | ```
362 | # visualize niche evolution
363 | machu.respplot(ace.n[[1]], clim="bio_12", fill=T)
364 | ```
365 | 
366 |
367 | Here I've just visualized the Bio12 variable, annual precipitation, which is most intuitive to look at. I've also specified `fill=T` (a new option for Machuruku 2.0) to fill in the space beneath each response curve and make them easier to see. In this case we can see that *silverstonei* prefers climates with higher precipitation, while the actual members of the *bassleri* group are clustered at the lower end of the spectrum. The interesting part is how the nodal taxa's climate responses are intermediate between these two extremes.
368 | #### Characterizing uncertainty in ancestral niche estimation
369 | The values offered by ancestral character estimation algorithms like `ace` are subject to considerable uncertainty, which increases further back in time. Relying on a single point estimate of a given value may be too precise for some to stomach, especially for something as nebulous as the standard deviation of a species' response to precipitation. To that end, Machuruku 2.0 includes a new method of characterizing this uncertainty to produce more conservative estimates of the ancestral niche. If the user specifies `unc=T`, `machu.2.ace` retains the upper and lower 95% confidence intervals for each parameter, provided by `ace`. When passed to `machu.3.anc.niche` later on, these "uncertainty values" produce broader, less specific ancestral niche models.
370 | ```
371 | # include uncertainty
372 | ace.ts.u <- machu.2.ace(resp, tree, timeslice=c(0.787,3.205,3.3), unc=T)
373 | ```
374 | Other than including `unc=T`, this command is the same as two sections ago where we took 3 timeslices of the tree. Running `ace.ts.u[[1]][,1:8]` shows how `unc=T` changes the `machu.2.ace` output:
375 | ```
376 | branch_start branch_end bio_4_mean bio_4_mean_lCI bio_4_mean_uCI bio_4_stdev bio_4_stdev_lCI bio_4_stdev_uCI bio_4_skew bio_4_skew_lCI bio_4_skew_uCI
377 | Node3-bassleri 7 1 488.8174 457.3668 520.268 61.24433 47.95568 74.53297 45.76368 14.31306 77.21431
378 | Node3-yoshina 7 4 464.7665 433.3159 496.2171 45.17915 31.8905 58.46779 159.7225 128.2718 191.1731
379 | Node2-pepperi 6 2 561.1887 532.6862 589.6913 17.35599 6.146849 29.39901 165.7438 137.2413 194.2464
380 | Node1-silverstonei 5 3 602.4069 586.6109 618.203 53.03126 53.46503 59.70547 8.241115 -7.554937 24.03717
381 | ```
382 | Columns 3 through 8 are the climate response values for a single climate variable, Bio4. Each original parameter (mean, stdev, skew) now has an additional two columns directly following it, "`lCI`" (lower confidence interval) and "`uCI`" (upper confidence interval). The original parameter values represent the medians. When this output is passed to `machu.3.anc.niche` later on, the function detects the presence of these uncertainty values and automatically incorporates them into the analysis. Rather than use a single skew-normal distribution for a given climate variable, the function takes *every combination* of median, lCI, and uCI values for each parameter, constructs a skew-normal distribution describing the relationship of suitability and climate for each combination, converts these to direct estimates of suitability for each pixel in the niche model, then sums and rescales all niche models to produce the result. There are 33=27 combinations for each climate variable. We can visualize these with `machu.respplot`:
383 | ```
384 | # visualize uncertainty
385 | machu.respplot(ace.ts.u[[1]], clim="bio_12")
386 | ```
387 | 
388 |
389 | When uncertainty values are passed to this function, it automatically plots the 27 skew-normal distributions formed by the different parameter combinations. There isn't a ton of variability in this case, so the default `fill=F` actually makes it easier to see. Node1-*silverstonei* is very constrained, while Node3-*bassleri* and Node3-*yoshina* have more variation. Thick dotted lines are drawn to show the median distribution for each taxon that would be used were `unc=F`.
390 | #### Characterizing uncertainty in divergence times from a single tree
391 | Another source of uncertainty in the Machuruku pipeline comes from the time-calibrated phylogeny itself. Just like estimates of a character value at each node, the timing of the node itself is uncertain, more so for older nodes. Dealing with this in Machuruku is, perhaps, "not my job", but I wrote a function to do it anyway. `machu.tree.unc` takes a time-calibrated phylogeny, or a Bayesian posterior distribution of phylogenies, and produces two additional phylogenies, one in general older than the input, one in general younger, that characterize the uncertainty in divergence times and can be used as separate inputs for `machu.2.ace`.
392 |
393 | The `machu.tree.unc` function has two modes depending on the input. If the input is a single tree, it produces the two additional trees from the divergence time uncertainty contained in the tree file (i.e., the error bars). If the input is a posterior distribution of trees, it produces the two additional trees from the corresponding distribution of tree-heights; more detail on this mode later. For the former, single-tree mode, a different type of input is necessary than what we've been using, which is the "phylo" format from Ape. Phylo format does not record divergence time uncertainty data, even if the read-in input file contains it. Instead, we have to use the "treedata" format from the package [Treeio](https://bioconductor.org/packages/release/bioc/html/treeio.html), which does record this information in "tibble" format (part of the Tidyverse world).
394 | ```
395 | # characterize divergence time uncertainty
396 | # reload tree as 'treedata' object
397 | library(treeio)
398 | beast <- read.beast("basslerigroup.treefile")
399 | ```
400 | The `treeio::read.beast` function creates a treedata object. Running `beast` will display the tibble containing the divergence time uncertainty data; they are stored in the "`height_0.95_HPD`" column, which we can view in compact form by running `do.call(rbind, as_tibble(beast)$height_0.95_HPD)`:
401 | ```
402 | [,1] [,2]
403 | [1,] 0.000000 7.105427e-15
404 | [2,] 0.000000 7.105427e-15
405 | [3,] 0.000000 7.105427e-15
406 | [4,] 0.000000 7.105427e-15
407 | [5,] 7.112935 1.620734e+01
408 | [6,] 1.312191 4.255582e+00
409 | [7,] 1.030775 3.665719e+00
410 | ```
411 | Each row in this makeshift table represents the upper and lower 95% HPD (highest posterior density; analogous to a confidence interval) limits for each tip and node in the tree. The first four rows represent the tips; they are essentially zero since it doesn't make sense for present-day taxa to have any divergence time uncertainty. The last three rows represent the nodes; the left column is the lower 95% HPD limit, and the right column is the upper 95% HPD limit. `machu.tree.unc` uses these values to construct the additional trees, essentially setting the node heights of the trees equal to these 95% HPD limits.
412 |
413 | Note that this function is only tested and designed for outputs from a few programs: [BEAST](https://www.beast2.org/) and BEAST-adjacent software such as [SNAPP](https://www.beast2.org/snapp/) (specifically the consensus output produced by TreeAnnotator), and the RelTime method implemented in [MEGA](https://www.megasoftware.net/). Other programs may produce incompatible outputs; let me know and I can try to include them.
414 | ```
415 | # run tree-uncertainty utility from a single input tree
416 | beast.trees <- machu.tree.unc(beast)
417 | ```
418 | Running `names(beast.trees)` shows the names of the three trees output by `machu.tree.unc`:
419 | ```
420 | [1] "lCItree" "inputtree" "uCItree"
421 | ```
422 | The first tree, `"lCItree"` (lower confidence interval tree) has node heights based on the first column of the above table; the second tree, `"inputtree"` is the same as the input tree `beast` and represents the median node heights; the third tree `"uCItree"` (upper confidence interval tree) has node heights based on the second column of the above table. Running `beast.trees` itself will show the structure of the output:
423 | ```
424 | $lCItree
425 |
426 | Phylogenetic tree with 4 tips and 3 internal nodes.
427 |
428 | Tip labels:
429 | bassleri, pepperi, silverstonei, yoshina
430 |
431 | Rooted; includes branch lengths.
432 |
433 | $inputtree
434 |
435 | Phylogenetic tree with 4 tips and 3 internal nodes.
436 |
437 | Tip labels:
438 | bassleri, pepperi, silverstonei, yoshina
439 |
440 | Rooted; includes branch lengths.
441 |
442 | $uCItree
443 |
444 | Phylogenetic tree with 4 tips and 3 internal nodes.
445 |
446 | Tip labels:
447 | bassleri, pepperi, silverstonei, yoshina
448 |
449 | Rooted; includes branch lengths.
450 | ```
451 | The output is a list where each element is one of the three trees discussed above. We can visualize these trees all at once using `machu.treeplot`:
452 | ```
453 | # visualize trees
454 | machu.treeplot(beast.trees, timeslice=c(0.787,3.205,3.3), nodelabsize=0.5, timelaboffset=-0.15, col="skyblue")
455 | ```
456 | 
457 |
458 | This figure illustrates why one may want to use the different trees output from `machu.tree.unc` as input to `machu.2.ace`. When the trees have different node heights, the same timeslice can cut through different branches. In this figure, the two older timeslices (corresponding to the m2 and mpwp paleoclimate datasets) slice through two branch-taxa (Node1-Node2 and Node1-*silverstonei*) in the first two trees (the lCI and input trees). However, in the third tree (the uCI tree), they slice through four branch-taxa. If we re-run `machu.2.ace` with these new trees and take a single timeslice at 3.3 Ma, we see that the output `ace.uCItree` contains data for two branch-taxa, and the others contain data for four.
459 | ```
460 | # re-run machu.2.ace with the new trees for comparison
461 | ace.lCItree <- machu.2.ace(resp, beast.trees$lCItree, timeslice=3.3)
462 | ace.inputtree <- machu.2.ace(resp, beast.trees$inputtree, timeslice=3.3)
463 | ace.uCItree <- machu.2.ace(resp, beast.trees$uCItree, timeslice=3.3)
464 | # count number of taxa in each of the new outputs
465 | c(nrow(ace.lCItree[[1]]), nrow(ace.inputtree[[1]]), nrow(ace.uCItree[[1]]))
466 | ```
467 | The output of the last line is `2 2 4`, which is what we expect.
468 | #### Characterizing uncertainty in divergence times from a posterior distribution of trees
469 | The other mode of `machu.tree.unc` is activated when the input is a posterior distribution of trees, i.e. the raw output of a Bayesian phylogenetics program like [BEAST](beast2.org), rather than a single consensus tree from TreeAnnotator as used previously. In the previous version of Machuruku, this mode was contained in the separate function `machu.trees.unc`; for Machuruku 2.0 I've combined them into a single function. Some users may want to use this mode instead of the previous one because it has greater flexibility and may characterize the divergence time uncertainty more accurately. Unlikely the previous mode, this mode actually returns trees that were directly computed by the original Bayesian software.
470 |
471 | Because a posterior can contain thousands or even millions of trees, loading it all into R's memory would be a bad idea. Instead, simply specify by name a NEXUS file that contains the posterior distribution. You can download the file "posterior.trees" from the tutorial repository and examine the format to make sure the function will work with your data (the function is untested with other formats and almost certainly won't work). Essentially, each separate tree in the distribution is written on a separate line near the end of the file; the top of the file contains the list of taxa and a translation table giving each taxon name a numeric ID that appears in the trees to save space. The example file "posterior.trees" is a heavily truncated version of the output from our [2020 paper](https://www.sciencedirect.com/science/article/pii/S1055790319304609) on *Ameerega* phylogenetics, containing all of the taxa in the study but just 19 trees for the sake of computational speed. Place it in your tutorial folder and run the following:
472 | ```
473 | # run tree-uncertainty utility from a posterior
474 | post.trees <- machu.tree.unc("posterior.trees")
475 | ```
476 | As `verbose=T` by default, the function will provide some progress updates as it works:
477 | ```
478 | [1] "Multiple trees in file 'posterior.trees' detected. Burnin: 0.1; Confidence level: 0.95"
479 | [1] "FIRST PASS: Calculating trees to remove at 10% burnin."
480 | [1] "Found 19 trees, skipping the first 2 under 10% burnin."
481 | [1] "SECOND PASS: Calculating 95% HPD of tree heights at 10% burnin."
482 | [1] "95% HPD min: 182.44; Median: 282.65; 95% HPD max: 348.88; from 17 trees under 10% burnin."
483 | [1] "THIRD PASS: Finding trees with closest heights to 95% HPD limits and median at 10% burnin."
484 | ```
485 | This also describes how the algorithm actually works. The function conducts three passes through the dataset, loading each tree directly from the file one at a time to save memory. The first pass simply counts the number of trees in the dataset and calculates how many to remove based on the `burnin` parameter. Removing some trees from the beginning of the posterior is a common practice because the MCMC algorithms that Bayesian phylogenetics software use take a while to converge (i.e. "burn in") so the first x% of the distribution may be inconsistent with the rest; by default the `burnin` parameter is set to 0.1 (i.e., discarding the first 10% of the posterior).
486 |
487 | The function's second pass skips the first 10% of trees (when `burnin=0.1`) and calculates the tree height for each one (i.e., the distance from the root to the tip) to produce a distribution of tree heights. It then calculates the 95% HPD limits of this distribution; in our example, the lower 95% HPD limit was 182.44 and the upper one was 348.88. The confidence level can be set with the `conf` parameter, which by default is 0.95. Setting it lower will return trees closer to the median tree; on the other hand setting `conf=1` will identify the most extreme trees.
488 |
489 | In the third pass, the function then identifies which trees have heights closest to the HPD limits and median, and returns these in a list similar to the other mode of `machu.tree.unc`. We can visualize these trees again with `machu.treeplot`:
490 | ```
491 | # visualize trees
492 | machu.treeplot(post.trees, timelabs=F, nodelabs=F)
493 | ```
494 | 
495 |
496 | These trees are much larger than the ones we've been using (they contain all *Ameerega* species, not just the *bassleri* group), so I've set `timelabs=F` and `nodelabs=F` to reduce clutter. Similarly to before, the top tree is the lCI tree, the middle one is the median tree, and the bottom tree is the uCI tree.
497 | #### Saving and loading ace output
498 | Because the output of `machu.2.ace` in Machuruku 2.0 is now formatted differently, as a list, the output when saved to a CSV file is also different. You can save output from `machu.2.ace` simply by specifying a filename with the `csv.name` parameter (this was called `savename` before Machuruku 2.0):
499 | ```
500 | # save ace output
501 | ace.ts <- machu.2.ace(resp, tree, timeslice=c(0.787,3.205,3.3), csv.name="ace_ts.csv")
502 | ```
503 | A CSV file called "ace_ts.csv" has been saved to your working directory (`getwd()`). We can examine its structure by viewing the first 7 columns with `read.csv("ace_ts.csv")[,1:7]`:
504 | ```
505 | scenario taxon branch_start branch_end bio_4_mean bio_4_stdev bio_4_skew
506 | 1 timeslice_0.787 Node3-bassleri 7 1 488.8174 61.24433 45.763683
507 | 2 timeslice_0.787 Node3-yoshina 7 4 464.7665 45.17915 159.722456
508 | 3 timeslice_0.787 Node2-pepperi 6 2 561.1887 17.35599 165.743824
509 | 4 timeslice_0.787 Node1-silverstonei 5 3 602.4069 53.03126 8.241115
510 | 5 timeslice_3.205 Node1-Node2 5 6 514.5594 40.36691 119.605293
511 | 6 timeslice_3.205 Node1-silverstonei 5 3 591.3218 51.43320 22.293585
512 | 7 timeslice_3.3 Node1-Node2 5 6 514.9949 40.42969 119.053189
513 | 8 timeslice_3.3 Node1-silverstonei 5 3 590.8863 51.37041 22.845688
514 | ```
515 | Each row in this table represents a single taxon. The first column lists the timeslice of each taxon (called a "scenario" for generality), and the second column lists the taxon name. The remaining columns contain the same data we saw before with the `machu.2.ace` output. Saving these files may be important for reproducibility and other custom analyses.
516 |
517 | Loading the CSV file into R and trying to put it into the `machu.3.anc.niche` for downstream analysis will not work because it's formatted differently than the `machu.2.ace` output. To load a saved `machu.2.ace` output, use the function `machu.ace.load`:
518 | ```
519 | # load ace output
520 | ace.ts <- machu.ace.load("ace_ts.csv")
521 | ```
522 | Examining `ace.ts` will show that the loaded file is now in its proper format and ready for downstream analysis.
523 | ### 3. Projecting ancestral niche models into paleoclimate
524 | The final major step in Machuruku is to use `machu.3.anc.niche` to project the ancestral niche models estimated by `machu.2.ace` into paleoclimate data. For each taxon in each timeslice, the function calculates suitability in the timeslice's associated paleoclimate data by reconstructing a skew-normal distribution for each paleoclimate variable with the `sn::dsn` function. Various parameters and input schemes modify this basic blueprint in various ways. The major advance for Machuruku 2.0 is in allowing the input of multiple timeslices and paleoclimate layers at once, and in the new method of characterizing uncertainty in the ancestral niche.
525 | #### Projecting multiple timeslices into multiple paleoclimates
526 | Because it has been rewritten as a series of nested `lapply` statements, `machu.3.anc.niche` can now handle multiple timeslices and multiple paleoclimates as input. The main inputs are the output of `machu.2.ace` (ancestral climate response values) and paleoclimate raster layers. The paleoclimate layers can be provided in various formats, including both SpatRaster and RasterStack. When using paleoclimate from multiple time periods as input, it is best to combine them into a list with the `list` function. Ensure the datasets are listed in the same order as their corresponding timeslices in the `machu.2.ace` output, and then provide it as input to `machu.3.anc.niche`:
527 | ```
528 | ### 3. project ancestral niche models into paleoclimate
529 | # multiple timeslices into multiple paleoclimates
530 | clim <- list(mis19.reduced, mpwp.reduced, m2.reduced)
531 | mod.ts <- machu.3.anc.niche(ace.ts, clim, verbose=T)
532 | ```
533 | I've made sure to provide the reduced climate datasets, because they contain the same climate variables that were used in creating `ace.ts`. On my machine, the function takes only about a second to finish. Because `verbose=T`, it prints the following output:
534 | ```
535 | [1] "Did not detect uncertainty samples in 'ace' ('unc' in machu.2.ace())."
536 | [1] "Associating scenarios ('ace') with rastersets ('clim') (numbers are indices, rows are associations):"
537 | clim ace
538 | [1,] 1 1
539 | [2,] 2 2
540 | [3,] 3 3
541 | [1] "Processed scenario 1"
542 | [1] "Processed scenario 2"
543 | [1] "Processed scenario 3"
544 | ```
545 | The table in the center of this output is the most important part: it is a sanity check describing the association of each paleoclimate dataset ("`clim`") with each timeslice ("`ace`"). Each row represents one such association, with each number being an index of the corresponding input (i.e., "`1`" in the "`ace`" column is the first element of `ace.ts`). With this table, we know that the first timeslice (`ace.ts[[1]]`) is being projected into the first paleoclimate dataset (`clim[[1]]`), and so on.
546 |
547 | Running `mod.ts` shows the structure of the `machu.3.anc.niche` output. It is a list of lists, where each element corresponds to one timeslice, itself a list of ancestral niche models, one per taxon. Running `names(mod.ts)` shows `[1] "timeslice_0.787" "timeslice_3.205" "timeslice_3.3"`, while examining the names of the first element of `mod.ts` with `names(mod.ts[[1]])` yields `[1] "Node3-bassleri" "Node3-yoshina" "Node2-pepperi" "Node1-silverstonei"`. From our knowledge of `ace.ts`, we'd expect `mod.ts` to have four niche models for the first timeslice (mis19), and two for the others (mpwp and m2). Running `sapply(mod.ts, length)` yields what we expect:
548 | ```
549 | timeslice_0.787 timeslice_3.205 timeslice_3.3
550 | 4 2 2
551 | ```
552 | We can visualize these niche models using the `machu.plotmap` function.
553 | ```
554 | machu.plotmap(mod.ts, plot="t", axes=F, title.cex=0.85, to.scale=T, plot.asp=20/9)
555 | ```
556 | This works similarly to the other plotting functions in Machuruku 2.0 where the plots can be shown `"together"` or `"separately"`. I've set `axes=F` to reduce visual clutter, `title.cex=0.85` so that the titles fit in the window, and `plot.asp=20/9` to plot the maps in a compact horizontally-oriented format. The `to.scale` parameter identifies the maximum suitability value across all niche models and plots all of them on the same scale so that they can be directly compared. Here is the result:
557 | 
558 |
559 | It turns out that with the settings and inputs we used, there is actually no suitable habitat for our ancestral taxa except in the oldest time period! Because the taxa are still extant, we know this can't be the case, so we can try being more conservative with our inputs.
560 | #### Projecting into paleoclimate while accounting for uncertainty
561 | Earlier, we accounted for uncertainty in the reconstruction of the ancestral niche parameters by setting `unc=T` in `machu.2.ace`. When passing a `machu.2.ace` output where `unc=T` to `machu.3.anc.niche`, the function automatically detects the presence of uncertainty and includes it in the projections into paleoclimate. This is done by taking all 33=27 possible combinations of niche parameters for each climate variable, reconstructing a skew-normal distribution for each one, and converting to suitability across the climate raster to essentially produce 27 different niche models. These are then summed and rescaled to produce a single model that is generally broader than one not accounting for uncertainty. To run this analysis, we will use the `ace.ts.u` result from before as input:
562 | ```
563 | # projecting while accounting for uncertainty
564 | mod.ts.u <- machu.3.anc.niche(ace.ts.u, clim, verbose=T)
565 | ```
566 | The function acknowledges the presence of uncertainty information when printing progress updates to screen:
567 | ```
568 | [1] "Detected uncertainty samples in 'ace' ('unc' in machu.2.ace())."
569 | [1] "Associating scenarios ('ace') with rastersets ('clim') (numbers are indices, rows are associations):"
570 | clim ace
571 | [1,] 1 1
572 | [2,] 2 2
573 | [3,] 3 3
574 | [1] "Processed scenario 1"
575 | [1] "Processed scenario 2"
576 | [1] "Processed scenario 3"
577 | ```
578 | In this case the function took significantly longer to finish than without uncertainty because it is constructing 27x as many niche models. Let's view the results again:
579 | ```
580 | machu.plotmap(mod.ts.u, plot="t", axes=F, title.cex=0.85, to.scale=T, plot.asp=20/9)
581 | ```
582 | 
583 |
584 | This shows some improvement, as we now have some suitable area in the second timeslice (maps #5 and 6). However, the first timeslice still shows no suitable habitat. This is what happens when you choose a very range-limited taxon as the example for your tutorial.
585 |
586 | #### Clipping niche models
587 | By default, the `machu.3.anc.niche` function clips the tails of the skew-normal distributions describing the relationships between each climate variable and suitability (i.e., setting suitability (y) below the lower confidence limit (x) to zero, and setting suitability above the upper confidence limit to the upper confidence limit). This produces "cleaner" models. This behavior is controlled by the `clip.Q` parameter, which is `TRUE` by default. The confidence limits to clip by are in turn set by the `clip.amt` parameter, which is set to 0.95 by default.
588 |
589 | In the previous version of Machuruku, the confidence limits to clip by were themselves climate response variables parsed in `machu.1.tip.resp` and passed through `machu.2.ace`. To simplify matters, these variables are omitted from Machuruku 2.0 and the confidence limits are calculated directly within `machu.3.anc.niche` by randomly sampling from the corresponding skew-normal distribution with `sn::rsn` and calculating the confidence limits from the sample with `quantile`. The number of samples taken by `rsn` is set with the parameter `clip.samples`, which is set by default to 10,000; decreasing this number may improve the speed of the function, while sacrificing accuracy (for most applications 10,000 will be fine).
590 |
591 | In the following code block, I demonstrate the functionality of `clip.Q` by projecting ancestral niches into the m2 timeslice, first with no clipping, then clipping at the default level (95%), then performing very stringent clipping.
592 | ```
593 | # clipping niche models
594 | mod.ts.u.nc <- machu.3.anc.niche(ace.ts.u[3], clim[[3]], clip.Q=F) # no clipping
595 | mod.ts.u.c95 <- machu.3.anc.niche(ace.ts.u[3], clim[[3]], clip.Q=T) # default clipping (95%)
596 | mod.ts.u.c50 <- machu.3.anc.niche(ace.ts.u[3], clim[[3]], clip.Q=T, clip.amt=0.5) # stringent clipping (50%)
597 | ```
598 | When subsetting the `machu.2.ace` output `ace.ts.u`, single brackets must be used so that the input is still in "list" format. Now let's combine these results into a single list with `c` and visualize them with `machu.plotmap`:
599 | ```
600 | # combine and visualize
601 | clip.demo <- c(mod.ts.u.nc, mod.ts.u.c95, mod.ts.u.c50)
602 | names(clip.demo) <- c("no clipping", "clipping at 95%", "clipping at 50%")
603 | machu.plotmap(clip.demo, plot="t", axes=F, to.scale=T, plot.asp=1)
604 | ```
605 | I reset the names of each timeslice/scenario to better reflect what I'm trying to show. In `machu.plotmap`, I specified `plot.asp=1`, which controls the aspect ratio of the output window that the function uses to determine how many rows and columns to use. I'm after a 3x2 grid.
606 | 
607 |
608 | Here we see that the models are broadest at the top, and much narrower at the bottom where I've clipped the tails of the skew-normal distributions halfway. This can be a useful way of making models more or less conservative a posteriori.
609 | #### Making binary niche models
610 | In some applications one may want to produce a binary (0,1) niche model rather than a continuous one. This is accommodated in `machu.3.anc.niche` via the `resp.curv` parameter, which specifies whether to use response curves in constructing the niche model. By default, `resp.curv=TRUE`. When `FALSE`, the function will instead produce binary models. With this method, the values of pixels with suitabilities within or greater than confidence limits determined by `clip.amt` are converted to 1; the values of pixels with suitabilites lower than the lower confidence limit are converted to 0. Below, we produce binary models at the default confidence level (95%) and at a more stringent one (75%), then display the results.
611 | ```
612 | # producing binary models
613 | mod.ts.u.b95 <- machu.3.anc.niche(ace.ts.u[3], clim[[3]], resp.curv=F) # default clipping (95%)
614 | mod.ts.u.b75 <- machu.3.anc.niche(ace.ts.u[3], clim[[3]], resp.curv=F, clip.amt=0.75) # stringent clipping (75%)
615 | # combine and visualize
616 | binary.demo <- c(mod.ts.u.b95, mod.ts.u.b75)
617 | names(binary.demo) <- c("clipping at 95%", "clipping at 75%")
618 | machu.plotmap(binary.demo, plot="t", title.cex=0.8, axes=F, plot.asp=1)
619 | ```
620 | 
621 |
622 | The models are now in binary format, where a pixel either is suitable or it isn't. The bottom row with more stringent clipping produces less suitable area.
623 | #### Projecting a single scenario into multiple paleoclimates
624 | Because it is written as a series of nested apply statements, `machu.3.anc.niche` can handle any number of timeslices or paleoclimate datasets. The question is how it associates a timeslice to a paleoclimate dataset. In the previous sections, each of three timeslices was associated with one of three paleoclimates. But in some cases, a user may want to project one timeslice into multiple paleoclimates, perhaps for comparison. In fact, this is analogous to the usual practice of projecting present-day niche models into past or future climates, which does not account for niche evolution (Machuruku was developed to overcome this issue). In any case, all this takes is specifying a single timeslice and multiple paleoclimates:
625 | ```
626 | # one timeslice into multiple paleoclimates
627 | clim <- list(mis19.reduced, mpwp.reduced, m2.reduced)
628 | mod.multipc <- machu.3.anc.niche(ace.n, clim, taxa=1:4, clip.Q=F, verbose=T)
629 | ```
630 | Here I'm using the same three climate datasets as before, and `ace.n`, which you may recall doesn't correspond to any timeslice but instead contains the reconstructed climate response variables for the three nodes in our phylogeny, as well as the original climate response values of the four taxa at the tips of the phylogeny. The `ace.n` object is a list with a single element called `"tips_and_nodes"`. In this case, I'm only interested in projecting the four modern taxa (*bassleri, yoshina, pepperi,* and *silverstonei*) into the three paleoclimate datasets, so I specified `taxa=1:4`, which tells the function only to run the first four taxa in each scenario (taxa can also be specified by name). Since `verbose=T`, the function prints the following progress report to screen:
631 | ```
632 | [1] "Retained the following scenarios and taxa:"
633 | [1] "tips_and_nodes: bassleri, pepperi, silverstonei, yoshina"
634 | [1] "Did not detect uncertainty samples in 'ace' ('unc' in machu.2.ace())."
635 | [1] "Associating scenarios ('ace') with rastersets ('clim') (numbers are indices, rows are associations):"
636 | clim ace
637 | [1,] 1 1
638 | [2,] 2 1
639 | [3,] 3 1
640 | [1] "Processed scenario 1"
641 | [1] "Processed scenario 2"
642 | [1] "Processed scenario 3"
643 | ```
644 | When specific taxa are specified, `machu.3.anc.niche` prints a sanity check describing which scenarios (=timeslices) and taxa were retained in the analysis. This is because not all taxa may be present in all scenarios when timeslices are taken. If a certain timeslice contains none of the specified taxa, it will be dropped from the analysis. In this case, the second line of the progress report tells us that for our one `"tips_and_nodes"` scenario, only the extant taxa have been retained, as intended.
645 |
646 | Now look at the association table in the middle of the report. Contrary to the previous case, where each column went `1 2 3`, "`ace`" now reads `1 1 1`. This is showing that the one and only scenario in `ace.n` (`"tips_and_nodes"`) is being projected into each of the three paleoclimates.
647 |
648 | Let's visualize the results:
649 | ```
650 | # visualize
651 | machu.plotmap(mod.multipc, col=2, plot="t", axes=F, to.scale=T)
652 | ```
653 | 
654 |
655 | This shows that none of the extant taxa have any suitable habitat in mis19 ("rasterSet1"), and have varyingly small amounts in mpwp and m2. But again, these are based on the extant taxa, not their ancestors, which doesn't account for evolution in their physioclimatic tolerances.
656 |
657 | Note that the maps are drawn in a new color palette, which I specified with `col=2` in the above `machu.plotmap` command. This function comes with 6 premade color palettes, inspired by the [Viridis](https://cran.r-project.org/web/packages/viridis/vignettes/intro-to-viridis.html) R package for colorblind-friendly graphing. Palette `2` is the "plasma" ramp from Viridis, which can also be specified by name. You can also specify your own color palette with the `colorRampPalette` function.
658 | #### Projecting multiple scenarios into a single paleoclimate
659 | One can also do the opposite of the above and project multiple timeslices into a single paleoclimate dataset. This doesn't strike me as particularly useful except for comparing taxa from multiple time periods in the same climatic context.
660 | ```
661 | # multiple timeslices into a single paleoclimate
662 | mod.multi.ts <- machu.3.anc.niche(ace.ts.u, m2.reduced, clip.Q=F, verbose=T)
663 | ```
664 | Here I specify as input `ace.ts.u`, which contains all three timeslices from before with uncertainty data, plus the m2 paleoclimate dataset by itself. This prints the following progress report to screen:
665 | ```
666 | [1] "Detected uncertainty samples in 'ace' ('unc' in machu.2.ace())."
667 | [1] "Warning: solo SpatRaster detected, with no raster.sets specified; treating as a single timeslice."
668 | [1] "Associating scenarios ('ace') with rastersets ('clim') (numbers are indices, rows are associations):"
669 | clim ace
670 | [1,] 1 1
671 | [2,] 1 2
672 | [3,] 1 3
673 | [1] "Processed scenario 1"
674 | [1] "Processed scenario 2"
675 | [1] "Processed scenario 3"
676 | ```
677 | The association table is now reversed from the previous section: the "`clim`" column reads `1 1 1`, showing that the one and only paleoclimate dataset has been associated with all three timeslices. Now let's visualize the results (using `col=3`, which is the "viridis" color palette):
678 | ```
679 | # visualize
680 | machu.plotmap(mod.multi.ts, col=3, plot="t", axes=F, to.scale=T)
681 | ```
682 | 
683 |
684 | Recall that there are 8 taxa total in our 3 timeslices, 4 in the mis19 timeslice, and 2 each in the mpwp and m2 timeslices. The titles of these plots refer to these three timeslices, but it's important to note that they are *only projected into the m2 paleoclimate data* (i.e. "timeslice_3.3). The scenario component of each title refers to the taxon's timeslice of origin, rather than the paleoclimate scenario it is projected into.
685 |
686 | `machu.3.anc.niche` can also accommodate the odd case where there are differing amounts of timeslices and paleoclimates, all greater than 1. In this situation, the function will do a 1:1 association of timeslices and paleoclimates *up to* the length of the shorter input. In other words, when 2 timeslices and 3 paleoclimates are provided, timeslice 1 and paleoclimate 1 will be associated, timeslice 2 and paleoclimate 2 will be associated, and paleoclimate 3 will be dropped from the analysis.
687 | ```
688 | # differing numbers of timeslices and paleoclimates (all >1)
689 | machu.3.anc.niche(ace.ts[1:2], clim, verbose=T) %>% invisible
690 | ```
691 | Here I've specified only the first two timeslices from `ace.ts`, and recall that `clim` contains three paleoclimate datasets. The `%>% invisible` part is using a dplyr pipe (`%>%`) to send the output of the function to `invisible` so that it isn't printed to screen at the end. Since `verbose=T`, the function still prints the following progress report:
692 | ```
693 | [1] "Did not detect uncertainty samples in 'ace' ('unc' in machu.2.ace())."
694 | [1] "Associating scenarios ('ace') with rastersets ('clim') (numbers are indices, rows are associations):"
695 | clim ace
696 | [1,] 1 1
697 | [2,] 2 2
698 | [1] "Processed scenario 1"
699 | [1] "Processed scenario 2"
700 | ```
701 | Only the first two paleoclimate datasets were used since there were fewer timeslices than paleoclimates.
702 | #### Saving niche models to a folder
703 | The final feature of `machu.3.anc.niche` to cover is saving outputs. Of course, it isn't very hard to save rasters to a file in whatever format you like with the `writeRaster` function, but Machuruku can save you the trouble with the `output.folder` parameter.
704 | ```
705 | # save outputs to folder
706 | machu.3.anc.niche(ace.ts, clim, output.folder=getwd(), verbose=T) %>% invisible
707 | ```
708 | I've set `output.folder` to the current working directory. Checking for the files with `list.files(pattern=".tif")` shows their names:
709 | ```
710 | [1] "timeslice_0.787_Node1-silverstonei.tif" "timeslice_0.787_Node2-pepperi.tif" "timeslice_0.787_Node3-bassleri.tif"
711 | [4] "timeslice_0.787_Node3-yoshina.tif" "timeslice_3.205_Node1-Node2.tif" "timeslice_3.205_Node1-silverstonei.tif"
712 | [7] "timeslice_3.3_Node1-Node2.tif" "timeslice_3.3_Node1-silverstonei.tif"
713 | ```
714 | The output file format is always TIFF. The name format is the "scenario_taxon.tif". In certain cases, such as when subsetting your `ace` input, this format can get screwed up. You can use `machu.plotmap` to "preview" the titles in that sense because it works similarly. If your titles are getting screwed up, you might as well create your own function to write the rasters to file.
715 |
716 |
717 |
718 |
719 |
720 |
721 |
722 |
723 |
724 |
725 |
726 |
727 |
--------------------------------------------------------------------------------