Repository for the draft of "Predictors of arboreality from the mammalian appendicular skeleton illuminate locomotor trends among early mammals" by Jonathan Nations, Lucas Weaver, and David Grossnickle.
This is an investigation into the morphological signature of climbing in (mostly small, extant) mammals to better understand the locomotor affinities of early mammals and plesiadapiforms.
- Determine which postcranial measurements, or which form of the measurements, are the best predictors of climbing.
- Explore the relationship between the method of categorizing locomotion and the preferred morphological measurements.
- Predict the locomotion of fossil species using the measurements with the highest predictive ability
- The contents of this repo is split up into 3 main directories:
Code
,Data
, andPlots
. We use the awesome package "here" to deal with the repo structure. Currently anyone can download the repo as is and run the code without dealing with paths (if all packages are installed).
-
This is the list of packages used throughout the repository. If these are all installed, then everything should just work for anyone that downloads this repository.
-
tidyverse
,here
,glue
,brms
,cmdstanr
,kableExtra
,ape
,tidybayes
,patchwork
,ggthemes
,furrr
. -
Note that if you want to use
cmdstanr
, which improves the compilation time and execution time of thebrms
models, then it's a little more involved than justinstall.packages()
(but definitely worth it!). See this link to get started.
Code should be run in the order listed below
- The first step is to take the raw data from our measurements and calculate the indices, geometric means, and log-shape ratios. The raw data are (
Data/Raw_Data_Extant.csv
, andData/Raw_Data_Fossil.csv
) and are presented as Tables S1 and S6 in the Supporting Information. We also scale the raw data to a mean of zero and a standard deviation of 1, which puts all values on the same scale and helps interpretability, comparability, prior choice, and model convergence. All of this is done inCode/Data_load.Rmd
. The outputs are calledData/Extant_Master.csv
andData/Fossil_Master.csv
.
-
We use the extant data to build predictive models. The models are found in
Code/Binary_Mods.Rmd
for the binary logistic regression models, andCode/Ordinal_Mods
for the ranked locomotor variables. We use multilevel models generated in brms. You can see the model structure, missing data estimation methods, priors, etc. by looking at these scripts. WARNING, These models take a long time to run! Hours! These scripts save the model outputs asB_gm_mods_mis.rds
,B_gm_mods_mis.rds
,B_ratio_mods_mis.rds
,O_gm_mods_mis.rds
,O_gm_mods_mis.rds
, andO_ratio_mods_mis.rds
, which are all pretty big files so they are not saved on GitHub. But they are used in all the predictions, so if you are following along you need to run these models and save the outputs before continuing on. -
Multiple Regression models are run in the scripts
Code/Binary_Mult_Mods.Rmd
andCode/Ordinal_Mult_Mods.Rmd
. These are models that use all of the "accurate" predictors (see next header) in the model. There are many of them, as the fossil data are missing lots of data, and a different model has to be run for most of them individually based on which predictors are available. The outputs areData/B_lm_mods_multi.rds
andData/O_lm_mods_multi.rds
-
Model result outputs are presented in Tables S2 (
Data/Binary_Table.csv
) and S3 (Data/Ordinal_Table.csv
). These show the median and 89% probability intervals of each of the relevant parameters. Full model outputs (all ~500 parameters) can be viewed by loading theData/B_*_mods_*.rds
model files. The scripts to organize all of the outputs into reasonable format are in the scriptEffect_Results_Tables.Rmd
.
- The script
Code/Accuracy.Rmd
generates Pareto-$k$ values using leave-one-out cross validation, and generate predictions for the extant species. These predictions are summarized as percentages of accurate predictions, both with and without the phylogeny as a group level effect. OutputData/Accuracy.csv
which is presented as Tables S4 in the supporting information.
-
Most plots have a .pdf along with a .jpg version that was used in gdocs & word. Final versions will be .tiff.
-
Extant "model" taxa predictions and fossil predictions are made in the same scripts:
Code/Binary_Predict.Rmd
andCode/Ordianl_Predict.Rmd
. The scripts generate the predictions, then plot them as seen in Figures 3, 4, 5, & 6.
- Most of the data are outputs that are called in other scripts, like models being called in prediction scripts. Most of these are discussed above. Here is a list of the relevant Supporting Information tables and data:
- Table S1:
Raw_Data_Extant.csv
- Table S2:
Binary_Table.csv
- Table S3:
Ordinal_Table.csv
- Table S4:
Accuracy_Bin.csv
- Table S5:
Accuracy_Ord.csv
- Table S6:
Raw_Data_Fossil.csv
- Table S1:
-
The tree plot, Figure 1, was made using the
Code/Tree_Plot.Rmd
script. The output is calledPlots/tre_test_rectangle.pdf
. -
The effect output plots are generated in the scripts
Code/Binary_Effect_Plots.Rmd
,Code/Ordinal_Effect_Plots.Rmd
, andCode/Combined_Effect_Plots.Rmd
.- Figures 2:
Combined_Effects_Some_BW.pdf
- Figures S1:
B_Effects_All_BW.pdf
- Figures S2:
O_Effects_All_BW.pdf
- Figures 2: