Last updated: 2024-01-19
Checks: 7 0
Knit directory: LocksofLineage/
This reproducible R Markdown analysis was created with workflowr (version 1.7.1). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.
Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.
Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.
The command set.seed(20231117)
was run prior to running
the code in the R Markdown file. Setting a seed ensures that any results
that rely on randomness, e.g. subsampling or permutations, are
reproducible.
Great job! Recording the operating system, R version, and package versions is critical for reproducibility.
Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.
Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.
Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.
The results in this page were generated with repository version 59385d0. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.
Note that you need to be careful to ensure that all relevant files for
the analysis have been committed to Git prior to generating the results
(you can use wflow_publish
or
wflow_git_commit
). workflowr only checks the R Markdown
file, but you know if there are other scripts or data files that it
depends on. Below is the status of the Git repository when the results
were generated:
Ignored files:
Ignored: .DS_Store
Ignored: .Rproj.user/
Ignored: data/.DS_Store
Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.
These are the previous versions of the repository in which changes were
made to the R Markdown (analysis/SizeDichromatism.Rmd
) and
HTML (docs/SizeDichromatism.html
) files. If you’ve
configured a remote Git repository (see ?wflow_git_remote
),
click on the hyperlinks in the table below to view the files as they
were in that past version.
File | Version | Author | Date | Message |
---|---|---|---|---|
html | 2e682ed | Sarah E Taylor | 2024-01-19 | Build site. |
Rmd | eb3ad26 | Sarah E Taylor | 2024-01-19 | Added Sexual Dichromatism with Size Dimoprhism regression analysis. |
Phylogenetic tree: mammaltree
Number of tips: 5987
Number of nodes: 5986
Branch lengths:
mean: 2.680715
variance: 24.17565
distribution summary:
Min. 1st Qu. Median 3rd Qu. Max.
0.0000000 0.5284341 1.3073255 2.9454665 106.6007500
No root edge.
First ten tip labels: X_Shuotherium
X_Pseudotribos
X_Asfaltomylos
X_Obdurodon
Zaglossus_bartoni
Zaglossus_bruijnii
Zaglossus_attenboroughi
Tachyglossus_aculeatus
Ornithorhynchus_anatinus
X_Teinolophos
No node labels.
#read in the data
Binary_traits <- read_csv("data/Phylo_Project_Data/Masters_Binary_Traits.csv")
Rows: 244 Columns: 13
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (4): Family, Genus_names, species_name, subspecies
dbl (9): Size_Dimorphism, Sexual_Dimorphism, DM_Head, Natal_Coat, ConD, ConM...
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
head(Binary_traits)
# A tibble: 6 × 13
Family Genus…¹ speci…² subsp…³ Size_…⁴ Sexua…⁵ DM_Head Natal…⁶ ConD ConM
<chr> <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 cercopith… alleno… nigrov… <NA> 1 0 0 1 0 0
2 cheirogal… alloce… tricho… <NA> 1 0 0 0 0 0
3 cebidae alouat… caraya <NA> 1 1 1 1 1 0
4 cebidae alouat… guariba <NA> 1 1 1 1 0 0
5 cebidae alouat… pallia… pallia… 1 1 0 1 0 0
6 cebidae alouat… pigra <NA> 1 0 0 1 0 0
# … with 3 more variables: ConB <dbl>, Sexual_Dichromatism <dbl>,
# DC_Head <dbl>, and abbreviated variable names ¹Genus_names, ²species_name,
# ³subspecies, ⁴Size_Dimorphism, ⁵Sexual_Dimorphism, ⁶Natal_Coat
#combine genus and species names and capitalize first letter
Binary_traits_combined = Binary_traits %>% unite("species",`Genus_names`, `species_name`) %>% mutate(species = str_to_title(species))
head(Binary_traits_combined)
# A tibble: 6 × 12
Family species subsp…¹ Size_…² Sexua…³ DM_Head Natal…⁴ ConD ConM ConB
<chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 cercopithec… Alleno… <NA> 1 0 0 1 0 0 0
2 cheirogalei… Alloce… <NA> 1 0 0 0 0 0 0
3 cebidae Alouat… <NA> 1 1 1 1 1 0 0
4 cebidae Alouat… <NA> 1 1 1 1 0 0 0
5 cebidae Alouat… pallia… 1 1 0 1 0 0 0
6 cebidae Alouat… <NA> 1 0 0 1 0 0 0
# … with 2 more variables: Sexual_Dichromatism <dbl>, DC_Head <dbl>, and
# abbreviated variable names ¹subspecies, ²Size_Dimorphism,
# ³Sexual_Dimorphism, ⁴Natal_Coat
# prune tree for species in data
species_not_in_tree=setdiff(mammaltree$tip.label, Binary_traits_combined$species)
pruned.tree<-drop.tip(mammaltree,species_not_in_tree)
summary(pruned.tree)
Phylogenetic tree: pruned.tree
Number of tips: 236
Number of nodes: 235
Branch lengths:
mean: 2.860618
variance: 17.84922
distribution summary:
Min. 1st Qu. Median 3rd Qu. Max.
0.04705822 0.88148050 1.69536613 3.05531386 49.61463191
No root edge.
First ten tip labels: Nycticebus_pygmaeus
Nycticebus_coucang
Loris_tardigradus
Galagoides_thomasi
Galago_matschiei
Galago_moholi
Galago_senegalensis
Galago_gallarum
Otolemur_garnettii
Otolemur_crassicaudatus
No node labels.
#prune data for species in tree
data_pruned = Binary_traits_combined %>% filter(species %in% pruned.tree$tip.label)
head(data_pruned)
# A tibble: 6 × 12
Family species subsp…¹ Size_…² Sexua…³ DM_Head Natal…⁴ ConD ConM ConB
<chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 cercopithec… Alleno… <NA> 1 0 0 1 0 0 0
2 cheirogalei… Alloce… <NA> 1 0 0 0 0 0 0
3 cebidae Alouat… <NA> 1 1 1 1 1 0 0
4 cebidae Alouat… <NA> 1 1 1 1 0 0 0
5 cebidae Alouat… pallia… 1 1 0 1 0 0 0
6 cebidae Alouat… <NA> 1 0 0 1 0 0 0
# … with 2 more variables: Sexual_Dichromatism <dbl>, DC_Head <dbl>, and
# abbreviated variable names ¹subspecies, ²Size_Dimorphism,
# ³Sexual_Dimorphism, ⁴Natal_Coat
#put data into useful form for phylolm
colnames(data_pruned) = gsub(" ", "_", colnames(data_pruned))
data_pruned_rownames = column_to_rownames(data_pruned, var = "species")
head(data_pruned_rownames)
Family subspecies Size_Dimorphism
Allenopithecus_nigroviridis cercopithecidae <NA> 1
Allocebus_trichotis cheirogaleidae <NA> 1
Alouatta_caraya cebidae <NA> 1
Alouatta_guariba cebidae <NA> 1
Alouatta_palliata cebidae palliata 1
Alouatta_pigra cebidae <NA> 1
Sexual_Dimorphism DM_Head Natal_Coat ConD ConM ConB
Allenopithecus_nigroviridis 0 0 1 0 0 0
Allocebus_trichotis 0 0 0 0 0 0
Alouatta_caraya 1 1 1 1 0 0
Alouatta_guariba 1 1 1 0 0 0
Alouatta_palliata 1 0 1 0 0 0
Alouatta_pigra 0 0 1 0 0 0
Sexual_Dichromatism DC_Head
Allenopithecus_nigroviridis 0 0
Allocebus_trichotis 0 0
Alouatta_caraya 1 0
Alouatta_guariba 1 0
Alouatta_palliata 0 0
Alouatta_pigra 0 0
# run phylolm and get summary
SizeSDC <- phyloglm(Sexual_Dichromatism ~ Size_Dimorphism, data_pruned_rownames, phy = pruned.tree,method="logistic_MPLE")
summary(SizeSDC)
Call:
phyloglm(formula = Sexual_Dichromatism ~ Size_Dimorphism, data = data_pruned_rownames,
phy = pruned.tree, method = "logistic_MPLE")
AIC logLik Pen.logLik
282.5 -138.3 -135.4
Method: logistic_MPLE
Mean tip height: 66.17414
Parameter estimate(s):
alpha: 0.2594769
Coefficients:
Estimate StdErr z.value p.value
(Intercept) -1.40978 0.28342 -4.9742 6.551e-07 ***
Size_Dimorphism 1.02511 0.31459 3.2585 0.00112 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Note: Wald-type p-values for coefficients, conditional on alpha=0.2594769
sessionInfo()
R version 4.2.1 (2022-06-23)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur ... 10.16
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] lubridate_1.9.2 forcats_1.0.0 stringr_1.5.0 dplyr_1.1.0
[5] purrr_1.0.1 readr_2.1.4 tidyr_1.3.0 tibble_3.1.8
[9] ggplot2_3.4.1 tidyverse_2.0.0 phylolm_2.6.2 ape_5.7
[13] workflowr_1.7.1
loaded via a namespace (and not attached):
[1] Rcpp_1.0.11 lattice_0.20-45 listenv_0.9.0
[4] getPass_0.2-2 ps_1.7.2 rprojroot_2.0.4
[7] digest_0.6.30 utf8_1.2.2 parallelly_1.36.0
[10] R6_2.5.1 evaluate_0.20 httr_1.4.4
[13] pillar_1.8.1 rlang_1.0.6 rstudioapi_0.14
[16] whisker_0.4.1 callr_3.7.3 jquerylib_0.1.4
[19] rmarkdown_2.20 bit_4.0.5 munsell_0.5.0
[22] compiler_4.2.1 httpuv_1.6.11 xfun_0.41
[25] pkgconfig_2.0.3 globals_0.16.2 htmltools_0.5.4
[28] tidyselect_1.2.0 codetools_0.2-18 fansi_1.0.3
[31] future_1.33.0 crayon_1.5.2 tzdb_0.3.0
[34] withr_2.5.0 later_1.3.1 grid_4.2.1
[37] nlme_3.1-160 jsonlite_1.8.4 gtable_0.3.1
[40] lifecycle_1.0.3 git2r_0.32.0 magrittr_2.0.3
[43] scales_1.2.1 vroom_1.6.1 future.apply_1.11.0
[46] cli_3.6.0 stringi_1.7.8 cachem_1.0.6
[49] fs_1.6.1 promises_1.2.1 bslib_0.4.2
[52] ellipsis_0.3.2 vctrs_0.5.2 generics_0.1.3
[55] tools_4.2.1 bit64_4.0.5 glue_1.6.2
[58] hms_1.1.2 processx_3.8.0 parallel_4.2.1
[61] fastmap_1.1.0 yaml_2.3.7 timechange_0.2.0
[64] colorspace_2.0-3 knitr_1.42 sass_0.4.5