├── .Rbuildignore ├── .gitignore ├── CRAN-SUBMISSION ├── DESCRIPTION ├── NAMESPACE ├── NEWS.md ├── R ├── DAG.R ├── data_docs.R ├── internal.R ├── phylopath.R ├── print_and_plot.R └── sysdata.rda ├── README.md ├── _pkgdown.yml ├── cran-comments.md ├── data ├── cichlids.rda ├── cichlids_tree.rda ├── red_list.rda ├── red_list_tree.rda ├── rhino.rda └── rhino_tree.rda ├── docs ├── 404.html ├── articles │ ├── binary_models.R │ ├── binary_models.html │ ├── binary_models_files │ │ ├── figure-html │ │ │ ├── define models-1.png │ │ │ ├── define_models-1.png │ │ │ ├── get summary-1.png │ │ │ ├── get_summary-1.png │ │ │ ├── unnamed-chunk-1-1.png │ │ │ ├── unnamed-chunk-3-1.png │ │ │ ├── unnamed-chunk-4-1.png │ │ │ ├── unnamed-chunk-6-1.png │ │ │ ├── unnamed-chunk-7-1.png │ │ │ └── unnamed-chunk-8-1.png │ │ └── header-attrs-2.11 │ │ │ └── header-attrs.js │ ├── index.html │ ├── intro_to_phylopath.R │ ├── intro_to_phylopath.html │ └── intro_to_phylopath_files │ │ ├── figure-html │ │ ├── unnamed-chunk-10-1.png │ │ ├── unnamed-chunk-11-1.png │ │ ├── unnamed-chunk-12-1.png │ │ ├── unnamed-chunk-13-1.png │ │ ├── unnamed-chunk-14-1.png │ │ ├── unnamed-chunk-15-1.png │ │ ├── unnamed-chunk-16-1.png │ │ ├── unnamed-chunk-4-1.png │ │ ├── unnamed-chunk-5-1.png │ │ ├── unnamed-chunk-7-1.png │ │ └── unnamed-chunk-8-1.png │ │ └── header-attrs-2.11 │ │ └── header-attrs.js ├── authors.html ├── bootstrap-toc.css ├── bootstrap-toc.js ├── docsearch.css ├── docsearch.js ├── index.html ├── index_files │ └── figure-html │ │ ├── unnamed-chunk-2-1.png │ │ └── unnamed-chunk-3-1.png ├── jquery.sticky-kit.min.js ├── link.svg ├── news │ └── index.html ├── pkgdown.css ├── pkgdown.js ├── pkgdown.yml ├── reference │ ├── DAG-1.png │ ├── DAG-10.png │ ├── DAG-11.png │ ├── DAG-12.png │ ├── DAG-13.png │ ├── DAG-14.png │ ├── DAG-15.png │ ├── DAG-16.png │ ├── DAG-17.png │ ├── DAG-18.png │ ├── DAG-19.png │ ├── DAG-2.png │ ├── DAG-20.png │ ├── DAG-21.png │ ├── DAG-3.png │ ├── DAG-4.png │ ├── DAG-5.png │ ├── DAG-6.png │ ├── DAG-7.png │ ├── DAG-8.png │ ├── DAG-9.png │ ├── DAG.html │ ├── Rplot001.png │ ├── Rplot002.png │ ├── Rplot003.png │ ├── Rplot004.png │ ├── average-1.png │ ├── average-10.png │ ├── average-11.png │ ├── average-12.png │ ├── average-13.png │ ├── average-14.png │ ├── average-15.png │ ├── average-16.png │ ├── average-17.png │ ├── average-18.png │ ├── average-2.png │ ├── average-3.png │ ├── average-4.png │ ├── average-5.png │ ├── average-6.png │ ├── average-7.png │ ├── average-8.png │ ├── average-9.png │ ├── average.html │ ├── average_DAGs-1.png │ ├── average_DAGs-2.png │ ├── average_DAGs-3.png │ ├── average_DAGs-4.png │ ├── average_DAGs-5.png │ ├── average_DAGs-6.png │ ├── average_DAGs-7.png │ ├── average_DAGs.html │ ├── best-1.png │ ├── best-2.png │ ├── best-3.png │ ├── best-4.png │ ├── best-5.png │ ├── best-6.png │ ├── best-7.png │ ├── best.html │ ├── choice-1.png │ ├── choice-2.png │ ├── choice-3.png │ ├── choice-4.png │ ├── choice-5.png │ ├── choice-6.png │ ├── choice-7.png │ ├── choice.html │ ├── cichlids.html │ ├── cichlids_tree.html │ ├── coef_plot-1.png │ ├── coef_plot-10.png │ ├── coef_plot-11.png │ ├── coef_plot-12.png │ ├── coef_plot-13.png │ ├── coef_plot-14.png │ ├── coef_plot-15.png │ ├── coef_plot-16.png │ ├── coef_plot-17.png │ ├── coef_plot-18.png │ ├── coef_plot-19.png │ ├── coef_plot-2.png │ ├── coef_plot-20.png │ ├── coef_plot-21.png │ ├── coef_plot-22.png │ ├── coef_plot-23.png │ ├── coef_plot-24.png │ ├── coef_plot-25.png │ ├── coef_plot-26.png │ ├── coef_plot-27.png │ ├── coef_plot-28.png │ ├── coef_plot-3.png │ ├── coef_plot-4.png │ ├── coef_plot-5.png │ ├── coef_plot-6.png │ ├── coef_plot-7.png │ ├── coef_plot-8.png │ ├── coef_plot-9.png │ ├── coef_plot.html │ ├── define_model_set-1.png │ ├── define_model_set.html │ ├── est_DAG-1.png │ ├── est_DAG-10.png │ ├── est_DAG-11.png │ ├── est_DAG-12.png │ ├── est_DAG-13.png │ ├── est_DAG-14.png │ ├── est_DAG-2.png │ ├── est_DAG-3.png │ ├── est_DAG-4.png │ ├── est_DAG-5.png │ ├── est_DAG-6.png │ ├── est_DAG-7.png │ ├── est_DAG-8.png │ ├── est_DAG-9.png │ ├── est_DAG.html │ ├── est_DAG_binary.html │ ├── figures │ │ ├── unnamed-chunk-2-1.png │ │ └── unnamed-chunk-3-1.png │ ├── index.html │ ├── phylo_path.html │ ├── phylo_path_binary.html │ ├── plot.DAG-1.png │ ├── plot.DAG-2.png │ ├── plot.DAG-3.png │ ├── plot.DAG.html │ ├── plot.fitted_DAG-1.png │ ├── plot.fitted_DAG-2.png │ ├── plot.fitted_DAG-3.png │ ├── plot.fitted_DAG.html │ ├── plot_model_set-1.png │ ├── plot_model_set-10.png │ ├── plot_model_set-11.png │ ├── plot_model_set-12.png │ ├── plot_model_set-13.png │ ├── plot_model_set-14.png │ ├── plot_model_set-2.png │ ├── plot_model_set-3.png │ ├── plot_model_set-4.png │ ├── plot_model_set-5.png │ ├── plot_model_set-6.png │ ├── plot_model_set-7.png │ ├── plot_model_set-8.png │ ├── plot_model_set-9.png │ ├── plot_model_set.html │ ├── red_list.html │ ├── red_list_tree.html │ ├── reexports.html │ ├── rhino.html │ ├── rhino_tree.html │ └── show_warnings.html └── sitemap.xml ├── index.Rmd ├── index.md ├── inst └── CITATION ├── man ├── DAG.Rd ├── average.Rd ├── average_DAGs.Rd ├── best.Rd ├── choice.Rd ├── cichlids.Rd ├── cichlids_tree.Rd ├── coef_plot.Rd ├── define_model_set.Rd ├── est_DAG.Rd ├── figures │ ├── unnamed-chunk-2-1.png │ └── unnamed-chunk-3-1.png ├── phylo_path.Rd ├── plot.DAG.Rd ├── plot.fitted_DAG.Rd ├── plot_model_set.Rd ├── red_list.Rd ├── red_list_tree.Rd ├── rhino.Rd ├── rhino_tree.Rd └── show_warnings.Rd ├── phylopath.Rproj ├── tests ├── testthat.R └── testthat │ ├── test-dag.R │ └── test-define_model_set.R └── vignettes ├── binary_models.Rmd └── intro_to_phylopath.Rmd /.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^CRAN-RELEASE$ 2 | ^.*\.Rproj$ 3 | ^\.Rproj\.user$ 4 | ^vignettes/intro_to_phylopath\.html$ 5 | ^cran-comments\.md$ 6 | ^README\.md$ 7 | ^index\.Rmd$ 8 | ^index\.md$ 9 | ^index_files$ 10 | ^docs$ 11 | ^_pkgdown\.yml$ 12 | ^doc$ 13 | ^Meta$ 14 | ^CRAN-SUBMISSION$ 15 | ^revdep$ 16 | ^.DS_Store$ -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .Rproj.user 2 | .Rhistory 3 | .RData 4 | .Ruserdata 5 | inst/doc 6 | revdep 7 | doc 8 | Meta 9 | /doc/ 10 | /Meta/ 11 | .DS_Store -------------------------------------------------------------------------------- /CRAN-SUBMISSION: -------------------------------------------------------------------------------- 1 | Version: 1.3.0 2 | Date: 2024-06-11 22:10:51 UTC 3 | SHA: 8b8e956024cf365d3bb89c1ed131f60c51b3f27a 4 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: phylopath 2 | Type: Package 3 | Title: Perform Phylogenetic Path Analysis 4 | Version: 1.3.0 5 | Authors@R: person("Wouter", "van der Bijl", 6 | email = "wouter@zoology.ubc.ca", 7 | role = c("aut", "cre")) 8 | Maintainer: Wouter van der Bijl 9 | Description: A comprehensive and easy to use R implementation of confirmatory 10 | phylogenetic path analysis as described by Von Hardenberg and Gonzalez-Voyer 11 | (2012) . 12 | URL: https://Ax3man.github.io/phylopath/ 13 | BugReports: https://github.com/Ax3man/phylopath/issues 14 | License: GPL-3 15 | LazyData: TRUE 16 | Depends: 17 | R (>= 2.10) 18 | biocViews: 19 | Imports: 20 | ape (>= 4.1), 21 | future.apply, 22 | ggm (>= 2.3), 23 | ggplot2 (>= 3.0.0), 24 | ggraph (>= 1.0.0), 25 | igraph (>= 1.0.1), 26 | phylolm (>= 2.5), 27 | purrr (>= 0.2.3), 28 | tibble 29 | RoxygenNote: 7.3.1 30 | Roxygen: list(markdown = TRUE) 31 | Suggests: 32 | knitr, 33 | rmarkdown, 34 | testthat 35 | VignetteBuilder: knitr 36 | Encoding: UTF-8 37 | -------------------------------------------------------------------------------- /NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | 3 | S3method(plot,DAG) 4 | S3method(plot,fitted_DAG) 5 | S3method(plot,phylopath_summary) 6 | S3method(print,phylopath) 7 | S3method(print,phylopath_summary) 8 | S3method(summary,phylopath) 9 | export(DAG) 10 | export(average) 11 | export(average_DAGs) 12 | export(best) 13 | export(choice) 14 | export(coef_plot) 15 | export(define_model_set) 16 | export(est_DAG) 17 | export(phylo_path) 18 | export(plot_model_set) 19 | export(show_warnings) 20 | -------------------------------------------------------------------------------- /R/DAG.R: -------------------------------------------------------------------------------- 1 | #' Directed acyclic graphs (DAGs) 2 | #' 3 | #' This function is a simple wrapper around the function from the `ggm` 4 | #' package with the same name. The only differences are that the `order` 5 | #' argument defaults to `TRUE` and that it adds a `DAG` class for 6 | #' easy plotting. Typically, one would use [define_model_set()] to 7 | #' create models for use with the `phylopath` package. 8 | #' 9 | #' Supply a formulas for the model as arguments. Formulas should be of the 10 | #' form `child ~ parent`` and describe each path in your model. Multiple 11 | #' children of a single parent can be combined into a single formula: 12 | #' `child ~ parent1 + parent2`. Finally, an isolate (unconnected variable) can 13 | #' be included as being connected to itself: `isolate ~ isolate`. 14 | #' 15 | #' @param order logical, defaulting to `TRUE`. If `TRUE` the nodes of the DAG 16 | #' are permuted according to the topological order. If `FALSE` the nodes are 17 | #' in the order they first appear in the model formulae (from left to right). 18 | #' For use in the `phylopath` package, this should always be kept to `TRUE`, 19 | #' but the argument is available to avoid potential problems with masking the 20 | #' function from other packages. 21 | #' 22 | #' @inheritParams ggm::DAG 23 | #' @return An object of classes \code{matrix} and \code{DAG} 24 | #' @export 25 | #' 26 | #' @examples 27 | #' # Use formula notation to create DAGs: 28 | #' plot(DAG(A~B, B~C)) 29 | #' # Use + to easily add multiple parents to a node: 30 | #' plot(DAG(A~B+C)) 31 | #' # Add a node as it's own parent to create an isolate: 32 | #' plot(DAG(A~B+C, D~D)) 33 | DAG <- function(..., order = TRUE) { 34 | d <- ggm::DAG(..., order = order) 35 | class(d) <- c(class(d), 'DAG') 36 | d 37 | } 38 | 39 | #' Define a model set. 40 | #' 41 | #' This is a convenience function to quickly and clearly define a set of causal 42 | #' models. Supply a list of formulas for each model, using either `c()`. Formulas 43 | #' should be of the form `child ~ parent` and describe each path in your model. 44 | #' Multiple children of a single parent can be combined into a single formula: 45 | #' `child ~ parent1 + parent2`. 46 | #' 47 | #' This function uses [ggm::DAG()]. 48 | #' 49 | #' @param ... Named arguments, which each are a lists of formulas defining the 50 | #' paths of a causal model. 51 | #' @param .common A list of formulas that contain causal paths that are common 52 | #' to each model. 53 | #' 54 | #' @return A list of models, each of class `matrix` and `DAG`. 55 | #' @export 56 | #' 57 | #' @examples 58 | #' (m <- define_model_set( 59 | #' A = c(a~b, b~c), 60 | #' B = c(b~a, c~b), 61 | #' .common = c(d~a))) 62 | #' plot_model_set(m) 63 | define_model_set <- function(..., .common = NULL) { 64 | model_list <- list(...) 65 | # Get all unique variables 66 | vars <- unique(unlist(lapply(unlist(model_list), all.vars))) 67 | # And guarantee their inclusion as isolates if necessary 68 | vars_formulas <- lapply(vars, function(x) stats::as.formula(paste(x, '~', x))) 69 | .common <- c(.common, vars_formulas, recursive = TRUE) 70 | # Add isolates and common paths to all models 71 | model_list <- lapply(model_list, function(x) c(x, .common)) 72 | # Build the models with DAG 73 | lapply(model_list, function(x) do.call(DAG, x)) 74 | } 75 | 76 | #' Add standardized path coefficients to a DAG. 77 | #' 78 | #' @param DAG A directed acyclic graph, typically created with \code{DAG}. 79 | #' @param boot The number of bootstrap replicates used to estimate confidence intervals. 80 | #' @inheritParams phylo_path 81 | #' 82 | #' @return An object of class \code{fitted_DAG}. 83 | #' 84 | #' @export 85 | #' 86 | #' @examples 87 | #' d <- DAG(LS ~ BM, NL ~ BM, DD ~ NL + LS) 88 | #' plot(d) 89 | #' d_fitted <- est_DAG(d, rhino, rhino_tree, 'lambda') 90 | #' plot(d_fitted) 91 | est_DAG <- function(DAG, data, tree, model, method, boot = 0, ...) { 92 | stopifnot(inherits(DAG, 'DAG')) 93 | dots <- list(...) 94 | # scale the continous variables 95 | r <- rownames(data) 96 | data[sapply(data, is.numeric)] <- lapply(data[sapply(data, is.numeric)], scale) 97 | rownames(data) <- r 98 | d <- Map(function(x, y, n) { 99 | if (all(y == 0)) { 100 | return(cbind(y, y, y, y)) 101 | } 102 | f <- stats::formula(paste(x, paste(n[y == 1], collapse = '+'), sep = '~')) 103 | m <- phylo_g_lm(f, data, tree, model, method, boot, dots) 104 | if (!is.null(m$error)) { 105 | stop(paste('Fitting the following model:\n ', Reduce(paste, deparse(f)), 106 | '\nproduced this error:\n ', m$error), 107 | call. = FALSE) 108 | } 109 | m <- m$result 110 | Coef <- se <- lower <- upper <- y 111 | Coef[Coef != 0] <- get_est(m) 112 | se[se != 0] <- get_se(m) 113 | lower[lower != 0] <- get_lower(m) 114 | upper[upper != 0] <- get_upper(m) 115 | return(cbind(coef = Coef, se = se, lower = lower, upper = upper)) 116 | }, colnames(DAG), as.data.frame(DAG), MoreArgs = list(n = rownames(DAG))) 117 | coefs <- sapply(d, `[`, 1:nrow(DAG), 1) 118 | ses <- sapply(d, `[`, 1:nrow(DAG), 2) 119 | lowers <- sapply(d, `[`, 1:nrow(DAG), 3) 120 | uppers <- sapply(d, `[`, 1:nrow(DAG), 4) 121 | rownames(coefs) <- rownames(ses) <- rownames(lowers) <- rownames(uppers) <- 122 | rownames(DAG) 123 | if (boot > 0) { 124 | res <- list(coef = coefs, se = ses, lower = lowers, upper = uppers) 125 | } else { 126 | res <- list(coef = coefs, se = ses) 127 | } 128 | class(res) <- 'fitted_DAG' 129 | return(res) 130 | } 131 | 132 | #' Perform model averaging on a list of DAGs. 133 | #' 134 | #' @param fitted_DAGs A list of `fitted_DAG` objects containing 135 | #' coefficients and standard errors, usually obtained by using [est_DAG()] 136 | #' on several DAGs. 137 | #' @param weights A vector of associated model weights. 138 | #' @param avg_method Either `"full"` or `"conditional"`. The methods 139 | #' differ in how they deal with averaging a path coefficient where the path is 140 | #' absent in some of the models. The full method sets the coefficient (and the 141 | #' variance) for the missing paths to zero, meaning paths that are missing in 142 | #' some models will shrink towards zero. The conditional method only averages 143 | #' over models where the path appears, making it more sensitive to small 144 | #' effects. Following von Hardenberg & Gonzalez-Voyer 2013, conditional 145 | #' averaging is set as the default. 146 | #' @param ... Use of the ellipses is deprecated. 147 | #' 148 | #' 149 | #' @return An object of class `fitted_DAG`, including standard errors and 150 | #' confidence intervals. 151 | #' @export 152 | #' 153 | #' @examples 154 | #' # Normally, I would advocate the use of the phylo_path and average 155 | #' # functions, but this code shows how to average any set of models. Note 156 | #' # that not many checks are implemented, so you may want to be careful and 157 | #' # make sure the DAGs make sense and contain the same variables! 158 | #' candidates <- define_model_set( 159 | #' A = NL ~ BM, 160 | #' B = NL ~ LS, 161 | #' .common = c(LS ~ BM, DD ~ NL) 162 | #' ) 163 | #' fit_cand <- lapply(candidates, est_DAG, rhino, rhino_tree, 164 | #' model = 'lambda', method = 'logistic_MPLE') 165 | #' ave_cand <- average_DAGs(fit_cand) 166 | #' coef_plot(ave_cand) 167 | average_DAGs <- function(fitted_DAGs, weights = rep(1, length(coef)), 168 | avg_method = 'conditional', ...) { 169 | if (length(list(...)) != 0) stop('Use of ... is deprecated.') 170 | avg_method <- match.arg(avg_method, choices = c("full", "conditional")) 171 | ord <- rownames(fitted_DAGs[[1]]$coef) 172 | fitted_DAGs <- lapply(fitted_DAGs, function(l) { 173 | lapply(l, function(m) m[ord, ord]) } ) 174 | 175 | coef <- lapply(fitted_DAGs, `[[`, 'coef') 176 | std_error <- lapply(fitted_DAGs, `[[`, 'se') 177 | 178 | rel_weights <- weights / sum(weights) 179 | coef <- simplify2array(coef) 180 | std_error <- simplify2array(std_error) 181 | if (avg_method == 'conditional') { 182 | coef[coef == 0] <- NA 183 | std_error[std_error == 0] <- NA 184 | } 185 | a_coef <- apply(coef, 1:2, stats::weighted.mean, w = rel_weights, na.rm = TRUE) 186 | a_coef[is.nan(a_coef)] <- 0 187 | 188 | if (!is.null(std_error)) { 189 | coef_list <- purrr::array_branch(coef, 1:2) 190 | std_error_list <- purrr::array_branch(std_error, 1:2) 191 | r <- purrr::map2( 192 | coef_list, 193 | std_error_list, 194 | function(.x, .y, ...) par_avg(.x, .y, rel_weights, ...), 195 | ... 196 | ) 197 | r <- purrr::map(r, function(x) { x[is.nan(x)] <- 0; x } ) 198 | a_std_error <- matrix(purrr::map_dbl(r, "SE"), nrow = nrow(coef)) 199 | lower <- matrix(purrr::map_dbl(r, "Lower CI"), nrow = nrow(coef)) 200 | upper <- matrix(purrr::map_dbl(r, "Upper CI"), nrow = nrow(coef)) 201 | dimnames(a_std_error) <- dimnames(lower) <- dimnames(upper) <- 202 | dimnames(a_coef) 203 | res <- list(coef = a_coef, se = a_std_error, lower = lower, upper = upper) 204 | } else { 205 | res <- list(coef = a_coef) 206 | } 207 | class(res) <- 'fitted_DAG' 208 | return(res) 209 | } -------------------------------------------------------------------------------- /R/data_docs.R: -------------------------------------------------------------------------------- 1 | #' Rhinogrades traits. 2 | #' 3 | #' A simulated dataset, as used by Gonzalez-Voyer and Von Hardenberg as an 4 | #' example, containing variables on body mass (BM), litter size (LS), nose 5 | #' length (NL), dispersal distance (DD) and range size (RS). 6 | #' 7 | #' @source Gonzalez-Voyer A & von Hardenberg A. 2014. An Introduction to 8 | #' Phylogenetic Path Analysis. Chapter 8. In: Garamszegi LZ (ed.), Modern 9 | #' Phylogenetic Comparative Methods and Their Application in Evolutionary 10 | #' Biology. pp. 201-229. Springer-Verlag Berlin Heidelberg. 11 | #' doi:10.1111/j.1558-5646.2012.01790.x 12 | "rhino" 13 | 14 | #' Rhinogrades phylogeny. 15 | #' 16 | #' A phylogenetic tree for the 100 species of the \code{rhino} dataset. 17 | #' 18 | #' @source Gonzalez-Voyer A & von Hardenberg A. 2014. An Introduction to 19 | #' Phylogenetic Path Analysis. Chapter 8. In: Garamszegi LZ (ed.), Modern 20 | #' Phylogenetic Comparative Methods and Their Application in Evolutionary 21 | #' Biology. pp. 201-229. Springer-Verlag Berlin Heidelberg. 22 | #' doi:10.1111/j.1558-5646.2012.01790.x 23 | "rhino_tree" 24 | 25 | #' Cichlid traits and the evolution of cooperative breeding. 26 | #' 27 | #' A data set with binary traits, used in an analysis on the evolution of 28 | #' cooperative breeding by Dey et al 2017. Variable names are shortened for 29 | #' easy of use and consist of cooperative breeding (C), mating system (M), 30 | #' parental care (P), social grouping (G) and diet (D). All traits are coded as 31 | #' two level factors. 32 | #' 33 | #' @source Dey, C.J., O'Connor, C.M., Wilkinson, H., Shultz, S., Balshine, S. & 34 | #' Fitzpatrick, J.L. 2017. Direct benefits and evolutionary transitions to 35 | #' complex societies. Nat Ecol Evol 1: 137. 36 | "cichlids" 37 | 38 | #' Cichlid phylogeny. 39 | #' 40 | #' The phylogenetic tree of cichlid species that accompanies the `cichlids` 41 | #' dataset. The phylogeny is based on five nuclear genes and three 42 | #' mitochondrial genes. 43 | #' 44 | #' @source Dey, C.J., O'Connor, C.M., Wilkinson, H., Shultz, S., Balshine, S. & 45 | #' Fitzpatrick, J.L. 2017. Direct benefits and evolutionary transitions to 46 | #' complex societies. Nat Ecol Evol 1: 137. 47 | "cichlids_tree" 48 | 49 | #' Data on brain size, life history and vulnerability to extinction 50 | #' 51 | #' A dataset with continuous variables affecting the conservation `Status` of 52 | #' mammalian species (the IUCN red list of threatened species). 53 | #' 54 | #' It includes the following variables: brain size (`Br`), body size (`B`), 55 | #' gestation period (`G`), litter size (`L`), weening age (`W`), population 56 | #' density (`P`) and vulnerability to extinction (`Status`). 57 | #' 58 | #' @source Gonzalez-Voyer A, Gonzalez-Suarez M, Vila C, Revilla E (2016) Larger 59 | #' brain size indirectly increases vulnerability to extinction in mammals. 60 | #' Evolution 70:1364-1375. doi: 10.1111/evo.12943 61 | "red_list" 62 | 63 | #' Mammalian phylogeny 64 | #' 65 | #' This is the accompanying phylogeny for the red_list data set. It is based 66 | #' on the updated mammalian supertree by Bininda-Emonds et al. 2007 & Fritz 67 | #' et al. 2009. 68 | #' 69 | #' @source Gonzalez-Voyer, A. Gonzalez-Suarez M. Vila C. and Revilla E. 2016. 70 | #' Larger brain size indirectly increases vulnerability to extinction in 71 | #' mammals. Evolution 70:1364-1375. doi: 10.1111/evo.12943. 72 | #' 73 | #' Bininda-Emonds, O. R. P., M. Cardillo, K. E. Jones, R. D. E. MacPhee, R. M. D. 74 | #' Beck, R. Grenyer, S. A. Price, R. A. Vos, J. L. Gittleman, and A. Purvis. 75 | #' 2007. The delayed rise of present-day mammals. Nature 446:507-512. 76 | #' 77 | #' Fritz, S. A., O. R. P. Bininda-Emonds, and A. Purvis. 2009. Geographical 78 | #' variation in predictors of mammalian extinction risk: big is bad, but 79 | #' only in the tropics. Ecol. Lett. 12:538-549. 80 | #' 81 | "red_list_tree" -------------------------------------------------------------------------------- /R/sysdata.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/R/sysdata.rda -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # phylopath 2 | 3 | [![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/phylopath)](https://cran.r-project.org/package=phylopath) [![Cran downloads](http://cranlogs.r-pkg.org/badges/grand-total/phylopath)](http://cran.rstudio.com/web/packages/phylopath/index.html) [![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active) 4 | 5 | This package implements phylogenetic path analysis in R. 6 | 7 | Install the package using: 8 | 9 | ```{r} 10 | install.packages("phylopath") 11 | ``` 12 | You may need to install the downstream dependency `graph` from Bioconductor: 13 | 14 | ```{r} 15 | if (!require("BiocManager", quietly = TRUE)) install.packages("BiocManager") 16 | BiocManager::install("graph") 17 | ``` 18 | 19 | Or if you'd like to install the development version (here on github), use: 20 | 21 | ```{r} 22 | remotes::install_github("Ax3man/phylopath") 23 | ``` 24 | 25 | It's easiest to start on the [website](https://ax3man.github.io/phylopath) and first read the introduction [here](https://ax3man.github.io/phylopath/articles/intro_to_phylopath.html), or read the [paper in PeerJ](https://doi.org/10.7717/peerj.4718). 26 | 27 | If you find any problems, or if you have suggestions for improvements, please file those under [issues](/issue). PRs welcome. 28 | -------------------------------------------------------------------------------- /_pkgdown.yml: -------------------------------------------------------------------------------- 1 | template: 2 | params: 3 | bootswatch: cosmo 4 | 5 | reference: 6 | - title: "Top level functions" 7 | desc: "Use these functions to describe, fit, select and average your models." 8 | contents: 9 | - define_model_set 10 | - DAG 11 | - phylo_path 12 | - average 13 | - best 14 | - choice 15 | - show_warnings 16 | - title: "Plotting" 17 | contents: 18 | - plot.DAG 19 | - plot.fitted_DAG 20 | - plot_model_set 21 | - coef_plot 22 | - title: "Low level functions" 23 | desc: "Use these functions for finer control. These are mostly for internal use." 24 | contents: 25 | - est_DAG 26 | - average_DAGs 27 | - title: "Included datasets" 28 | contents: 29 | - rhino 30 | - rhino_tree 31 | - cichlids 32 | - cichlids_tree 33 | - red_list 34 | - red_list_tree 35 | 36 | 37 | navbar: 38 | title: "phylopath" 39 | type: inverse 40 | left: 41 | - icon: fa-home 42 | href: index.html 43 | - text: "Get started" 44 | href: articles/intro_to_phylopath.html 45 | - text: "Binary data" 46 | href: articles/binary_models.html 47 | - text: "Reference" 48 | href: "reference/index.html" 49 | - text: "News" 50 | href: "news/index.html" 51 | right: 52 | - icon: fa-github 53 | href: https://github.com/Ax3man/phylopath 54 | -------------------------------------------------------------------------------- /cran-comments.md: -------------------------------------------------------------------------------- 1 | ## Test environments 2 | * local MacOS 12.4 install, R 4.4.0 3 | 4 | ## Local R CMD check results 5 | 0 errors | 0 warnings | 0 notes 6 | 7 | ## CRAN Package Check Results: 8 | All OK. 9 | 10 | ## Downstream dependencies 11 | The package has 2 downstream dependencies, which were checked with revdepcheck and passed. 12 | 13 | This submission removes {MuMIn} as a dependency, since it is threatened with CRAN removal. -------------------------------------------------------------------------------- /data/cichlids.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/data/cichlids.rda -------------------------------------------------------------------------------- /data/cichlids_tree.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/data/cichlids_tree.rda -------------------------------------------------------------------------------- /data/red_list.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/data/red_list.rda -------------------------------------------------------------------------------- /data/red_list_tree.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/data/red_list_tree.rda -------------------------------------------------------------------------------- /data/rhino.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/data/rhino.rda -------------------------------------------------------------------------------- /data/rhino_tree.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/data/rhino_tree.rda -------------------------------------------------------------------------------- /docs/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Page not found (404) • phylopath 9 | 10 | 11 | 12 | 13 | 14 | 15 | 19 | 20 | 21 | 22 | 23 |
24 |
73 | 74 | 75 | 76 | 77 |
78 |
79 | 82 | 83 | Content not found. Please use links in the navbar. 84 | 85 |
86 | 87 | 91 | 92 |
93 | 94 | 95 | 96 |
100 | 101 |
102 |

103 |

Site built with pkgdown 2.0.9.

104 |
105 | 106 |
107 |
108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /docs/articles/binary_models.R: -------------------------------------------------------------------------------- 1 | ## ---- fig.align='center', fig.width=10, fig.height=8, out.height="600px", fig.dpi = 600---- 2 | library(phylopath) 3 | 4 | models <- define_model_set( 5 | A = c(C~M+D), 6 | B = c(C~D), 7 | C = c(C~D, P~M), 8 | D = c(C~D, M~P, G~P), 9 | E = c(C~D, P~M, G~P), 10 | F = c(C~D, P~M+G), 11 | G = c(C~D, M~P, P~G), 12 | H = c(C~D, M~P), 13 | I = c(C~D, M~M, G~P), 14 | J = c(M~P, G~D), 15 | K = c(P~M, G~D), 16 | L = c(C~M+D, P~M+G), 17 | .common = c(C~P+G) 18 | ) 19 | 20 | plot_model_set(models, algorithm = 'kk') 21 | 22 | ## ------------------------------------------------------------------------ 23 | (cichlids_results <- phylo_path(models, cichlids, cichlids_tree)) 24 | 25 | ## ------------------------------------------------------------------------ 26 | (s <- summary(cichlids_results)) 27 | plot(s) 28 | 29 | ## ------------------------------------------------------------------------ 30 | best_cichlids <- best(cichlids_results) 31 | 32 | ## ------------------------------------------------------------------------ 33 | best_cichlids 34 | 35 | ## ------------------------------------------------------------------------ 36 | coef_plot(best_cichlids, error_bar = "se", reverse_order = TRUE) + ggplot2::coord_flip() 37 | 38 | ## ---- fig.align='center', fig.width=8, fig.height=4, out.width="600px", fig.dpi = 300---- 39 | plot(best_cichlids) 40 | 41 | -------------------------------------------------------------------------------- /docs/articles/binary_models_files/figure-html/define models-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/articles/binary_models_files/figure-html/define models-1.png -------------------------------------------------------------------------------- /docs/articles/binary_models_files/figure-html/define_models-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/articles/binary_models_files/figure-html/define_models-1.png -------------------------------------------------------------------------------- /docs/articles/binary_models_files/figure-html/get summary-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/articles/binary_models_files/figure-html/get summary-1.png -------------------------------------------------------------------------------- /docs/articles/binary_models_files/figure-html/get_summary-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/articles/binary_models_files/figure-html/get_summary-1.png -------------------------------------------------------------------------------- /docs/articles/binary_models_files/figure-html/unnamed-chunk-1-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/articles/binary_models_files/figure-html/unnamed-chunk-1-1.png -------------------------------------------------------------------------------- /docs/articles/binary_models_files/figure-html/unnamed-chunk-3-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/articles/binary_models_files/figure-html/unnamed-chunk-3-1.png -------------------------------------------------------------------------------- /docs/articles/binary_models_files/figure-html/unnamed-chunk-4-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/articles/binary_models_files/figure-html/unnamed-chunk-4-1.png -------------------------------------------------------------------------------- /docs/articles/binary_models_files/figure-html/unnamed-chunk-6-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/articles/binary_models_files/figure-html/unnamed-chunk-6-1.png -------------------------------------------------------------------------------- /docs/articles/binary_models_files/figure-html/unnamed-chunk-7-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/articles/binary_models_files/figure-html/unnamed-chunk-7-1.png -------------------------------------------------------------------------------- /docs/articles/binary_models_files/figure-html/unnamed-chunk-8-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/articles/binary_models_files/figure-html/unnamed-chunk-8-1.png -------------------------------------------------------------------------------- /docs/articles/binary_models_files/header-attrs-2.11/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/articles/index.html: -------------------------------------------------------------------------------- 1 | 2 | Articles • phylopath 6 | 7 | 8 |
9 |
52 | 53 | 54 | 55 |
56 |
57 | 60 | 61 | 70 |
71 |
72 | 73 | 74 |
77 | 78 |
79 |

Site built with pkgdown 2.0.9.

80 |
81 | 82 |
83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /docs/articles/intro_to_phylopath.R: -------------------------------------------------------------------------------- 1 | ## ---- eval=FALSE--------------------------------------------------------- 2 | # library(ape) 3 | # my_tree <- read.tree('my_tree.tre') # For Newick format trees 4 | # my_tree <- read.nexus('my_tree.nex') # For NEXUS format trees 5 | 6 | ## ---- eval=FALSE--------------------------------------------------------- 7 | # rownames(my_data) <- my_data$species_name 8 | 9 | ## ---- eval=FALSE--------------------------------------------------------- 10 | # my_tree$tip.label # Check the tip labels of your tree 11 | # rownames(my_data) <- gsub(' ', '_', my_data$species_name_with_spaces) 12 | 13 | ## ---- include = FALSE---------------------------------------------------- 14 | knitr::opts_chunk$set(dev = "png", fig.height = 5, fig.width = 5, dpi = 300, out.width = "450px") 15 | 16 | ## ------------------------------------------------------------------------ 17 | library(phylopath) 18 | 19 | models <- define_model_set( 20 | one = c(RS ~ DD), 21 | two = c(DD ~ NL, RS ~ LS + DD), 22 | three = c(RS ~ NL), 23 | four = c(RS ~ BM + NL), 24 | five = c(RS ~ BM + NL + DD), 25 | six = c(NL ~ RS, RS ~ BM), 26 | seven = c(NL ~ RS, RS ~ LS + BM), 27 | eight = c(NL ~ RS), 28 | nine = c(NL ~ RS, RS ~ LS), 29 | .common = c(LS ~ BM, NL ~ BM, DD ~ NL) 30 | ) 31 | 32 | ## ------------------------------------------------------------------------ 33 | models$one 34 | 35 | ## ---- fig.height = 5, fig.width = 5, dpi = 300--------------------------- 36 | plot(models$one) 37 | 38 | ## ---- fig.height=8, fig.width=8, out.width = "600px"--------------------- 39 | plot_model_set(models) 40 | 41 | ## ------------------------------------------------------------------------ 42 | result <- phylo_path(models, data = rhino, tree = rhino_tree, model = 'lambda') 43 | 44 | ## ------------------------------------------------------------------------ 45 | result 46 | 47 | ## ------------------------------------------------------------------------ 48 | (s <- summary(result)) 49 | 50 | ## ------------------------------------------------------------------------ 51 | plot(s) 52 | 53 | ## ------------------------------------------------------------------------ 54 | (best_model <- best(result)) 55 | 56 | ## ---- warning = FALSE, fig.width = 6------------------------------------- 57 | plot(best_model) 58 | 59 | ## ---- fig.width = 7------------------------------------------------------ 60 | average_model <- average(result) 61 | plot(average_model, algorithm = 'mds', curvature = 0.1) # increase the curvature to avoid overlapping edges 62 | 63 | ## ---- fig.width = 7------------------------------------------------------ 64 | average_model_full <- average(result, avg_method = "full") 65 | plot(average_model_full, algorithm = 'mds', curvature = 0.1) 66 | 67 | ## ------------------------------------------------------------------------ 68 | #coef_plot(average_model) 69 | 70 | ## ---- fig.height=3.5----------------------------------------------------- 71 | # coef_plot(average_model_full, reverse_order = TRUE) + 72 | # ggplot2::coord_flip() + 73 | # ggplot2::theme_bw() 74 | 75 | ## ------------------------------------------------------------------------ 76 | result$d_sep$one 77 | 78 | -------------------------------------------------------------------------------- /docs/articles/intro_to_phylopath_files/figure-html/unnamed-chunk-10-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/articles/intro_to_phylopath_files/figure-html/unnamed-chunk-10-1.png -------------------------------------------------------------------------------- /docs/articles/intro_to_phylopath_files/figure-html/unnamed-chunk-11-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/articles/intro_to_phylopath_files/figure-html/unnamed-chunk-11-1.png -------------------------------------------------------------------------------- /docs/articles/intro_to_phylopath_files/figure-html/unnamed-chunk-12-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/articles/intro_to_phylopath_files/figure-html/unnamed-chunk-12-1.png -------------------------------------------------------------------------------- /docs/articles/intro_to_phylopath_files/figure-html/unnamed-chunk-13-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/articles/intro_to_phylopath_files/figure-html/unnamed-chunk-13-1.png -------------------------------------------------------------------------------- /docs/articles/intro_to_phylopath_files/figure-html/unnamed-chunk-14-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/articles/intro_to_phylopath_files/figure-html/unnamed-chunk-14-1.png -------------------------------------------------------------------------------- /docs/articles/intro_to_phylopath_files/figure-html/unnamed-chunk-15-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/articles/intro_to_phylopath_files/figure-html/unnamed-chunk-15-1.png -------------------------------------------------------------------------------- /docs/articles/intro_to_phylopath_files/figure-html/unnamed-chunk-16-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/articles/intro_to_phylopath_files/figure-html/unnamed-chunk-16-1.png -------------------------------------------------------------------------------- /docs/articles/intro_to_phylopath_files/figure-html/unnamed-chunk-4-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/articles/intro_to_phylopath_files/figure-html/unnamed-chunk-4-1.png -------------------------------------------------------------------------------- /docs/articles/intro_to_phylopath_files/figure-html/unnamed-chunk-5-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/articles/intro_to_phylopath_files/figure-html/unnamed-chunk-5-1.png -------------------------------------------------------------------------------- /docs/articles/intro_to_phylopath_files/figure-html/unnamed-chunk-7-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/articles/intro_to_phylopath_files/figure-html/unnamed-chunk-7-1.png -------------------------------------------------------------------------------- /docs/articles/intro_to_phylopath_files/figure-html/unnamed-chunk-8-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/articles/intro_to_phylopath_files/figure-html/unnamed-chunk-8-1.png -------------------------------------------------------------------------------- /docs/articles/intro_to_phylopath_files/header-attrs-2.11/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/authors.html: -------------------------------------------------------------------------------- 1 | 2 | Authors and Citation • phylopath 6 | 7 | 8 |
9 |
52 | 53 | 54 | 55 |
56 |
57 |
58 | 61 | 62 | 63 |
  • 64 |

    Wouter van der Bijl. Author, maintainer. 65 |

    66 |
  • 67 |
68 |
69 |
70 |

Citation

71 | Source: inst/CITATION 72 |
73 |
74 | 75 | 76 |

von Hardenberg A, Gonzalez-Voyer A (2013). 77 | “Disentangling evolutionary cause-effect relationships with phylogenetic confirmatory path analysis.” 78 | Evolution, 67 - 2, 378-387. 79 | doi:10.1111/j.1558-5646.2012.01790.x. 80 |

81 |
@Article{phylopath-methods-paper,
 82 |   title = {Disentangling evolutionary cause-effect relationships with phylogenetic confirmatory path analysis},
 83 |   author = {Achaz {von Hardenberg} and Alejandro Gonzalez-Voyer},
 84 |   journal = {Evolution},
 85 |   volume = {67 - 2},
 86 |   pages = {378-387},
 87 |   year = {2013},
 88 |   doi = {10.1111/j.1558-5646.2012.01790.x},
 89 | }
90 |

van der Bijl W (2018). 91 | “phylopath: Easy phylogenetic path analysis in R.” 92 | PeerJ, 6, e4718. 93 | doi:10.7717/peerj.4718, R package version 1.3.0. 94 |

95 |
@Article{phylopath-package,
 96 |   title = {phylopath: Easy phylogenetic path analysis in R.},
 97 |   author = {Wouter {van der Bijl}},
 98 |   journal = {PeerJ},
 99 |   volume = {6},
100 |   pages = {e4718},
101 |   year = {2018},
102 |   note = {R package version 1.3.0},
103 |   doi = {10.7717/peerj.4718},
104 | }
105 | 106 |
107 | 108 |
109 | 110 | 111 | 112 |
115 | 116 |
117 |

Site built with pkgdown 2.0.9.

118 |
119 | 120 |
121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | -------------------------------------------------------------------------------- /docs/bootstrap-toc.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap Table of Contents v0.4.1 (http://afeld.github.io/bootstrap-toc/) 3 | * Copyright 2015 Aidan Feldman 4 | * Licensed under MIT (https://github.com/afeld/bootstrap-toc/blob/gh-pages/LICENSE.md) */ 5 | 6 | /* modified from https://github.com/twbs/bootstrap/blob/94b4076dd2efba9af71f0b18d4ee4b163aa9e0dd/docs/assets/css/src/docs.css#L548-L601 */ 7 | 8 | /* All levels of nav */ 9 | nav[data-toggle='toc'] .nav > li > a { 10 | display: block; 11 | padding: 4px 20px; 12 | font-size: 13px; 13 | font-weight: 500; 14 | color: #767676; 15 | } 16 | nav[data-toggle='toc'] .nav > li > a:hover, 17 | nav[data-toggle='toc'] .nav > li > a:focus { 18 | padding-left: 19px; 19 | color: #563d7c; 20 | text-decoration: none; 21 | background-color: transparent; 22 | border-left: 1px solid #563d7c; 23 | } 24 | nav[data-toggle='toc'] .nav > .active > a, 25 | nav[data-toggle='toc'] .nav > .active:hover > a, 26 | nav[data-toggle='toc'] .nav > .active:focus > a { 27 | padding-left: 18px; 28 | font-weight: bold; 29 | color: #563d7c; 30 | background-color: transparent; 31 | border-left: 2px solid #563d7c; 32 | } 33 | 34 | /* Nav: second level (shown on .active) */ 35 | nav[data-toggle='toc'] .nav .nav { 36 | display: none; /* Hide by default, but at >768px, show it */ 37 | padding-bottom: 10px; 38 | } 39 | nav[data-toggle='toc'] .nav .nav > li > a { 40 | padding-top: 1px; 41 | padding-bottom: 1px; 42 | padding-left: 30px; 43 | font-size: 12px; 44 | font-weight: normal; 45 | } 46 | nav[data-toggle='toc'] .nav .nav > li > a:hover, 47 | nav[data-toggle='toc'] .nav .nav > li > a:focus { 48 | padding-left: 29px; 49 | } 50 | nav[data-toggle='toc'] .nav .nav > .active > a, 51 | nav[data-toggle='toc'] .nav .nav > .active:hover > a, 52 | nav[data-toggle='toc'] .nav .nav > .active:focus > a { 53 | padding-left: 28px; 54 | font-weight: 500; 55 | } 56 | 57 | /* from https://github.com/twbs/bootstrap/blob/e38f066d8c203c3e032da0ff23cd2d6098ee2dd6/docs/assets/css/src/docs.css#L631-L634 */ 58 | nav[data-toggle='toc'] .nav > .active > ul { 59 | display: block; 60 | } 61 | -------------------------------------------------------------------------------- /docs/bootstrap-toc.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap Table of Contents v0.4.1 (http://afeld.github.io/bootstrap-toc/) 3 | * Copyright 2015 Aidan Feldman 4 | * Licensed under MIT (https://github.com/afeld/bootstrap-toc/blob/gh-pages/LICENSE.md) */ 5 | (function() { 6 | 'use strict'; 7 | 8 | window.Toc = { 9 | helpers: { 10 | // return all matching elements in the set, or their descendants 11 | findOrFilter: function($el, selector) { 12 | // http://danielnouri.org/notes/2011/03/14/a-jquery-find-that-also-finds-the-root-element/ 13 | // http://stackoverflow.com/a/12731439/358804 14 | var $descendants = $el.find(selector); 15 | return $el.filter(selector).add($descendants).filter(':not([data-toc-skip])'); 16 | }, 17 | 18 | generateUniqueIdBase: function(el) { 19 | var text = $(el).text(); 20 | var anchor = text.trim().toLowerCase().replace(/[^A-Za-z0-9]+/g, '-'); 21 | return anchor || el.tagName.toLowerCase(); 22 | }, 23 | 24 | generateUniqueId: function(el) { 25 | var anchorBase = this.generateUniqueIdBase(el); 26 | for (var i = 0; ; i++) { 27 | var anchor = anchorBase; 28 | if (i > 0) { 29 | // add suffix 30 | anchor += '-' + i; 31 | } 32 | // check if ID already exists 33 | if (!document.getElementById(anchor)) { 34 | return anchor; 35 | } 36 | } 37 | }, 38 | 39 | generateAnchor: function(el) { 40 | if (el.id) { 41 | return el.id; 42 | } else { 43 | var anchor = this.generateUniqueId(el); 44 | el.id = anchor; 45 | return anchor; 46 | } 47 | }, 48 | 49 | createNavList: function() { 50 | return $(''); 51 | }, 52 | 53 | createChildNavList: function($parent) { 54 | var $childList = this.createNavList(); 55 | $parent.append($childList); 56 | return $childList; 57 | }, 58 | 59 | generateNavEl: function(anchor, text) { 60 | var $a = $(''); 61 | $a.attr('href', '#' + anchor); 62 | $a.text(text); 63 | var $li = $('
  • '); 64 | $li.append($a); 65 | return $li; 66 | }, 67 | 68 | generateNavItem: function(headingEl) { 69 | var anchor = this.generateAnchor(headingEl); 70 | var $heading = $(headingEl); 71 | var text = $heading.data('toc-text') || $heading.text(); 72 | return this.generateNavEl(anchor, text); 73 | }, 74 | 75 | // Find the first heading level (`

    `, then `

    `, etc.) that has more than one element. Defaults to 1 (for `

    `). 76 | getTopLevel: function($scope) { 77 | for (var i = 1; i <= 6; i++) { 78 | var $headings = this.findOrFilter($scope, 'h' + i); 79 | if ($headings.length > 1) { 80 | return i; 81 | } 82 | } 83 | 84 | return 1; 85 | }, 86 | 87 | // returns the elements for the top level, and the next below it 88 | getHeadings: function($scope, topLevel) { 89 | var topSelector = 'h' + topLevel; 90 | 91 | var secondaryLevel = topLevel + 1; 92 | var secondarySelector = 'h' + secondaryLevel; 93 | 94 | return this.findOrFilter($scope, topSelector + ',' + secondarySelector); 95 | }, 96 | 97 | getNavLevel: function(el) { 98 | return parseInt(el.tagName.charAt(1), 10); 99 | }, 100 | 101 | populateNav: function($topContext, topLevel, $headings) { 102 | var $context = $topContext; 103 | var $prevNav; 104 | 105 | var helpers = this; 106 | $headings.each(function(i, el) { 107 | var $newNav = helpers.generateNavItem(el); 108 | var navLevel = helpers.getNavLevel(el); 109 | 110 | // determine the proper $context 111 | if (navLevel === topLevel) { 112 | // use top level 113 | $context = $topContext; 114 | } else if ($prevNav && $context === $topContext) { 115 | // create a new level of the tree and switch to it 116 | $context = helpers.createChildNavList($prevNav); 117 | } // else use the current $context 118 | 119 | $context.append($newNav); 120 | 121 | $prevNav = $newNav; 122 | }); 123 | }, 124 | 125 | parseOps: function(arg) { 126 | var opts; 127 | if (arg.jquery) { 128 | opts = { 129 | $nav: arg 130 | }; 131 | } else { 132 | opts = arg; 133 | } 134 | opts.$scope = opts.$scope || $(document.body); 135 | return opts; 136 | } 137 | }, 138 | 139 | // accepts a jQuery object, or an options object 140 | init: function(opts) { 141 | opts = this.helpers.parseOps(opts); 142 | 143 | // ensure that the data attribute is in place for styling 144 | opts.$nav.attr('data-toggle', 'toc'); 145 | 146 | var $topContext = this.helpers.createChildNavList(opts.$nav); 147 | var topLevel = this.helpers.getTopLevel(opts.$scope); 148 | var $headings = this.helpers.getHeadings(opts.$scope, topLevel); 149 | this.helpers.populateNav($topContext, topLevel, $headings); 150 | } 151 | }; 152 | 153 | $(function() { 154 | $('nav[data-toggle="toc"]').each(function(i, el) { 155 | var $nav = $(el); 156 | Toc.init($nav); 157 | }); 158 | }); 159 | })(); 160 | -------------------------------------------------------------------------------- /docs/docsearch.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | 3 | // register a handler to move the focus to the search bar 4 | // upon pressing shift + "/" (i.e. "?") 5 | $(document).on('keydown', function(e) { 6 | if (e.shiftKey && e.keyCode == 191) { 7 | e.preventDefault(); 8 | $("#search-input").focus(); 9 | } 10 | }); 11 | 12 | $(document).ready(function() { 13 | // do keyword highlighting 14 | /* modified from https://jsfiddle.net/julmot/bL6bb5oo/ */ 15 | var mark = function() { 16 | 17 | var referrer = document.URL ; 18 | var paramKey = "q" ; 19 | 20 | if (referrer.indexOf("?") !== -1) { 21 | var qs = referrer.substr(referrer.indexOf('?') + 1); 22 | var qs_noanchor = qs.split('#')[0]; 23 | var qsa = qs_noanchor.split('&'); 24 | var keyword = ""; 25 | 26 | for (var i = 0; i < qsa.length; i++) { 27 | var currentParam = qsa[i].split('='); 28 | 29 | if (currentParam.length !== 2) { 30 | continue; 31 | } 32 | 33 | if (currentParam[0] == paramKey) { 34 | keyword = decodeURIComponent(currentParam[1].replace(/\+/g, "%20")); 35 | } 36 | } 37 | 38 | if (keyword !== "") { 39 | $(".contents").unmark({ 40 | done: function() { 41 | $(".contents").mark(keyword); 42 | } 43 | }); 44 | } 45 | } 46 | }; 47 | 48 | mark(); 49 | }); 50 | }); 51 | 52 | /* Search term highlighting ------------------------------*/ 53 | 54 | function matchedWords(hit) { 55 | var words = []; 56 | 57 | var hierarchy = hit._highlightResult.hierarchy; 58 | // loop to fetch from lvl0, lvl1, etc. 59 | for (var idx in hierarchy) { 60 | words = words.concat(hierarchy[idx].matchedWords); 61 | } 62 | 63 | var content = hit._highlightResult.content; 64 | if (content) { 65 | words = words.concat(content.matchedWords); 66 | } 67 | 68 | // return unique words 69 | var words_uniq = [...new Set(words)]; 70 | return words_uniq; 71 | } 72 | 73 | function updateHitURL(hit) { 74 | 75 | var words = matchedWords(hit); 76 | var url = ""; 77 | 78 | if (hit.anchor) { 79 | url = hit.url_without_anchor + '?q=' + escape(words.join(" ")) + '#' + hit.anchor; 80 | } else { 81 | url = hit.url + '?q=' + escape(words.join(" ")); 82 | } 83 | 84 | return url; 85 | } 86 | -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Perform Phylogenetic Path Analysis • phylopath 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 20 | 21 | 22 | 23 | 24 |
    25 |
    74 | 75 | 76 | 77 | 78 |
    79 |
    80 |
    81 | 83 |

    Use the phylopath package for an easy to use framework to perform phylogenetic path analysis (PPA).

    84 |

    PPA can be used to compare support for competing causal models of trait evolution, while taking shared ancestry into account. All you need is: 1. A clear set of models to test. 2. A data set of species with trait values. 3. A phylogeny of your species.

    85 |

    For a complete worked example, click “Get Started” above, or see the PeerJ paper.

    86 |

    This method was developed by Von Hardenberg and Gonzalez-Voyer. See citation() for info on correct citations.

    87 |

    88 |

    89 |

    phylopath has been used by >100 publications so far!

    90 |
    91 |
    92 | 93 | 128 |
    129 | 130 | 131 |
    135 | 136 |
    137 |

    138 |

    Site built with pkgdown 2.0.9.

    139 |
    140 | 141 |
    142 |
    143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | -------------------------------------------------------------------------------- /docs/index_files/figure-html/unnamed-chunk-2-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/index_files/figure-html/unnamed-chunk-2-1.png -------------------------------------------------------------------------------- /docs/index_files/figure-html/unnamed-chunk-3-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/index_files/figure-html/unnamed-chunk-3-1.png -------------------------------------------------------------------------------- /docs/jquery.sticky-kit.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | Sticky-kit v1.1.2 | WTFPL | Leaf Corcoran 2015 | http://leafo.net 3 | */ 4 | (function(){var b,f;b=this.jQuery||window.jQuery;f=b(window);b.fn.stick_in_parent=function(d){var A,w,J,n,B,K,p,q,k,E,t;null==d&&(d={});t=d.sticky_class;B=d.inner_scrolling;E=d.recalc_every;k=d.parent;q=d.offset_top;p=d.spacer;w=d.bottoming;null==q&&(q=0);null==k&&(k=void 0);null==B&&(B=!0);null==t&&(t="is_stuck");A=b(document);null==w&&(w=!0);J=function(a,d,n,C,F,u,r,G){var v,H,m,D,I,c,g,x,y,z,h,l;if(!a.data("sticky_kit")){a.data("sticky_kit",!0);I=A.height();g=a.parent();null!=k&&(g=g.closest(k)); 5 | if(!g.length)throw"failed to find stick parent";v=m=!1;(h=null!=p?p&&a.closest(p):b("
    "))&&h.css("position",a.css("position"));x=function(){var c,f,e;if(!G&&(I=A.height(),c=parseInt(g.css("border-top-width"),10),f=parseInt(g.css("padding-top"),10),d=parseInt(g.css("padding-bottom"),10),n=g.offset().top+c+f,C=g.height(),m&&(v=m=!1,null==p&&(a.insertAfter(h),h.detach()),a.css({position:"",top:"",width:"",bottom:""}).removeClass(t),e=!0),F=a.offset().top-(parseInt(a.css("margin-top"),10)||0)-q, 6 | u=a.outerHeight(!0),r=a.css("float"),h&&h.css({width:a.outerWidth(!0),height:u,display:a.css("display"),"vertical-align":a.css("vertical-align"),"float":r}),e))return l()};x();if(u!==C)return D=void 0,c=q,z=E,l=function(){var b,l,e,k;if(!G&&(e=!1,null!=z&&(--z,0>=z&&(z=E,x(),e=!0)),e||A.height()===I||x(),e=f.scrollTop(),null!=D&&(l=e-D),D=e,m?(w&&(k=e+u+c>C+n,v&&!k&&(v=!1,a.css({position:"fixed",bottom:"",top:c}).trigger("sticky_kit:unbottom"))),eb&&!v&&(c-=l,c=Math.max(b-u,c),c=Math.min(q,c),m&&a.css({top:c+"px"})))):e>F&&(m=!0,b={position:"fixed",top:c},b.width="border-box"===a.css("box-sizing")?a.outerWidth()+"px":a.width()+"px",a.css(b).addClass(t),null==p&&(a.after(h),"left"!==r&&"right"!==r||h.append(a)),a.trigger("sticky_kit:stick")),m&&w&&(null==k&&(k=e+u+c>C+n),!v&&k)))return v=!0,"static"===g.css("position")&&g.css({position:"relative"}), 8 | a.css({position:"absolute",bottom:d,top:"auto"}).trigger("sticky_kit:bottom")},y=function(){x();return l()},H=function(){G=!0;f.off("touchmove",l);f.off("scroll",l);f.off("resize",y);b(document.body).off("sticky_kit:recalc",y);a.off("sticky_kit:detach",H);a.removeData("sticky_kit");a.css({position:"",bottom:"",top:"",width:""});g.position("position","");if(m)return null==p&&("left"!==r&&"right"!==r||a.insertAfter(h),h.remove()),a.removeClass(t)},f.on("touchmove",l),f.on("scroll",l),f.on("resize", 9 | y),b(document.body).on("sticky_kit:recalc",y),a.on("sticky_kit:detach",H),setTimeout(l,0)}};n=0;for(K=this.length;n 2 | 3 | 5 | 8 | 12 | 13 | -------------------------------------------------------------------------------- /docs/pkgdown.css: -------------------------------------------------------------------------------- 1 | /* Sticky footer */ 2 | 3 | /** 4 | * Basic idea: https://philipwalton.github.io/solved-by-flexbox/demos/sticky-footer/ 5 | * Details: https://github.com/philipwalton/solved-by-flexbox/blob/master/assets/css/components/site.css 6 | * 7 | * .Site -> body > .container 8 | * .Site-content -> body > .container .row 9 | * .footer -> footer 10 | * 11 | * Key idea seems to be to ensure that .container and __all its parents__ 12 | * have height set to 100% 13 | * 14 | */ 15 | 16 | html, body { 17 | height: 100%; 18 | } 19 | 20 | body { 21 | position: relative; 22 | } 23 | 24 | body > .container { 25 | display: flex; 26 | height: 100%; 27 | flex-direction: column; 28 | } 29 | 30 | body > .container .row { 31 | flex: 1 0 auto; 32 | } 33 | 34 | footer { 35 | margin-top: 45px; 36 | padding: 35px 0 36px; 37 | border-top: 1px solid #e5e5e5; 38 | color: #666; 39 | display: flex; 40 | flex-shrink: 0; 41 | } 42 | footer p { 43 | margin-bottom: 0; 44 | } 45 | footer div { 46 | flex: 1; 47 | } 48 | footer .pkgdown { 49 | text-align: right; 50 | } 51 | footer p { 52 | margin-bottom: 0; 53 | } 54 | 55 | img.icon { 56 | float: right; 57 | } 58 | 59 | /* Ensure in-page images don't run outside their container */ 60 | .contents img { 61 | max-width: 100%; 62 | height: auto; 63 | } 64 | 65 | /* Fix bug in bootstrap (only seen in firefox) */ 66 | summary { 67 | display: list-item; 68 | } 69 | 70 | /* Typographic tweaking ---------------------------------*/ 71 | 72 | .contents .page-header { 73 | margin-top: calc(-60px + 1em); 74 | } 75 | 76 | dd { 77 | margin-left: 3em; 78 | } 79 | 80 | /* Section anchors ---------------------------------*/ 81 | 82 | a.anchor { 83 | display: none; 84 | margin-left: 5px; 85 | width: 20px; 86 | height: 20px; 87 | 88 | background-image: url(./link.svg); 89 | background-repeat: no-repeat; 90 | background-size: 20px 20px; 91 | background-position: center center; 92 | } 93 | 94 | h1:hover .anchor, 95 | h2:hover .anchor, 96 | h3:hover .anchor, 97 | h4:hover .anchor, 98 | h5:hover .anchor, 99 | h6:hover .anchor { 100 | display: inline-block; 101 | } 102 | 103 | /* Fixes for fixed navbar --------------------------*/ 104 | 105 | .contents h1, .contents h2, .contents h3, .contents h4 { 106 | padding-top: 60px; 107 | margin-top: -40px; 108 | } 109 | 110 | /* Navbar submenu --------------------------*/ 111 | 112 | .dropdown-submenu { 113 | position: relative; 114 | } 115 | 116 | .dropdown-submenu>.dropdown-menu { 117 | top: 0; 118 | left: 100%; 119 | margin-top: -6px; 120 | margin-left: -1px; 121 | border-radius: 0 6px 6px 6px; 122 | } 123 | 124 | .dropdown-submenu:hover>.dropdown-menu { 125 | display: block; 126 | } 127 | 128 | .dropdown-submenu>a:after { 129 | display: block; 130 | content: " "; 131 | float: right; 132 | width: 0; 133 | height: 0; 134 | border-color: transparent; 135 | border-style: solid; 136 | border-width: 5px 0 5px 5px; 137 | border-left-color: #cccccc; 138 | margin-top: 5px; 139 | margin-right: -10px; 140 | } 141 | 142 | .dropdown-submenu:hover>a:after { 143 | border-left-color: #ffffff; 144 | } 145 | 146 | .dropdown-submenu.pull-left { 147 | float: none; 148 | } 149 | 150 | .dropdown-submenu.pull-left>.dropdown-menu { 151 | left: -100%; 152 | margin-left: 10px; 153 | border-radius: 6px 0 6px 6px; 154 | } 155 | 156 | /* Sidebar --------------------------*/ 157 | 158 | #pkgdown-sidebar { 159 | margin-top: 30px; 160 | position: -webkit-sticky; 161 | position: sticky; 162 | top: 70px; 163 | } 164 | 165 | #pkgdown-sidebar h2 { 166 | font-size: 1.5em; 167 | margin-top: 1em; 168 | } 169 | 170 | #pkgdown-sidebar h2:first-child { 171 | margin-top: 0; 172 | } 173 | 174 | #pkgdown-sidebar .list-unstyled li { 175 | margin-bottom: 0.5em; 176 | } 177 | 178 | /* bootstrap-toc tweaks ------------------------------------------------------*/ 179 | 180 | /* All levels of nav */ 181 | 182 | nav[data-toggle='toc'] .nav > li > a { 183 | padding: 4px 20px 4px 6px; 184 | font-size: 1.5rem; 185 | font-weight: 400; 186 | color: inherit; 187 | } 188 | 189 | nav[data-toggle='toc'] .nav > li > a:hover, 190 | nav[data-toggle='toc'] .nav > li > a:focus { 191 | padding-left: 5px; 192 | color: inherit; 193 | border-left: 1px solid #878787; 194 | } 195 | 196 | nav[data-toggle='toc'] .nav > .active > a, 197 | nav[data-toggle='toc'] .nav > .active:hover > a, 198 | nav[data-toggle='toc'] .nav > .active:focus > a { 199 | padding-left: 5px; 200 | font-size: 1.5rem; 201 | font-weight: 400; 202 | color: inherit; 203 | border-left: 2px solid #878787; 204 | } 205 | 206 | /* Nav: second level (shown on .active) */ 207 | 208 | nav[data-toggle='toc'] .nav .nav { 209 | display: none; /* Hide by default, but at >768px, show it */ 210 | padding-bottom: 10px; 211 | } 212 | 213 | nav[data-toggle='toc'] .nav .nav > li > a { 214 | padding-left: 16px; 215 | font-size: 1.35rem; 216 | } 217 | 218 | nav[data-toggle='toc'] .nav .nav > li > a:hover, 219 | nav[data-toggle='toc'] .nav .nav > li > a:focus { 220 | padding-left: 15px; 221 | } 222 | 223 | nav[data-toggle='toc'] .nav .nav > .active > a, 224 | nav[data-toggle='toc'] .nav .nav > .active:hover > a, 225 | nav[data-toggle='toc'] .nav .nav > .active:focus > a { 226 | padding-left: 15px; 227 | font-weight: 500; 228 | font-size: 1.35rem; 229 | } 230 | 231 | /* orcid ------------------------------------------------------------------- */ 232 | 233 | .orcid { 234 | font-size: 16px; 235 | color: #A6CE39; 236 | /* margins are required by official ORCID trademark and display guidelines */ 237 | margin-left:4px; 238 | margin-right:4px; 239 | vertical-align: middle; 240 | } 241 | 242 | /* Reference index & topics ----------------------------------------------- */ 243 | 244 | .ref-index th {font-weight: normal;} 245 | 246 | .ref-index td {vertical-align: top; min-width: 100px} 247 | .ref-index .icon {width: 40px;} 248 | .ref-index .alias {width: 40%;} 249 | .ref-index-icons .alias {width: calc(40% - 40px);} 250 | .ref-index .title {width: 60%;} 251 | 252 | .ref-arguments th {text-align: right; padding-right: 10px;} 253 | .ref-arguments th, .ref-arguments td {vertical-align: top; min-width: 100px} 254 | .ref-arguments .name {width: 20%;} 255 | .ref-arguments .desc {width: 80%;} 256 | 257 | /* Nice scrolling for wide elements --------------------------------------- */ 258 | 259 | table { 260 | display: block; 261 | overflow: auto; 262 | } 263 | 264 | /* Syntax highlighting ---------------------------------------------------- */ 265 | 266 | pre, code, pre code { 267 | background-color: #f8f8f8; 268 | color: #333; 269 | } 270 | pre, pre code { 271 | white-space: pre-wrap; 272 | word-break: break-all; 273 | overflow-wrap: break-word; 274 | } 275 | 276 | pre { 277 | border: 1px solid #eee; 278 | } 279 | 280 | pre .img, pre .r-plt { 281 | margin: 5px 0; 282 | } 283 | 284 | pre .img img, pre .r-plt img { 285 | background-color: #fff; 286 | } 287 | 288 | code a, pre a { 289 | color: #375f84; 290 | } 291 | 292 | a.sourceLine:hover { 293 | text-decoration: none; 294 | } 295 | 296 | .fl {color: #1514b5;} 297 | .fu {color: #000000;} /* function */ 298 | .ch,.st {color: #036a07;} /* string */ 299 | .kw {color: #264D66;} /* keyword */ 300 | .co {color: #888888;} /* comment */ 301 | 302 | .error {font-weight: bolder;} 303 | .warning {font-weight: bolder;} 304 | 305 | /* Clipboard --------------------------*/ 306 | 307 | .hasCopyButton { 308 | position: relative; 309 | } 310 | 311 | .btn-copy-ex { 312 | position: absolute; 313 | right: 0; 314 | top: 0; 315 | visibility: hidden; 316 | } 317 | 318 | .hasCopyButton:hover button.btn-copy-ex { 319 | visibility: visible; 320 | } 321 | 322 | /* headroom.js ------------------------ */ 323 | 324 | .headroom { 325 | will-change: transform; 326 | transition: transform 200ms linear; 327 | } 328 | .headroom--pinned { 329 | transform: translateY(0%); 330 | } 331 | .headroom--unpinned { 332 | transform: translateY(-100%); 333 | } 334 | 335 | /* mark.js ----------------------------*/ 336 | 337 | mark { 338 | background-color: rgba(255, 255, 51, 0.5); 339 | border-bottom: 2px solid rgba(255, 153, 51, 0.3); 340 | padding: 1px; 341 | } 342 | 343 | /* vertical spacing after htmlwidgets */ 344 | .html-widget { 345 | margin-bottom: 10px; 346 | } 347 | 348 | /* fontawesome ------------------------ */ 349 | 350 | .fab { 351 | font-family: "Font Awesome 5 Brands" !important; 352 | } 353 | 354 | /* don't display links in code chunks when printing */ 355 | /* source: https://stackoverflow.com/a/10781533 */ 356 | @media print { 357 | code a:link:after, code a:visited:after { 358 | content: ""; 359 | } 360 | } 361 | 362 | /* Section anchors --------------------------------- 363 | Added in pandoc 2.11: https://github.com/jgm/pandoc-templates/commit/9904bf71 364 | */ 365 | 366 | div.csl-bib-body { } 367 | div.csl-entry { 368 | clear: both; 369 | } 370 | .hanging-indent div.csl-entry { 371 | margin-left:2em; 372 | text-indent:-2em; 373 | } 374 | div.csl-left-margin { 375 | min-width:2em; 376 | float:left; 377 | } 378 | div.csl-right-inline { 379 | margin-left:2em; 380 | padding-left:1em; 381 | } 382 | div.csl-indent { 383 | margin-left: 2em; 384 | } 385 | -------------------------------------------------------------------------------- /docs/pkgdown.js: -------------------------------------------------------------------------------- 1 | /* http://gregfranko.com/blog/jquery-best-practices/ */ 2 | (function($) { 3 | $(function() { 4 | 5 | $('.navbar-fixed-top').headroom(); 6 | 7 | $('body').css('padding-top', $('.navbar').height() + 10); 8 | $(window).resize(function(){ 9 | $('body').css('padding-top', $('.navbar').height() + 10); 10 | }); 11 | 12 | $('[data-toggle="tooltip"]').tooltip(); 13 | 14 | var cur_path = paths(location.pathname); 15 | var links = $("#navbar ul li a"); 16 | var max_length = -1; 17 | var pos = -1; 18 | for (var i = 0; i < links.length; i++) { 19 | if (links[i].getAttribute("href") === "#") 20 | continue; 21 | // Ignore external links 22 | if (links[i].host !== location.host) 23 | continue; 24 | 25 | var nav_path = paths(links[i].pathname); 26 | 27 | var length = prefix_length(nav_path, cur_path); 28 | if (length > max_length) { 29 | max_length = length; 30 | pos = i; 31 | } 32 | } 33 | 34 | // Add class to parent
  • , and enclosing
  • if in dropdown 35 | if (pos >= 0) { 36 | var menu_anchor = $(links[pos]); 37 | menu_anchor.parent().addClass("active"); 38 | menu_anchor.closest("li.dropdown").addClass("active"); 39 | } 40 | }); 41 | 42 | function paths(pathname) { 43 | var pieces = pathname.split("/"); 44 | pieces.shift(); // always starts with / 45 | 46 | var end = pieces[pieces.length - 1]; 47 | if (end === "index.html" || end === "") 48 | pieces.pop(); 49 | return(pieces); 50 | } 51 | 52 | // Returns -1 if not found 53 | function prefix_length(needle, haystack) { 54 | if (needle.length > haystack.length) 55 | return(-1); 56 | 57 | // Special case for length-0 haystack, since for loop won't run 58 | if (haystack.length === 0) { 59 | return(needle.length === 0 ? 0 : -1); 60 | } 61 | 62 | for (var i = 0; i < haystack.length; i++) { 63 | if (needle[i] != haystack[i]) 64 | return(i); 65 | } 66 | 67 | return(haystack.length); 68 | } 69 | 70 | /* Clipboard --------------------------*/ 71 | 72 | function changeTooltipMessage(element, msg) { 73 | var tooltipOriginalTitle=element.getAttribute('data-original-title'); 74 | element.setAttribute('data-original-title', msg); 75 | $(element).tooltip('show'); 76 | element.setAttribute('data-original-title', tooltipOriginalTitle); 77 | } 78 | 79 | if(ClipboardJS.isSupported()) { 80 | $(document).ready(function() { 81 | var copyButton = ""; 82 | 83 | $("div.sourceCode").addClass("hasCopyButton"); 84 | 85 | // Insert copy buttons: 86 | $(copyButton).prependTo(".hasCopyButton"); 87 | 88 | // Initialize tooltips: 89 | $('.btn-copy-ex').tooltip({container: 'body'}); 90 | 91 | // Initialize clipboard: 92 | var clipboardBtnCopies = new ClipboardJS('[data-clipboard-copy]', { 93 | text: function(trigger) { 94 | return trigger.parentNode.textContent.replace(/\n#>[^\n]*/g, ""); 95 | } 96 | }); 97 | 98 | clipboardBtnCopies.on('success', function(e) { 99 | changeTooltipMessage(e.trigger, 'Copied!'); 100 | e.clearSelection(); 101 | }); 102 | 103 | clipboardBtnCopies.on('error', function() { 104 | changeTooltipMessage(e.trigger,'Press Ctrl+C or Command+C to copy'); 105 | }); 106 | }); 107 | } 108 | })(window.jQuery || window.$) 109 | -------------------------------------------------------------------------------- /docs/pkgdown.yml: -------------------------------------------------------------------------------- 1 | pandoc: 3.1.11 2 | pkgdown: 2.0.9 3 | pkgdown_sha: ~ 4 | articles: 5 | binary_models: binary_models.html 6 | intro_to_phylopath: intro_to_phylopath.html 7 | last_built: 2024-06-11T22:11Z 8 | 9 | -------------------------------------------------------------------------------- /docs/reference/DAG-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/DAG-1.png -------------------------------------------------------------------------------- /docs/reference/DAG-10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/DAG-10.png -------------------------------------------------------------------------------- /docs/reference/DAG-11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/DAG-11.png -------------------------------------------------------------------------------- /docs/reference/DAG-12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/DAG-12.png -------------------------------------------------------------------------------- /docs/reference/DAG-13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/DAG-13.png -------------------------------------------------------------------------------- /docs/reference/DAG-14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/DAG-14.png -------------------------------------------------------------------------------- /docs/reference/DAG-15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/DAG-15.png -------------------------------------------------------------------------------- /docs/reference/DAG-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/DAG-16.png -------------------------------------------------------------------------------- /docs/reference/DAG-17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/DAG-17.png -------------------------------------------------------------------------------- /docs/reference/DAG-18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/DAG-18.png -------------------------------------------------------------------------------- /docs/reference/DAG-19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/DAG-19.png -------------------------------------------------------------------------------- /docs/reference/DAG-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/DAG-2.png -------------------------------------------------------------------------------- /docs/reference/DAG-20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/DAG-20.png -------------------------------------------------------------------------------- /docs/reference/DAG-21.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/DAG-21.png -------------------------------------------------------------------------------- /docs/reference/DAG-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/DAG-3.png -------------------------------------------------------------------------------- /docs/reference/DAG-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/DAG-4.png -------------------------------------------------------------------------------- /docs/reference/DAG-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/DAG-5.png -------------------------------------------------------------------------------- /docs/reference/DAG-6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/DAG-6.png -------------------------------------------------------------------------------- /docs/reference/DAG-7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/DAG-7.png -------------------------------------------------------------------------------- /docs/reference/DAG-8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/DAG-8.png -------------------------------------------------------------------------------- /docs/reference/DAG-9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/DAG-9.png -------------------------------------------------------------------------------- /docs/reference/Rplot001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/Rplot001.png -------------------------------------------------------------------------------- /docs/reference/Rplot002.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/Rplot002.png -------------------------------------------------------------------------------- /docs/reference/Rplot003.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/Rplot003.png -------------------------------------------------------------------------------- /docs/reference/Rplot004.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/Rplot004.png -------------------------------------------------------------------------------- /docs/reference/average-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/average-1.png -------------------------------------------------------------------------------- /docs/reference/average-10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/average-10.png -------------------------------------------------------------------------------- /docs/reference/average-11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/average-11.png -------------------------------------------------------------------------------- /docs/reference/average-12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/average-12.png -------------------------------------------------------------------------------- /docs/reference/average-13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/average-13.png -------------------------------------------------------------------------------- /docs/reference/average-14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/average-14.png -------------------------------------------------------------------------------- /docs/reference/average-15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/average-15.png -------------------------------------------------------------------------------- /docs/reference/average-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/average-16.png -------------------------------------------------------------------------------- /docs/reference/average-17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/average-17.png -------------------------------------------------------------------------------- /docs/reference/average-18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/average-18.png -------------------------------------------------------------------------------- /docs/reference/average-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/average-2.png -------------------------------------------------------------------------------- /docs/reference/average-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/average-3.png -------------------------------------------------------------------------------- /docs/reference/average-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/average-4.png -------------------------------------------------------------------------------- /docs/reference/average-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/average-5.png -------------------------------------------------------------------------------- /docs/reference/average-6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/average-6.png -------------------------------------------------------------------------------- /docs/reference/average-7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/average-7.png -------------------------------------------------------------------------------- /docs/reference/average-8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/average-8.png -------------------------------------------------------------------------------- /docs/reference/average-9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/average-9.png -------------------------------------------------------------------------------- /docs/reference/average_DAGs-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/average_DAGs-1.png -------------------------------------------------------------------------------- /docs/reference/average_DAGs-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/average_DAGs-2.png -------------------------------------------------------------------------------- /docs/reference/average_DAGs-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/average_DAGs-3.png -------------------------------------------------------------------------------- /docs/reference/average_DAGs-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/average_DAGs-4.png -------------------------------------------------------------------------------- /docs/reference/average_DAGs-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/average_DAGs-5.png -------------------------------------------------------------------------------- /docs/reference/average_DAGs-6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/average_DAGs-6.png -------------------------------------------------------------------------------- /docs/reference/average_DAGs-7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/average_DAGs-7.png -------------------------------------------------------------------------------- /docs/reference/best-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/best-1.png -------------------------------------------------------------------------------- /docs/reference/best-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/best-2.png -------------------------------------------------------------------------------- /docs/reference/best-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/best-3.png -------------------------------------------------------------------------------- /docs/reference/best-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/best-4.png -------------------------------------------------------------------------------- /docs/reference/best-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/best-5.png -------------------------------------------------------------------------------- /docs/reference/best-6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/best-6.png -------------------------------------------------------------------------------- /docs/reference/best-7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/best-7.png -------------------------------------------------------------------------------- /docs/reference/choice-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/choice-1.png -------------------------------------------------------------------------------- /docs/reference/choice-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/choice-2.png -------------------------------------------------------------------------------- /docs/reference/choice-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/choice-3.png -------------------------------------------------------------------------------- /docs/reference/choice-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/choice-4.png -------------------------------------------------------------------------------- /docs/reference/choice-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/choice-5.png -------------------------------------------------------------------------------- /docs/reference/choice-6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/choice-6.png -------------------------------------------------------------------------------- /docs/reference/choice-7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/choice-7.png -------------------------------------------------------------------------------- /docs/reference/cichlids.html: -------------------------------------------------------------------------------- 1 | 2 | Cichlid traits and the evolution of cooperative breeding. — cichlids • phylopath 10 | 11 | 12 |
    13 |
    56 | 57 | 58 | 59 |
    60 |
    61 | 66 | 67 |
    68 |

    A data set with binary traits, used in an analysis on the evolution of 69 | cooperative breeding by Dey et al 2017. Variable names are shortened for 70 | easy of use and consist of cooperative breeding (C), mating system (M), 71 | parental care (P), social grouping (G) and diet (D). All traits are coded as 72 | two level factors.

    73 |
    74 | 75 |
    76 |
    cichlids
    77 |
    78 | 79 |
    80 |

    Format

    81 |

    An object of class data.frame with 69 rows and 5 columns.

    82 |
    83 |
    84 |

    Source

    85 |

    Dey, C.J., O'Connor, C.M., Wilkinson, H., Shultz, S., Balshine, S. & 86 | Fitzpatrick, J.L. 2017. Direct benefits and evolutionary transitions to 87 | complex societies. Nat Ecol Evol 1: 137.

    88 |
    89 | 90 |
    91 | 94 |
    95 | 96 | 97 |
    100 | 101 |
    102 |

    Site built with pkgdown 2.0.9.

    103 |
    104 | 105 |
    106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /docs/reference/cichlids_tree.html: -------------------------------------------------------------------------------- 1 | 2 | Cichlid phylogeny. — cichlids_tree • phylopath 8 | 9 | 10 |
    11 |
    54 | 55 | 56 | 57 |
    58 |
    59 | 64 | 65 |
    66 |

    The phylogenetic tree of cichlid species that accompanies the cichlids 67 | dataset. The phylogeny is based on five nuclear genes and three 68 | mitochondrial genes.

    69 |
    70 | 71 |
    72 |
    cichlids_tree
    73 |
    74 | 75 |
    76 |

    Format

    77 |

    An object of class phylo of length 4.

    78 |
    79 |
    80 |

    Source

    81 |

    Dey, C.J., O'Connor, C.M., Wilkinson, H., Shultz, S., Balshine, S. & 82 | Fitzpatrick, J.L. 2017. Direct benefits and evolutionary transitions to 83 | complex societies. Nat Ecol Evol 1: 137.

    84 |
    85 | 86 |
    87 | 90 |
    91 | 92 | 93 |
    96 | 97 |
    98 |

    Site built with pkgdown 2.0.9.

    99 |
    100 | 101 |
    102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | -------------------------------------------------------------------------------- /docs/reference/coef_plot-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/coef_plot-1.png -------------------------------------------------------------------------------- /docs/reference/coef_plot-10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/coef_plot-10.png -------------------------------------------------------------------------------- /docs/reference/coef_plot-11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/coef_plot-11.png -------------------------------------------------------------------------------- /docs/reference/coef_plot-12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/coef_plot-12.png -------------------------------------------------------------------------------- /docs/reference/coef_plot-13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/coef_plot-13.png -------------------------------------------------------------------------------- /docs/reference/coef_plot-14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/coef_plot-14.png -------------------------------------------------------------------------------- /docs/reference/coef_plot-15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/coef_plot-15.png -------------------------------------------------------------------------------- /docs/reference/coef_plot-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/coef_plot-16.png -------------------------------------------------------------------------------- /docs/reference/coef_plot-17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/coef_plot-17.png -------------------------------------------------------------------------------- /docs/reference/coef_plot-18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/coef_plot-18.png -------------------------------------------------------------------------------- /docs/reference/coef_plot-19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/coef_plot-19.png -------------------------------------------------------------------------------- /docs/reference/coef_plot-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/coef_plot-2.png -------------------------------------------------------------------------------- /docs/reference/coef_plot-20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/coef_plot-20.png -------------------------------------------------------------------------------- /docs/reference/coef_plot-21.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/coef_plot-21.png -------------------------------------------------------------------------------- /docs/reference/coef_plot-22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/coef_plot-22.png -------------------------------------------------------------------------------- /docs/reference/coef_plot-23.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/coef_plot-23.png -------------------------------------------------------------------------------- /docs/reference/coef_plot-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/coef_plot-24.png -------------------------------------------------------------------------------- /docs/reference/coef_plot-25.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/coef_plot-25.png -------------------------------------------------------------------------------- /docs/reference/coef_plot-26.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/coef_plot-26.png -------------------------------------------------------------------------------- /docs/reference/coef_plot-27.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/coef_plot-27.png -------------------------------------------------------------------------------- /docs/reference/coef_plot-28.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/coef_plot-28.png -------------------------------------------------------------------------------- /docs/reference/coef_plot-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/coef_plot-3.png -------------------------------------------------------------------------------- /docs/reference/coef_plot-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/coef_plot-4.png -------------------------------------------------------------------------------- /docs/reference/coef_plot-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/coef_plot-5.png -------------------------------------------------------------------------------- /docs/reference/coef_plot-6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/coef_plot-6.png -------------------------------------------------------------------------------- /docs/reference/coef_plot-7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/coef_plot-7.png -------------------------------------------------------------------------------- /docs/reference/coef_plot-8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/coef_plot-8.png -------------------------------------------------------------------------------- /docs/reference/coef_plot-9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/coef_plot-9.png -------------------------------------------------------------------------------- /docs/reference/define_model_set-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/define_model_set-1.png -------------------------------------------------------------------------------- /docs/reference/est_DAG-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/est_DAG-1.png -------------------------------------------------------------------------------- /docs/reference/est_DAG-10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/est_DAG-10.png -------------------------------------------------------------------------------- /docs/reference/est_DAG-11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/est_DAG-11.png -------------------------------------------------------------------------------- /docs/reference/est_DAG-12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/est_DAG-12.png -------------------------------------------------------------------------------- /docs/reference/est_DAG-13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/est_DAG-13.png -------------------------------------------------------------------------------- /docs/reference/est_DAG-14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/est_DAG-14.png -------------------------------------------------------------------------------- /docs/reference/est_DAG-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/est_DAG-2.png -------------------------------------------------------------------------------- /docs/reference/est_DAG-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/est_DAG-3.png -------------------------------------------------------------------------------- /docs/reference/est_DAG-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/est_DAG-4.png -------------------------------------------------------------------------------- /docs/reference/est_DAG-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/est_DAG-5.png -------------------------------------------------------------------------------- /docs/reference/est_DAG-6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/est_DAG-6.png -------------------------------------------------------------------------------- /docs/reference/est_DAG-7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/est_DAG-7.png -------------------------------------------------------------------------------- /docs/reference/est_DAG-8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/est_DAG-8.png -------------------------------------------------------------------------------- /docs/reference/est_DAG-9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/est_DAG-9.png -------------------------------------------------------------------------------- /docs/reference/est_DAG_binary.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/est_DAG_binary.html -------------------------------------------------------------------------------- /docs/reference/figures/unnamed-chunk-2-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/figures/unnamed-chunk-2-1.png -------------------------------------------------------------------------------- /docs/reference/figures/unnamed-chunk-3-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/figures/unnamed-chunk-3-1.png -------------------------------------------------------------------------------- /docs/reference/phylo_path_binary.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/phylo_path_binary.html -------------------------------------------------------------------------------- /docs/reference/plot.DAG-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/plot.DAG-1.png -------------------------------------------------------------------------------- /docs/reference/plot.DAG-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/plot.DAG-2.png -------------------------------------------------------------------------------- /docs/reference/plot.DAG-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/plot.DAG-3.png -------------------------------------------------------------------------------- /docs/reference/plot.fitted_DAG-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/plot.fitted_DAG-1.png -------------------------------------------------------------------------------- /docs/reference/plot.fitted_DAG-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/plot.fitted_DAG-2.png -------------------------------------------------------------------------------- /docs/reference/plot.fitted_DAG-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/plot.fitted_DAG-3.png -------------------------------------------------------------------------------- /docs/reference/plot_model_set-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/plot_model_set-1.png -------------------------------------------------------------------------------- /docs/reference/plot_model_set-10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/plot_model_set-10.png -------------------------------------------------------------------------------- /docs/reference/plot_model_set-11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/plot_model_set-11.png -------------------------------------------------------------------------------- /docs/reference/plot_model_set-12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/plot_model_set-12.png -------------------------------------------------------------------------------- /docs/reference/plot_model_set-13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/plot_model_set-13.png -------------------------------------------------------------------------------- /docs/reference/plot_model_set-14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/plot_model_set-14.png -------------------------------------------------------------------------------- /docs/reference/plot_model_set-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/plot_model_set-2.png -------------------------------------------------------------------------------- /docs/reference/plot_model_set-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/plot_model_set-3.png -------------------------------------------------------------------------------- /docs/reference/plot_model_set-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/plot_model_set-4.png -------------------------------------------------------------------------------- /docs/reference/plot_model_set-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/plot_model_set-5.png -------------------------------------------------------------------------------- /docs/reference/plot_model_set-6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/plot_model_set-6.png -------------------------------------------------------------------------------- /docs/reference/plot_model_set-7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/plot_model_set-7.png -------------------------------------------------------------------------------- /docs/reference/plot_model_set-8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/plot_model_set-8.png -------------------------------------------------------------------------------- /docs/reference/plot_model_set-9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/plot_model_set-9.png -------------------------------------------------------------------------------- /docs/reference/red_list.html: -------------------------------------------------------------------------------- 1 | 2 | Data on brain size, life history and vulnerability to extinction — red_list • phylopath 7 | 8 | 9 |
    10 |
    53 | 54 | 55 | 56 |
    57 |
    58 | 63 | 64 |
    65 |

    A dataset with continuous variables affecting the conservation Status of 66 | mammalian species (the IUCN red list of threatened species).

    67 |
    68 | 69 |
    70 |
    red_list
    71 |
    72 | 73 |
    74 |

    Format

    75 |

    An object of class data.frame with 474 rows and 7 columns.

    76 |
    77 |
    78 |

    Source

    79 |

    Gonzalez-Voyer A, Gonzalez-Suarez M, Vila C, Revilla E (2016) Larger 80 | brain size indirectly increases vulnerability to extinction in mammals. 81 | Evolution 70:1364-1375. doi: 10.1111/evo.12943

    82 |
    83 |
    84 |

    Details

    85 |

    It includes the following variables: brain size (Br), body size (B), 86 | gestation period (G), litter size (L), weening age (W), population 87 | density (P) and vulnerability to extinction (Status).

    88 |
    89 | 90 |
    91 | 94 |
    95 | 96 | 97 |
    100 | 101 |
    102 |

    Site built with pkgdown 2.0.9.

    103 |
    104 | 105 |
    106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /docs/reference/red_list_tree.html: -------------------------------------------------------------------------------- 1 | 2 | Mammalian phylogeny — red_list_tree • phylopath 8 | 9 | 10 |
    11 |
    54 | 55 | 56 | 57 |
    58 |
    59 | 64 | 65 |
    66 |

    This is the accompanying phylogeny for the red_list data set. It is based 67 | on the updated mammalian supertree by Bininda-Emonds et al. 2007 & Fritz 68 | et al. 2009.

    69 |
    70 | 71 |
    72 |
    red_list_tree
    73 |
    74 | 75 |
    76 |

    Format

    77 |

    An object of class phylo of length 4.

    78 |
    79 |
    80 |

    Source

    81 |

    Gonzalez-Voyer, A. Gonzalez-Suarez M. Vila C. and Revilla E. 2016. 82 | Larger brain size indirectly increases vulnerability to extinction in 83 | mammals. Evolution 70:1364-1375. doi: 10.1111/evo.12943.

    84 |

    Bininda-Emonds, O. R. P., M. Cardillo, K. E. Jones, R. D. E. MacPhee, R. M. D. 85 | Beck, R. Grenyer, S. A. Price, R. A. Vos, J. L. Gittleman, and A. Purvis. 86 | 2007. The delayed rise of present-day mammals. Nature 446:507-512.

    87 |

    Fritz, S. A., O. R. P. Bininda-Emonds, and A. Purvis. 2009. Geographical 88 | variation in predictors of mammalian extinction risk: big is bad, but 89 | only in the tropics. Ecol. Lett. 12:538-549.

    90 |
    91 | 92 |
    93 | 96 |
    97 | 98 | 99 |
    102 | 103 |
    104 |

    Site built with pkgdown 2.0.9.

    105 |
    106 | 107 |
    108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /docs/reference/reexports.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/docs/reference/reexports.html -------------------------------------------------------------------------------- /docs/reference/rhino.html: -------------------------------------------------------------------------------- 1 | 2 | Rhinogrades traits. — rhino • phylopath 8 | 9 | 10 |
    11 |
    54 | 55 | 56 | 57 |
    58 |
    59 | 64 | 65 |
    66 |

    A simulated dataset, as used by Gonzalez-Voyer and Von Hardenberg as an 67 | example, containing variables on body mass (BM), litter size (LS), nose 68 | length (NL), dispersal distance (DD) and range size (RS).

    69 |
    70 | 71 |
    72 |
    rhino
    73 |
    74 | 75 |
    76 |

    Format

    77 |

    An object of class data.frame with 100 rows and 6 columns.

    78 |
    79 |
    80 |

    Source

    81 |

    Gonzalez-Voyer A & von Hardenberg A. 2014. An Introduction to 82 | Phylogenetic Path Analysis. Chapter 8. In: Garamszegi LZ (ed.), Modern 83 | Phylogenetic Comparative Methods and Their Application in Evolutionary 84 | Biology. pp. 201-229. Springer-Verlag Berlin Heidelberg. 85 | doi:10.1111/j.1558-5646.2012.01790.x

    86 |
    87 | 88 |
    89 | 92 |
    93 | 94 | 95 |
    98 | 99 |
    100 |

    Site built with pkgdown 2.0.9.

    101 |
    102 | 103 |
    104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /docs/reference/rhino_tree.html: -------------------------------------------------------------------------------- 1 | 2 | Rhinogrades phylogeny. — rhino_tree • phylopath 6 | 7 | 8 |
    9 |
    52 | 53 | 54 | 55 |
    56 |
    57 | 62 | 63 |
    64 |

    A phylogenetic tree for the 100 species of the rhino dataset.

    65 |
    66 | 67 |
    68 |
    rhino_tree
    69 |
    70 | 71 |
    72 |

    Format

    73 |

    An object of class phylo of length 4.

    74 |
    75 |
    76 |

    Source

    77 |

    Gonzalez-Voyer A & von Hardenberg A. 2014. An Introduction to 78 | Phylogenetic Path Analysis. Chapter 8. In: Garamszegi LZ (ed.), Modern 79 | Phylogenetic Comparative Methods and Their Application in Evolutionary 80 | Biology. pp. 201-229. Springer-Verlag Berlin Heidelberg. 81 | doi:10.1111/j.1558-5646.2012.01790.x

    82 |
    83 | 84 |
    85 | 88 |
    89 | 90 | 91 |
    94 | 95 |
    96 |

    Site built with pkgdown 2.0.9.

    97 |
    98 | 99 |
    100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /docs/reference/show_warnings.html: -------------------------------------------------------------------------------- 1 | 2 | Print out warnings from a phylopath analysis. — show_warnings • phylopath 8 | 9 | 10 |
    11 |
    54 | 55 | 56 | 57 |
    58 |
    59 | 64 | 65 |
    66 |

    Use this function after running phylo_path() to conveniently print any generated warnings 67 | to the screen. You can either provide no arguments, which will only work if you run it directly 68 | after the analysis, or you have to provide the phylopath object manually.

    69 |
    70 | 71 |
    72 |
    show_warnings(phylopath = NULL)
    73 |
    74 | 75 |
    76 |

    Arguments

    77 |
    phylopath
    78 |

    A phylopath object of which the warnings should be printed.

    79 | 80 |
    81 | 82 |
    83 | 86 |
    87 | 88 | 89 |
    92 | 93 |
    94 |

    Site built with pkgdown 2.0.9.

    95 |
    96 | 97 |
    98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | -------------------------------------------------------------------------------- /docs/sitemap.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | /404.html 5 | 6 | 7 | /articles/binary_models.html 8 | 9 | 10 | /articles/index.html 11 | 12 | 13 | /articles/intro_to_phylopath.html 14 | 15 | 16 | /authors.html 17 | 18 | 19 | /index.html 20 | 21 | 22 | /news/index.html 23 | 24 | 25 | /reference/DAG.html 26 | 27 | 28 | /reference/average.html 29 | 30 | 31 | /reference/average_DAGs.html 32 | 33 | 34 | /reference/best.html 35 | 36 | 37 | /reference/choice.html 38 | 39 | 40 | /reference/cichlids.html 41 | 42 | 43 | /reference/cichlids_tree.html 44 | 45 | 46 | /reference/coef_plot.html 47 | 48 | 49 | /reference/define_model_set.html 50 | 51 | 52 | /reference/est_DAG.html 53 | 54 | 55 | /reference/est_DAG_binary.html 56 | 57 | 58 | /reference/index.html 59 | 60 | 61 | /reference/phylo_path.html 62 | 63 | 64 | /reference/phylo_path_binary.html 65 | 66 | 67 | /reference/plot.DAG.html 68 | 69 | 70 | /reference/plot.fitted_DAG.html 71 | 72 | 73 | /reference/plot_model_set.html 74 | 75 | 76 | /reference/red_list.html 77 | 78 | 79 | /reference/red_list_tree.html 80 | 81 | 82 | /reference/reexports.html 83 | 84 | 85 | /reference/rhino.html 86 | 87 | 88 | /reference/rhino_tree.html 89 | 90 | 91 | /reference/show_warnings.html 92 | 93 | 94 | -------------------------------------------------------------------------------- /index.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Easy phylogenetic path analysis in R" 3 | author: "Wouter van der Bijl" 4 | date: "July 5, 2017" 5 | output: md_document 6 | --- 7 | 8 | ```{r, include = FALSE} 9 | knitr::opts_chunk$set(dev = "png", fig.height = 7, fig.width = 7, dpi = 300, out.width = "600px", 10 | fig.align = 'center') 11 | ``` 12 | 13 | # Easy phylogenetic path analysis in R 14 | 15 | Use the `phylopath` package for an easy to use framework to perform phylogenetic path analysis (PPA). 16 | 17 | PPA can be used to compare support for competing causal models of trait evolution, while taking shared ancestry into account. All you need is: 18 | 1. A clear set of models to test. 19 | 2. A data set of species with trait values. 20 | 3. A phylogeny of your species. 21 | 22 | For a complete worked example, click "Get Started" above, or see the [PeerJ paper](https://doi.org/10.7717/peerj.4718). 23 | 24 | This method was developed by Von Hardenberg and Gonzalez-Voyer. See `citation()` for info on correct citations. 25 | 26 | ```{r, echo = FALSE} 27 | library(phylopath) 28 | 29 | models <- define_model_set( 30 | one = c(LS ~ BM, NL ~ BM, DD ~ NL, RS ~ DD), 31 | two = c(LS ~ BM, NL ~ BM, DD ~ NL, RS ~ LS + DD), 32 | three = c(LS ~ BM, NL ~ BM, DD ~ NL, RS ~ NL), 33 | four = c(LS ~ BM, NL ~ BM, DD ~ NL, RS ~ BM + NL), 34 | five = c(LS ~ BM, NL ~ BM, DD ~ NL, RS ~ BM + NL + DD), 35 | six = c(LS ~ BM, NL ~ BM + RS, DD ~ NL, RS ~ BM), 36 | seven = c(LS ~ BM, NL ~ BM + RS, DD ~ NL, RS ~ LS + BM), 37 | eight = c(LS ~ BM, NL ~ BM + RS, DD ~ NL), 38 | nine = c(LS ~ BM, NL ~ BM + RS, DD ~ NL, RS ~ LS) 39 | ) 40 | 41 | plot_model_set(models, rotation = -57, flip_x = TRUE) 42 | ``` 43 | 44 | ```{r, echo = FALSE} 45 | result <- phylo_path(models, data = rhino, tree = rhino_tree, 46 | order = c('BM', 'NL', 'DD', 'LS', 'RS')) 47 | #plot(choice(result, 'five'), rotation = 9.45, curvature = -0.0000001, flip_x = TRUE) 48 | plot(choice(result, 'five'), rotation = 10, curvature = -0.05, flip_x = TRUE) 49 | ``` 50 | 51 | `phylopath` has been used by [>100 publications](https://scholar.google.ca/scholar?oi=bibs&hl=en&cites=5933615079034924484) so far! 52 | -------------------------------------------------------------------------------- /index.md: -------------------------------------------------------------------------------- 1 | # Easy phylogenetic path analysis in R 2 | 3 | Use the `phylopath` package for an easy to use framework to perform 4 | phylogenetic path analysis (PPA). 5 | 6 | PPA can be used to compare support for competing causal models of trait 7 | evolution, while taking shared ancestry into account. All you need is: 8 | 1. A clear set of models to test. 2. A data set of species with trait 9 | values. 3. A phylogeny of your species. 10 | 11 | For a complete worked example, click “Get Started” above, or see the 12 | [PeerJ paper](https://doi.org/10.7717/peerj.4718). 13 | 14 | This method was developed by Von Hardenberg and Gonzalez-Voyer. See 15 | `citation()` for info on correct citations. 16 | 17 | 18 | 19 | 20 | 21 | `phylopath` has been used by [>100 publications](https://scholar.google.ca/scholar?oi=bibs&hl=en&cites=5933615079034924484) so far! 22 | -------------------------------------------------------------------------------- /inst/CITATION: -------------------------------------------------------------------------------- 1 | citHeader("To cite the 'phylopath' package in publications use:") 2 | 3 | vers <- paste("R package version", meta$Version) 4 | 5 | bibentry(bibtype = "Article", 6 | title = "Disentangling evolutionary cause-effect relationships with phylogenetic confirmatory path analysis", 7 | author = c(person("Achaz", "von Hardenberg"), person("Alejandro", "Gonzalez-Voyer")), 8 | journal = "Evolution", 9 | volume = "67 - 2", 10 | pages = "378-387", 11 | year = 2013, 12 | doi = "10.1111/j.1558-5646.2012.01790.x", 13 | key = "phylopath-methods-paper") 14 | 15 | bibentry(bibtype = "Article", 16 | title = "phylopath: Easy phylogenetic path analysis in R.", 17 | author = person("Wouter", "van der Bijl"), 18 | journal = "PeerJ", 19 | volume = "6", 20 | pages = "e4718", 21 | year = 2018, 22 | note = vers, 23 | doi = "10.7717/peerj.4718", 24 | key = "phylopath-package") -------------------------------------------------------------------------------- /man/DAG.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/DAG.R 3 | \name{DAG} 4 | \alias{DAG} 5 | \title{Directed acyclic graphs (DAGs)} 6 | \usage{ 7 | DAG(..., order = TRUE) 8 | } 9 | \arguments{ 10 | \item{...}{a sequence of model formulae} 11 | 12 | \item{order}{logical, defaulting to \code{TRUE}. If \code{TRUE} the nodes of the DAG 13 | are permuted according to the topological order. If \code{FALSE} the nodes are 14 | in the order they first appear in the model formulae (from left to right). 15 | For use in the \code{phylopath} package, this should always be kept to \code{TRUE}, 16 | but the argument is available to avoid potential problems with masking the 17 | function from other packages.} 18 | } 19 | \value{ 20 | An object of classes \code{matrix} and \code{DAG} 21 | } 22 | \description{ 23 | This function is a simple wrapper around the function from the \code{ggm} 24 | package with the same name. The only differences are that the \code{order} 25 | argument defaults to \code{TRUE} and that it adds a \code{DAG} class for 26 | easy plotting. Typically, one would use \code{\link[=define_model_set]{define_model_set()}} to 27 | create models for use with the \code{phylopath} package. 28 | } 29 | \details{ 30 | Supply a formulas for the model as arguments. Formulas should be of the 31 | form \verb{child ~ parent`` and describe each path in your model. Multiple children of a single parent can be combined into a single formula: }child ~ parent1 + parent2\verb{. Finally, an isolate (unconnected variable) can be included as being connected to itself: }isolate ~ isolate`. 32 | } 33 | \examples{ 34 | # Use formula notation to create DAGs: 35 | plot(DAG(A~B, B~C)) 36 | # Use + to easily add multiple parents to a node: 37 | plot(DAG(A~B+C)) 38 | # Add a node as it's own parent to create an isolate: 39 | plot(DAG(A~B+C, D~D)) 40 | } 41 | -------------------------------------------------------------------------------- /man/average.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/phylopath.R 3 | \name{average} 4 | \alias{average} 5 | \title{Extract and average the best supported models from a phylogenetic path 6 | analysis.} 7 | \usage{ 8 | average(phylopath, cut_off = 2, avg_method = "conditional", ...) 9 | } 10 | \arguments{ 11 | \item{phylopath}{An object of class \code{phylopath}.} 12 | 13 | \item{cut_off}{The CICc cut-off used to select the best models. Use 14 | \code{Inf} to average over all models. Use the \code{\link[=best]{best()}} function to 15 | only use the top model, or \code{\link[=choice]{choice()}} to select any single model.} 16 | 17 | \item{avg_method}{Either \code{"full"} or \code{"conditional"}. The methods 18 | differ in how they deal with averaging a path coefficient where the path is 19 | absent in some of the models. The full method sets the coefficient (and the 20 | variance) for the missing paths to zero, meaning paths that are missing in 21 | some models will shrink towards zero. The conditional method only averages 22 | over models where the path appears, making it more sensitive to small 23 | effects. Following von Hardenberg & Gonzalez-Voyer 2013, conditional 24 | averaging is set as the default.} 25 | 26 | \item{...}{Arguments to pass to \link[phylolm:phylolm]{phylolm::phylolm} and \link[phylolm:phyloglm]{phylolm::phyloglm}. Provide \code{boot = K} 27 | parameter to enable bootstrapping, where \code{K} is the number of bootstrap replicates. If you 28 | specified other options in the original \link{phylo_path} call you don't need to specify them again.} 29 | } 30 | \value{ 31 | An object of class \code{fitted_DAG}. 32 | } 33 | \description{ 34 | Extract and average the best supported models from a phylogenetic path 35 | analysis. 36 | } 37 | \examples{ 38 | candidates <- define_model_set( 39 | A = NL ~ RS, 40 | B = RS ~ NL + BM, 41 | .common = c(LS ~ BM, DD ~ NL, NL ~ BM) 42 | ) 43 | p <- phylo_path(candidates, rhino, rhino_tree) 44 | summary(p) 45 | 46 | # Models A and B have similar support, so we may decide to take 47 | # their average. 48 | 49 | avg_model <- average(p) 50 | # Print the average model to see coefficients, se and ci: 51 | avg_model 52 | 53 | \dontrun{ 54 | # Plot to show the weighted graph: 55 | plot(avg_model) 56 | 57 | # One can see that an averaged model is not necessarily a DAG itself. 58 | # This model actually has a path in two directions. 59 | 60 | # Note that coefficients that only occur in one of the models become much 61 | # smaller when we use full averaging: 62 | 63 | coef_plot(avg_model) 64 | coef_plot(average(p, method = 'full')) 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /man/average_DAGs.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/DAG.R 3 | \name{average_DAGs} 4 | \alias{average_DAGs} 5 | \title{Perform model averaging on a list of DAGs.} 6 | \usage{ 7 | average_DAGs( 8 | fitted_DAGs, 9 | weights = rep(1, length(coef)), 10 | avg_method = "conditional", 11 | ... 12 | ) 13 | } 14 | \arguments{ 15 | \item{fitted_DAGs}{A list of \code{fitted_DAG} objects containing 16 | coefficients and standard errors, usually obtained by using \code{\link[=est_DAG]{est_DAG()}} 17 | on several DAGs.} 18 | 19 | \item{weights}{A vector of associated model weights.} 20 | 21 | \item{avg_method}{Either \code{"full"} or \code{"conditional"}. The methods 22 | differ in how they deal with averaging a path coefficient where the path is 23 | absent in some of the models. The full method sets the coefficient (and the 24 | variance) for the missing paths to zero, meaning paths that are missing in 25 | some models will shrink towards zero. The conditional method only averages 26 | over models where the path appears, making it more sensitive to small 27 | effects. Following von Hardenberg & Gonzalez-Voyer 2013, conditional 28 | averaging is set as the default.} 29 | 30 | \item{...}{Use of the ellipses is deprecated.} 31 | } 32 | \value{ 33 | An object of class \code{fitted_DAG}, including standard errors and 34 | confidence intervals. 35 | } 36 | \description{ 37 | Perform model averaging on a list of DAGs. 38 | } 39 | \examples{ 40 | # Normally, I would advocate the use of the phylo_path and average 41 | # functions, but this code shows how to average any set of models. Note 42 | # that not many checks are implemented, so you may want to be careful and 43 | # make sure the DAGs make sense and contain the same variables! 44 | candidates <- define_model_set( 45 | A = NL ~ BM, 46 | B = NL ~ LS, 47 | .common = c(LS ~ BM, DD ~ NL) 48 | ) 49 | fit_cand <- lapply(candidates, est_DAG, rhino, rhino_tree, 50 | model = 'lambda', method = 'logistic_MPLE') 51 | ave_cand <- average_DAGs(fit_cand) 52 | coef_plot(ave_cand) 53 | } 54 | -------------------------------------------------------------------------------- /man/best.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/phylopath.R 3 | \name{best} 4 | \alias{best} 5 | \title{Extract and estimate the best supported model from a phylogenetic path 6 | analysis.} 7 | \usage{ 8 | best(phylopath, ...) 9 | } 10 | \arguments{ 11 | \item{phylopath}{An object of class \code{phylopath}.} 12 | 13 | \item{...}{Arguments to pass to \link[phylolm:phylolm]{phylolm::phylolm} and \link[phylolm:phyloglm]{phylolm::phyloglm}. Provide \code{boot = K} 14 | parameter to enable bootstrapping, where \code{K} is the number of bootstrap replicates. If you 15 | specified other options in the original \link{phylo_path} call you don't need to specify them again.} 16 | } 17 | \value{ 18 | An object of class \code{fitted_DAG}. 19 | } 20 | \description{ 21 | Extract and estimate the best supported model from a phylogenetic path 22 | analysis. 23 | } 24 | \examples{ 25 | candidates <- define_model_set( 26 | A = NL ~ BM, 27 | B = NL ~ LS, 28 | .common = c(LS ~ BM, DD ~ NL) 29 | ) 30 | p <- phylo_path(candidates, rhino, rhino_tree) 31 | best_model <- best(p) 32 | # Print the best model to see coefficients, se and ci: 33 | best_model 34 | # Plot to show the weighted graph: 35 | plot(best_model) 36 | 37 | } 38 | -------------------------------------------------------------------------------- /man/choice.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/phylopath.R 3 | \name{choice} 4 | \alias{choice} 5 | \title{Extract and estimate an arbitrary model from a phylogenetic path analysis.} 6 | \usage{ 7 | choice(phylopath, choice, ...) 8 | } 9 | \arguments{ 10 | \item{phylopath}{An object of class \code{phylopath}.} 11 | 12 | \item{choice}{A character string of the name of the model to be chosen, or 13 | the index in \code{model_set}.} 14 | 15 | \item{...}{Arguments to pass to \link[phylolm:phylolm]{phylolm::phylolm} and \link[phylolm:phyloglm]{phylolm::phyloglm}. Provide \code{boot = K} 16 | parameter to enable bootstrapping, where \code{K} is the number of bootstrap replicates. If you 17 | specified other options in the original \link{phylo_path} call you don't need to specify them again.} 18 | } 19 | \value{ 20 | An object of class \code{fitted_DAG}. 21 | } 22 | \description{ 23 | Extract and estimate an arbitrary model from a phylogenetic path analysis. 24 | } 25 | \examples{ 26 | candidates <- define_model_set( 27 | A = NL ~ BM, 28 | B = NL ~ LS, 29 | .common = c(LS ~ BM, DD ~ NL) 30 | ) 31 | p <- phylo_path(candidates, rhino, rhino_tree) 32 | my_model <- choice(p, "B") 33 | # Print the best model to see coefficients, se and ci: 34 | my_model 35 | # Plot to show the weighted graph: 36 | plot(my_model) 37 | 38 | } 39 | -------------------------------------------------------------------------------- /man/cichlids.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/data_docs.R 3 | \docType{data} 4 | \name{cichlids} 5 | \alias{cichlids} 6 | \title{Cichlid traits and the evolution of cooperative breeding.} 7 | \format{ 8 | An object of class \code{data.frame} with 69 rows and 5 columns. 9 | } 10 | \source{ 11 | Dey, C.J., O'Connor, C.M., Wilkinson, H., Shultz, S., Balshine, S. & 12 | Fitzpatrick, J.L. 2017. Direct benefits and evolutionary transitions to 13 | complex societies. Nat Ecol Evol 1: 137. 14 | } 15 | \usage{ 16 | cichlids 17 | } 18 | \description{ 19 | A data set with binary traits, used in an analysis on the evolution of 20 | cooperative breeding by Dey et al 2017. Variable names are shortened for 21 | easy of use and consist of cooperative breeding (C), mating system (M), 22 | parental care (P), social grouping (G) and diet (D). All traits are coded as 23 | two level factors. 24 | } 25 | \keyword{datasets} 26 | -------------------------------------------------------------------------------- /man/cichlids_tree.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/data_docs.R 3 | \docType{data} 4 | \name{cichlids_tree} 5 | \alias{cichlids_tree} 6 | \title{Cichlid phylogeny.} 7 | \format{ 8 | An object of class \code{phylo} of length 4. 9 | } 10 | \source{ 11 | Dey, C.J., O'Connor, C.M., Wilkinson, H., Shultz, S., Balshine, S. & 12 | Fitzpatrick, J.L. 2017. Direct benefits and evolutionary transitions to 13 | complex societies. Nat Ecol Evol 1: 137. 14 | } 15 | \usage{ 16 | cichlids_tree 17 | } 18 | \description{ 19 | The phylogenetic tree of cichlid species that accompanies the \code{cichlids} 20 | dataset. The phylogeny is based on five nuclear genes and three 21 | mitochondrial genes. 22 | } 23 | \keyword{datasets} 24 | -------------------------------------------------------------------------------- /man/coef_plot.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/print_and_plot.R 3 | \name{coef_plot} 4 | \alias{coef_plot} 5 | \title{Plot path coefficients and their confidence intervals or standard errors.} 6 | \usage{ 7 | coef_plot( 8 | fitted_DAG, 9 | error_bar = "ci", 10 | order_by = "default", 11 | from = NULL, 12 | to = NULL, 13 | reverse_order = FALSE 14 | ) 15 | } 16 | \arguments{ 17 | \item{fitted_DAG}{A fitted DAG, usually obtained by \code{\link[=best]{best()}}, \code{\link[=average]{average()}} or \code{\link[=est_DAG]{est_DAG()}}.} 18 | 19 | \item{error_bar}{Whether to use confidence intervals (\code{"ci"}) or standard errors (\code{"se"}) as 20 | error bars. Will force standard errors with a message if confidence intervals are not 21 | available.} 22 | 23 | \item{order_by}{By \code{"default"}, the paths are ordered as in the the model that is supplied. 24 | Usually this is in the order that was established by \verb{[phylo_path()]} for all combined graphs. 25 | This can be change to \code{"causal"} to do a reordering based on the model at hand, or to 26 | \code{"strength"} to order them by the standardized regression coefficient.} 27 | 28 | \item{from}{Only show path coefficients from these nodes. Supply as a character vector.} 29 | 30 | \item{to}{Only show path coefficients to these nodes. Supply as a character vector.} 31 | 32 | \item{reverse_order}{If \code{TRUE}, the paths are plotted in reverse order. 33 | Particularly useful in combination with \code{\link[ggplot2:coord_flip]{ggplot2::coord_flip()}} to create 34 | horizontal versions of the plot.} 35 | } 36 | \value{ 37 | A \code{ggplot} object. 38 | } 39 | \description{ 40 | Plot path coefficients and their confidence intervals or standard errors. 41 | } 42 | \examples{ 43 | d <- DAG(LS ~ BM, NL ~ BM, DD ~ NL + LS) 44 | plot(d) 45 | d_fitted <- est_DAG(d, rhino, rhino_tree, 'lambda') 46 | plot(d_fitted) 47 | coef_plot(d_fitted, error_bar = "se") 48 | # to create a horizontal version, use this: 49 | coef_plot(d_fitted, error_bar = "se", reverse_order = TRUE) + ggplot2::coord_flip() 50 | } 51 | -------------------------------------------------------------------------------- /man/define_model_set.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/DAG.R 3 | \name{define_model_set} 4 | \alias{define_model_set} 5 | \title{Define a model set.} 6 | \usage{ 7 | define_model_set(..., .common = NULL) 8 | } 9 | \arguments{ 10 | \item{...}{Named arguments, which each are a lists of formulas defining the 11 | paths of a causal model.} 12 | 13 | \item{.common}{A list of formulas that contain causal paths that are common 14 | to each model.} 15 | } 16 | \value{ 17 | A list of models, each of class \code{matrix} and \code{DAG}. 18 | } 19 | \description{ 20 | This is a convenience function to quickly and clearly define a set of causal 21 | models. Supply a list of formulas for each model, using either \code{c()}. Formulas 22 | should be of the form \code{child ~ parent} and describe each path in your model. 23 | Multiple children of a single parent can be combined into a single formula: 24 | \code{child ~ parent1 + parent2}. 25 | } 26 | \details{ 27 | This function uses \code{\link[ggm:DAG]{ggm::DAG()}}. 28 | } 29 | \examples{ 30 | (m <- define_model_set( 31 | A = c(a~b, b~c), 32 | B = c(b~a, c~b), 33 | .common = c(d~a))) 34 | plot_model_set(m) 35 | } 36 | -------------------------------------------------------------------------------- /man/est_DAG.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/DAG.R 3 | \name{est_DAG} 4 | \alias{est_DAG} 5 | \title{Add standardized path coefficients to a DAG.} 6 | \usage{ 7 | est_DAG(DAG, data, tree, model, method, boot = 0, ...) 8 | } 9 | \arguments{ 10 | \item{DAG}{A directed acyclic graph, typically created with \code{DAG}.} 11 | 12 | \item{data}{A \code{data.frame} with data. If you have binary variables, make 13 | sure they are either character values or factors!} 14 | 15 | \item{tree}{A phylogenetic tree of class \code{phylo}.} 16 | 17 | \item{model}{The evolutionary model used for the regressions on continuous 18 | variables. See \link[phylolm:phylolm]{phylolm::phylolm} for options and details. Defaults to 19 | Pagel's lambda model} 20 | 21 | \item{method}{The estimation method for the binary models. See 22 | \link[phylolm:phyloglm]{phylolm::phyloglm} for options and details. Defaults to logistic MPLE.} 23 | 24 | \item{boot}{The number of bootstrap replicates used to estimate confidence intervals.} 25 | 26 | \item{...}{Arguments passed on to \code{phylolm}: 27 | 28 | \code{lower.bound}: optional lower bound for the optimization of the phylogenetic model parameter. 29 | 30 | \code{upper.bound}: optional upper bound for the optimization of the phylogenetic model parameter. 31 | 32 | \code{starting.value}: optional starting value for the optimization of the phylogenetic model parameter. 33 | 34 | \code{measurement_error}: a logical value indicating whether there is measurement error sigma2_error (see Details). 35 | 36 | Arguments passed on to \code{phyloglm}: 37 | 38 | \code{btol}: bound on the linear predictor to bound the searching space. 39 | 40 | \code{log.alpha.bound}: bound for the log of the parameter alpha. 41 | 42 | \code{start.beta}: starting values for beta coefficients. 43 | 44 | \code{start.alpha}: starting values for alpha (phylogenetic correlation).} 45 | } 46 | \value{ 47 | An object of class \code{fitted_DAG}. 48 | } 49 | \description{ 50 | Add standardized path coefficients to a DAG. 51 | } 52 | \examples{ 53 | d <- DAG(LS ~ BM, NL ~ BM, DD ~ NL + LS) 54 | plot(d) 55 | d_fitted <- est_DAG(d, rhino, rhino_tree, 'lambda') 56 | plot(d_fitted) 57 | } 58 | -------------------------------------------------------------------------------- /man/figures/unnamed-chunk-2-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/man/figures/unnamed-chunk-2-1.png -------------------------------------------------------------------------------- /man/figures/unnamed-chunk-3-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ax3man/phylopath/c74ea8a2a2b967f4f88f68f3f5648434fa6622ed/man/figures/unnamed-chunk-3-1.png -------------------------------------------------------------------------------- /man/phylo_path.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/phylopath.R 3 | \name{phylo_path} 4 | \alias{phylo_path} 5 | \title{Compare causal models in a phylogenetic context.} 6 | \usage{ 7 | phylo_path( 8 | model_set, 9 | data, 10 | tree, 11 | model = "lambda", 12 | method = "logistic_MPLE", 13 | order = NULL, 14 | parallel = NULL, 15 | na.rm = TRUE, 16 | ... 17 | ) 18 | } 19 | \arguments{ 20 | \item{model_set}{A list of directed acyclic graphs. These are matrices, 21 | typically created with \code{define_model_set}.} 22 | 23 | \item{data}{A \code{data.frame} with data. If you have binary variables, make 24 | sure they are either character values or factors!} 25 | 26 | \item{tree}{A phylogenetic tree of class \code{phylo}.} 27 | 28 | \item{model}{The evolutionary model used for the regressions on continuous 29 | variables. See \link[phylolm:phylolm]{phylolm::phylolm} for options and details. Defaults to 30 | Pagel's lambda model} 31 | 32 | \item{method}{The estimation method for the binary models. See 33 | \link[phylolm:phyloglm]{phylolm::phyloglm} for options and details. Defaults to logistic MPLE.} 34 | 35 | \item{order}{Causal order of the included variable, given as a character 36 | vector. This is used to determine which variable should be the dependent 37 | in the dsep regression equations. If left unspecified, the order will be 38 | automatically determined. If the combination of all included models is 39 | itself a DAG, then the ordering of that full model is used. Otherwise, 40 | the most common ordering between each pair of variables is used to create 41 | a general ordering.} 42 | 43 | \item{parallel}{\emph{Superseded} From v1.2 \code{phylopath} uses the \code{future} package 44 | for all parallel processing, see details.} 45 | 46 | \item{na.rm}{Should rows that contain missing values be dropped from the data 47 | as necessary (with a message)?} 48 | 49 | \item{...}{Arguments passed on to \code{phylolm}: 50 | 51 | \code{lower.bound}: optional lower bound for the optimization of the phylogenetic model parameter. 52 | 53 | \code{upper.bound}: optional upper bound for the optimization of the phylogenetic model parameter. 54 | 55 | \code{starting.value}: optional starting value for the optimization of the phylogenetic model parameter. 56 | 57 | \code{measurement_error}: a logical value indicating whether there is measurement error sigma2_error (see Details). 58 | 59 | Arguments passed on to \code{phyloglm}: 60 | 61 | \code{btol}: bound on the linear predictor to bound the searching space. 62 | 63 | \code{log.alpha.bound}: bound for the log of the parameter alpha. 64 | 65 | \code{start.beta}: starting values for beta coefficients. 66 | 67 | \code{start.alpha}: starting values for alpha (phylogenetic correlation).} 68 | } 69 | \value{ 70 | A phylopath object, with the following components: 71 | \describe{ 72 | \item{d_sep}{for each model a table with separation statements and statistics.} 73 | \item{model_set}{the DAGs} 74 | \item{data}{the supplied data} 75 | \item{tree}{the supplied tree} 76 | \item{model}{the employed model of evolution in \code{phylolm}} 77 | \item{method}{the employed method in \code{phyloglm}} 78 | \item{dots}{any additional arguments given, these are passed on to downstream functions} 79 | \item{warnings}{any warnings generated by the models} 80 | } 81 | } 82 | \description{ 83 | Continuous variables are modeled using \link[phylolm:phylolm]{phylolm::phylolm}, while binary 84 | traits are modeled using \link[phylolm:phyloglm]{phylolm::phyloglm}. 85 | } 86 | \details{ 87 | \emph{Parallel processing}: From v1.2, \code{phylopath} uses the \code{future} framework 88 | for parallel processing. This is compatible with the parallel computation 89 | within the underlying \code{phylolm}, making it easy to enable parallel 90 | processing of multiple models, and of bootstrap replicates. To enable, 91 | simply set a parallel \code{plan()} using the \code{future} package. Typically, you'll 92 | want to run \code{future::plan("multisession", workers = n)}, where \code{n} is the 93 | number of cores. Now parallel processing is enabled. Return to sequential 94 | processing using \code{future::plan("sequential")} 95 | } 96 | \examples{ 97 | #see vignette('intro_to_phylopath') for more details 98 | candidates <- define_model_set( 99 | A = NL ~ BM, 100 | B = NL ~ LS, 101 | .common = c(LS ~ BM, DD ~ NL) 102 | ) 103 | p <- phylo_path(candidates, rhino, rhino_tree) 104 | 105 | # Printing p gives some general information: 106 | p 107 | # And the summary gives statistics to compare the models: 108 | summary(p) 109 | 110 | } 111 | -------------------------------------------------------------------------------- /man/plot.DAG.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/print_and_plot.R 3 | \name{plot.DAG} 4 | \alias{plot.DAG} 5 | \title{Plot a directed acyclic graph.} 6 | \usage{ 7 | \method{plot}{DAG}( 8 | x, 9 | labels = NULL, 10 | algorithm = "sugiyama", 11 | manual_layout = NULL, 12 | text_size = 6, 13 | box_x = 12, 14 | box_y = 8, 15 | edge_width = 1.5, 16 | curvature = 0.02, 17 | rotation = 0, 18 | flip_x = FALSE, 19 | flip_y = FALSE, 20 | arrow = grid::arrow(type = "closed", 18, grid::unit(15, "points")), 21 | ... 22 | ) 23 | } 24 | \arguments{ 25 | \item{x}{A `DAG`` object, usually created with the \code{\link[=define_model_set]{define_model_set()}} or \code{\link[=DAG]{DAG()}} function.} 26 | 27 | \item{labels}{An optional set of labels to use for the nodes. This should be a named vector, of 28 | the form \code{c(var1 = "label1", var2 = "label2")}. 29 | If left at `NULL``, the variable names of the DAGs are used.} 30 | 31 | \item{algorithm}{A layout algorithm from \link{igraph}, see 32 | \code{\link[ggraph:ggraph]{ggraph::create_layout()}}. By default, 33 | uses the Sugiyama layout algorithm, which is designed to minimize edge crossing in DAGs.} 34 | 35 | \item{manual_layout}{Alternatively, precisely define the layout yourself, by providing a 36 | \code{data.frame} that at least has a column \code{name} with all variable names, and columns \code{x} and \code{y} 37 | with positions to be plotted. Setting this parameter overrides \code{algorithm} but other changes, 38 | such as \code{rotation} and \code{flip}s will still be applied.} 39 | 40 | \item{text_size}{Size of the node label text.} 41 | 42 | \item{box_x}{To avoid the arrows colliding with the nodes, specify the 43 | rectangular dimensions of an invisible box around each node. If you have 44 | long labels, you need to increase this.} 45 | 46 | \item{box_y}{To avoid the arrows colliding with the nodes, specify the 47 | rectangular dimensions of an invisible box around each node. If you have 48 | multi-line labels, you need to increase this.} 49 | 50 | \item{edge_width}{Width of the edges.} 51 | 52 | \item{curvature}{Curvature of the edges. A slight curvature can look pretty.} 53 | 54 | \item{rotation}{Supply the degrees you want to rotate the layout by. This is useful in order to 55 | put rotate your upstream nodes towards the top if needed.} 56 | 57 | \item{flip_x}{Whether to flip the node positions horizontally.} 58 | 59 | \item{flip_y}{Whether to flip the node positions vertically.} 60 | 61 | \item{arrow}{A \code{grid::arrow} object, specifying the shape and size of the arrowheads. 62 | 63 | The order of facets is taken from the ordering of the list, with the facet 64 | labels coming from the names of the list. If the list is unnamed, sequential 65 | lettering is used.} 66 | 67 | \item{...}{Not used.} 68 | } 69 | \description{ 70 | Plot a directed acyclic graph. 71 | } 72 | \examples{ 73 | d <- DAG(a ~ b + c + d) 74 | plot(d) 75 | 76 | # Plot with manually defined positions: 77 | ml <- data.frame( 78 | name = c('a', 'b', 'c', 'd'), 79 | x = c(1, 1, 2, 2), 80 | y = c(1, 2, 1, 2) 81 | ) 82 | plot(d, manual_layout = ml) 83 | 84 | } 85 | -------------------------------------------------------------------------------- /man/plot.fitted_DAG.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/print_and_plot.R 3 | \name{plot.fitted_DAG} 4 | \alias{plot.fitted_DAG} 5 | \title{Plot a directed acyclic graph with path coefficients.} 6 | \usage{ 7 | \method{plot}{fitted_DAG}( 8 | x, 9 | type = "width", 10 | labels = NULL, 11 | algorithm = "sugiyama", 12 | manual_layout = NULL, 13 | text_size = 6, 14 | box_x = 12, 15 | box_y = 8, 16 | edge_width = 1.25, 17 | curvature = 0.02, 18 | rotation = 0, 19 | flip_x = FALSE, 20 | flip_y = FALSE, 21 | arrow = grid::arrow(type = "closed", 18, grid::unit(15, "points")), 22 | colors = c("firebrick", "navy"), 23 | show.legend = TRUE, 24 | width_const = NULL, 25 | ... 26 | ) 27 | } 28 | \arguments{ 29 | \item{x}{An object of class \code{fitted_DAG}.} 30 | 31 | \item{type}{How to express the weight of the path. Either \code{"width"}, or \code{"color"}.} 32 | 33 | \item{labels}{An optional set of labels to use for the nodes. This should be a named vector, of 34 | the form \code{c(var1 = "label1", var2 = "label2")}. 35 | If left at `NULL``, the variable names of the DAGs are used.} 36 | 37 | \item{algorithm}{A layout algorithm from \code{igraph}, see 38 | \code{\link[ggraph:ggraph]{ggraph::create_layout()}}. By default, 39 | uses the Sugiyama layout algorithm, which is designed to minimize edge crossing in DAGs.} 40 | 41 | \item{manual_layout}{Alternatively, precisely define the layout yourself, by providing a 42 | \code{data.frame} that at least has a column \code{name} with all variable names, and columns \code{x} and \code{y} 43 | with positions to be plotted. Setting this parameter overrides \code{algorithm} but other changes, 44 | such as \code{rotation} and \code{flip}s will still be applied.} 45 | 46 | \item{text_size}{Size of the node label text.} 47 | 48 | \item{box_x}{To avoid the arrows colliding with the nodes, specify the 49 | rectangular dimensions of an invisible box around each node. If you have 50 | long labels, you need to increase this.} 51 | 52 | \item{box_y}{To avoid the arrows colliding with the nodes, specify the 53 | rectangular dimensions of an invisible box around each node. If you have 54 | multi-line labels, you need to increase this.} 55 | 56 | \item{edge_width}{Width of the edges.} 57 | 58 | \item{curvature}{Curvature of the edges. A slight curvature can look pretty.} 59 | 60 | \item{rotation}{Supply the degrees you want to rotate the layout by. This is useful in order to 61 | put rotate your upstream nodes towards the top if needed.} 62 | 63 | \item{flip_x}{Whether to flip the node positions horizontally.} 64 | 65 | \item{flip_y}{Whether to flip the node positions vertically.} 66 | 67 | \item{arrow}{A \code{grid::arrow} object, specifying the shape and size of the arrowheads. 68 | 69 | The order of facets is taken from the ordering of the list, with the facet 70 | labels coming from the names of the list. If the list is unnamed, sequential 71 | lettering is used.} 72 | 73 | \item{colors}{The end points of the continuous color scale. Keep in mind that red and green are 74 | obvious colors to use, but are better to be avoided because of color blind users.} 75 | 76 | \item{show.legend}{Whether a legend for the color scale should be shown.} 77 | 78 | \item{width_const}{Deprecated.} 79 | 80 | \item{...}{Not used.} 81 | } 82 | \description{ 83 | Plot a directed acyclic graph with path coefficients. 84 | } 85 | \examples{ 86 | d <- DAG(LS ~ BM, NL ~ BM, DD ~ NL + LS) 87 | d_fitted <- est_DAG(d, rhino, rhino_tree, 'lambda') 88 | plot(d_fitted) 89 | } 90 | -------------------------------------------------------------------------------- /man/plot_model_set.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/print_and_plot.R 3 | \name{plot_model_set} 4 | \alias{plot_model_set} 5 | \title{Plot several causal hypothesis at once.} 6 | \usage{ 7 | plot_model_set( 8 | model_set, 9 | labels = NULL, 10 | algorithm = "kk", 11 | manual_layout = NULL, 12 | text_size = 5, 13 | box_x = 12, 14 | box_y = 10, 15 | edge_width = 1, 16 | curvature = 0.05, 17 | rotation = 0, 18 | flip_x = FALSE, 19 | flip_y = FALSE, 20 | nrow = NULL, 21 | arrow = grid::arrow(type = "closed", 15, grid::unit(10, "points")) 22 | ) 23 | } 24 | \arguments{ 25 | \item{model_set}{A list of \code{DAG} objects, usually created with \code{\link[=define_model_set]{define_model_set()}}.} 26 | 27 | \item{labels}{An optional set of labels to use for the nodes. This should be a named vector, of 28 | the form \code{c(var1 = "label1", var2 = "label2")}. 29 | If left at `NULL``, the variable names of the DAGs are used.} 30 | 31 | \item{algorithm}{A layout algorithm from \code{igraph}, see 32 | \code{\link[ggraph:ggraph]{ggraph::create_layout()}}. By default, uses the Kamada-Kawai 33 | layout algorithm. Another good option is \code{"sugiyama"}, which is 34 | designed to minimize edge crossing in DAGs. However, it can often plot 35 | nodes too close together.} 36 | 37 | \item{manual_layout}{Alternatively, precisely define the layout yourself, by providing a 38 | \code{data.frame} that at least has a column \code{name} with all variable names, and columns \code{x} and \code{y} 39 | with positions to be plotted. Setting this parameter overrides \code{algorithm} but other changes, 40 | such as \code{rotation} and \code{flip}s will still be applied.} 41 | 42 | \item{text_size}{Size of the node label text.} 43 | 44 | \item{box_x}{To avoid the arrows colliding with the nodes, specify the 45 | rectangular dimensions of an invisible box around each node. If you have 46 | long labels, you need to increase this.} 47 | 48 | \item{box_y}{To avoid the arrows colliding with the nodes, specify the 49 | rectangular dimensions of an invisible box around each node. If you have 50 | multi-line labels, you need to increase this.} 51 | 52 | \item{edge_width}{Width of the edges.} 53 | 54 | \item{curvature}{Curvature of the edges. A slight curvature can look pretty.} 55 | 56 | \item{rotation}{Supply the degrees you want to rotate the layout by. This is useful in order to 57 | put rotate your upstream nodes towards the top if needed.} 58 | 59 | \item{flip_x}{Whether to flip the node positions horizontally.} 60 | 61 | \item{flip_y}{Whether to flip the node positions vertically.} 62 | 63 | \item{nrow}{Number of rows to display the models on.} 64 | 65 | \item{arrow}{A \code{grid::arrow} object, specifying the shape and size of the arrowheads. 66 | 67 | The order of facets is taken from the ordering of the list, with the facet 68 | labels coming from the names of the list. If the list is unnamed, sequential 69 | lettering is used.} 70 | } 71 | \value{ 72 | A \code{ggplot} object. 73 | } 74 | \description{ 75 | Plot several causal hypothesis at once. 76 | } 77 | \examples{ 78 | m <- list(one = DAG(a ~ b + c + d), two = DAG(a ~ b, b ~ c, d ~ d)) 79 | plot_model_set(m) 80 | plot_model_set(m, algorithm = "sugiyama") 81 | } 82 | -------------------------------------------------------------------------------- /man/red_list.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/data_docs.R 3 | \docType{data} 4 | \name{red_list} 5 | \alias{red_list} 6 | \title{Data on brain size, life history and vulnerability to extinction} 7 | \format{ 8 | An object of class \code{data.frame} with 474 rows and 7 columns. 9 | } 10 | \source{ 11 | Gonzalez-Voyer A, Gonzalez-Suarez M, Vila C, Revilla E (2016) Larger 12 | brain size indirectly increases vulnerability to extinction in mammals. 13 | Evolution 70:1364-1375. doi: 10.1111/evo.12943 14 | } 15 | \usage{ 16 | red_list 17 | } 18 | \description{ 19 | A dataset with continuous variables affecting the conservation \code{Status} of 20 | mammalian species (the IUCN red list of threatened species). 21 | } 22 | \details{ 23 | It includes the following variables: brain size (\code{Br}), body size (\code{B}), 24 | gestation period (\code{G}), litter size (\code{L}), weening age (\code{W}), population 25 | density (\code{P}) and vulnerability to extinction (\code{Status}). 26 | } 27 | \keyword{datasets} 28 | -------------------------------------------------------------------------------- /man/red_list_tree.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/data_docs.R 3 | \docType{data} 4 | \name{red_list_tree} 5 | \alias{red_list_tree} 6 | \title{Mammalian phylogeny} 7 | \format{ 8 | An object of class \code{phylo} of length 4. 9 | } 10 | \source{ 11 | Gonzalez-Voyer, A. Gonzalez-Suarez M. Vila C. and Revilla E. 2016. 12 | Larger brain size indirectly increases vulnerability to extinction in 13 | mammals. Evolution 70:1364-1375. doi: 10.1111/evo.12943. 14 | 15 | Bininda-Emonds, O. R. P., M. Cardillo, K. E. Jones, R. D. E. MacPhee, R. M. D. 16 | Beck, R. Grenyer, S. A. Price, R. A. Vos, J. L. Gittleman, and A. Purvis. 17 | 2007. The delayed rise of present-day mammals. Nature 446:507-512. 18 | 19 | Fritz, S. A., O. R. P. Bininda-Emonds, and A. Purvis. 2009. Geographical 20 | variation in predictors of mammalian extinction risk: big is bad, but 21 | only in the tropics. Ecol. Lett. 12:538-549. 22 | } 23 | \usage{ 24 | red_list_tree 25 | } 26 | \description{ 27 | This is the accompanying phylogeny for the red_list data set. It is based 28 | on the updated mammalian supertree by Bininda-Emonds et al. 2007 & Fritz 29 | et al. 2009. 30 | } 31 | \keyword{datasets} 32 | -------------------------------------------------------------------------------- /man/rhino.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/data_docs.R 3 | \docType{data} 4 | \name{rhino} 5 | \alias{rhino} 6 | \title{Rhinogrades traits.} 7 | \format{ 8 | An object of class \code{data.frame} with 100 rows and 6 columns. 9 | } 10 | \source{ 11 | Gonzalez-Voyer A & von Hardenberg A. 2014. An Introduction to 12 | Phylogenetic Path Analysis. Chapter 8. In: Garamszegi LZ (ed.), Modern 13 | Phylogenetic Comparative Methods and Their Application in Evolutionary 14 | Biology. pp. 201-229. Springer-Verlag Berlin Heidelberg. 15 | doi:10.1111/j.1558-5646.2012.01790.x 16 | } 17 | \usage{ 18 | rhino 19 | } 20 | \description{ 21 | A simulated dataset, as used by Gonzalez-Voyer and Von Hardenberg as an 22 | example, containing variables on body mass (BM), litter size (LS), nose 23 | length (NL), dispersal distance (DD) and range size (RS). 24 | } 25 | \keyword{datasets} 26 | -------------------------------------------------------------------------------- /man/rhino_tree.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/data_docs.R 3 | \docType{data} 4 | \name{rhino_tree} 5 | \alias{rhino_tree} 6 | \title{Rhinogrades phylogeny.} 7 | \format{ 8 | An object of class \code{phylo} of length 4. 9 | } 10 | \source{ 11 | Gonzalez-Voyer A & von Hardenberg A. 2014. An Introduction to 12 | Phylogenetic Path Analysis. Chapter 8. In: Garamszegi LZ (ed.), Modern 13 | Phylogenetic Comparative Methods and Their Application in Evolutionary 14 | Biology. pp. 201-229. Springer-Verlag Berlin Heidelberg. 15 | doi:10.1111/j.1558-5646.2012.01790.x 16 | } 17 | \usage{ 18 | rhino_tree 19 | } 20 | \description{ 21 | A phylogenetic tree for the 100 species of the \code{rhino} dataset. 22 | } 23 | \keyword{datasets} 24 | -------------------------------------------------------------------------------- /man/show_warnings.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/print_and_plot.R 3 | \name{show_warnings} 4 | \alias{show_warnings} 5 | \title{Print out warnings from a phylopath analysis.} 6 | \usage{ 7 | show_warnings(phylopath = NULL) 8 | } 9 | \arguments{ 10 | \item{phylopath}{A \code{phylopath} object of which the warnings should be printed.} 11 | } 12 | \description{ 13 | Use this function after running \code{phylo_path()} to conveniently print any generated warnings 14 | to the screen. You can either provide no arguments, which will only work if you run it directly 15 | after the analysis, or you have to provide the \code{phylopath} object manually. 16 | } 17 | -------------------------------------------------------------------------------- /phylopath.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | 3 | RestoreWorkspace: Default 4 | SaveWorkspace: Default 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 | StripTrailingWhitespace: Yes 16 | 17 | BuildType: Package 18 | PackageUseDevtools: Yes 19 | PackageInstallArgs: --no-multiarch --with-keep.source 20 | PackageRoxygenize: rd,collate,namespace,vignette 21 | -------------------------------------------------------------------------------- /tests/testthat.R: -------------------------------------------------------------------------------- 1 | library(testthat) 2 | library(phylopath) 3 | 4 | test_check("phylopath") 5 | -------------------------------------------------------------------------------- /tests/testthat/test-dag.R: -------------------------------------------------------------------------------- 1 | context("test-dag") 2 | library(phylopath) 3 | 4 | test_that("DAGs get the correct classes", { 5 | expect_true(inherits(DAG(A~B, B~C), 'matrix')) 6 | expect_true(inherits(DAG(A~B, B~C), 'DAG')) 7 | }) 8 | 9 | test_that('DAGs make correct nr of rows and columns', { 10 | expect_equal(nrow(DAG(A~B, B~C, C~D)), 4) 11 | expect_equal(nrow(DAG(A~B, B~C, C~D)), ncol(DAG(A~B, B~C, C~D))) 12 | }) 13 | 14 | test_that('Correct ordering of DAGs', { 15 | expect_equal( 16 | unclass(DAG(A~B, B~C, C~D)), 17 | structure( 18 | c(0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0), 19 | .Dim = c(4L, 4L), 20 | .Dimnames = list(c("D", "C", "B", "A"), c("D", "C", "B", "A")) 21 | ) 22 | ) 23 | expect_equal( 24 | unclass(DAG(A~B, C~D, B~C, order = FALSE)), 25 | structure( 26 | c(0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0), 27 | .Dim = c(4L, 4L), .Dimnames = list(c("A", "B", "C", "D"), c("A", "B", "C", "D")) 28 | ) 29 | ) 30 | }) 31 | -------------------------------------------------------------------------------- /tests/testthat/test-define_model_set.R: -------------------------------------------------------------------------------- 1 | context("test-define_model_set") 2 | 3 | test_that("classes are correct (list and DAG)", { 4 | ml <- define_model_set(x = c(A ~ B), .common = c(C ~ D)) 5 | expect_equal(length(ml), 1) 6 | expect_equal(class(ml), 'list') 7 | expect_true(inherits(ml[[1]], 'DAG')) 8 | }) 9 | 10 | test_that("Dimensions of all model matrices is the same.", { 11 | #Simple two models 12 | expect_equal(unique(sapply( 13 | define_model_set(c(A~B, B~C), c(A~C, B~C)), nrow)), 3) 14 | #Two models with non-overlapping nodes 15 | expect_equal(unique(sapply( 16 | define_model_set(c(A~B, B~C), c(A~C, C~D)), nrow)), 4) 17 | #Use of the .common 18 | expect_equal(unique(sapply( 19 | define_model_set(A~B, A~C, .common = C~D), nrow)), 4) 20 | #Use of isolate 21 | expect_equal(unique(sapply( 22 | define_model_set(A~B, c(A~B, C~C)), nrow)), 3) 23 | #Use of isolate in .common 24 | expect_equal(unique(sapply( 25 | define_model_set(A~B, A~B, .common = C~C), nrow)), 3) 26 | }) 27 | -------------------------------------------------------------------------------- /vignettes/binary_models.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Comparing causal models of binary traits using phylopath" 3 | author: "Wouter van der Bijl" 4 | date: "`r Sys.Date()`" 5 | output: rmarkdown::html_vignette 6 | vignette: > 7 | %\VignetteIndexEntry{binary_models} 8 | %\VignetteEngine{knitr::rmarkdown} 9 | %\VignetteEncoding{UTF-8} 10 | --- 11 | 12 | # Introduction 13 | 14 | This vignette gives a short example of how PPA can be applied to binary data sets using `phylopath`. A longer example with more explanation of the code can be found in the other vignette, "intro to phylopath". 15 | 16 | **Important notes**: 17 | 18 | There has been some discussion concerning how to best perform logistic regression with phylogenetic correction. I take no position on this matter. This package uses `phylolm::phyloglm`, written by Lam Si Tung Ho, Robert Lachlan, Rachel Feldman and Cécile Ané. `phylopath`'s accuracy is directly dependent on the accuracy of that function, and if you don't trust `phyloglm` you should not trust binary models used in `phylo_path`. 19 | 20 | `phylolm::phyloglm` performs checks for model convergence. In practice, these often fail. Especially in `phylopath`, were we often fit many models, it is likely that at least one model fails these checks and generates a warning. You can see the warnings using `check_warnings()`. You can try changing to the second method (`method = 'logistic_IG10'`), or passing parameters like `btol` and `log.alpha.bound` (see `?phylolm::phyloglm`). These parameters are then applied to all models. Another option is to use the `phylosem` package, which supports both Binomial and Poisson errors with a different implementation. 21 | 22 | *The example below currently generates such warnings, should not be trusted, and is only presented as an example.* 23 | 24 | If you have useful opinions or information on these points, feel free to contact me. 25 | 26 | # Example analysis 27 | 28 | ### Data and hypotheses 29 | 30 | This recreates the analysis from the following paper: 31 | 32 | > Dey CJ, O'Connor CM, Wilkinson H, Shultz S, Balshine S & Fitzpatrick JL. 2017. Direct benefits and evolutionary transitions to complex societies. Nature Ecology & Evolution. 0137. 33 | 34 | This is, to my knowledge, the first study to employ PPA on binary traits. 35 | 36 | The study investigates the evolution of cooperative breeding in cichlids. In short (my summary), there has been intense debate about what factors drive species towards evolving systems of cooperative breeding. Many have argued (and provided evidence in birds and mammals) that cooperative breeding chiefly evolves from monogamous mating systems because helpers can gain indirect fitness benefits through kin selection. However, a non-exclusive alternative hypothesis is that direct benefits due to ecological factors may be important and provide direct benefits. Therefore, both hypotheses should be considered at the same time. 37 | 38 | The data is included in this paper as `cichlids` and `cichlids_tree` 39 | 40 | It contains five variables: 41 | 42 | - C: Cooperative breeding, cooperative or non-cooperative. 43 | - M: Mating system, monogamous or non-monogamous. 44 | - P: Parental care, maternal or biparental. 45 | - G: Social grouping, grouping or non-grouping. 46 | - D: Diet, piscivore or non-piscivore. 47 | 48 | Under the indirect fitness hypothesis, monogamy is expected to be a major driver of cooperative breeding, while group living, biparental care and diet type may be important contributors towards a direct benefits scenario. 49 | 50 | ### Defining the causal models 51 | 52 | Following the paper in question, we define 12 putative causal models. 53 | 54 | ```{r define_models, fig.align='center', fig.width=10, fig.height=8, out.height="600px", fig.dpi = 600} 55 | library(phylopath) 56 | 57 | models <- define_model_set( 58 | A = c(C~M+D), 59 | B = c(C~D), 60 | C = c(C~D, P~M), 61 | D = c(C~D, M~P, G~P), 62 | E = c(C~D, P~M, G~P), 63 | F = c(C~D, P~M+G), 64 | G = c(C~D, M~P, P~G), 65 | H = c(C~D, M~P), 66 | I = c(C~D, M~M, G~P), 67 | J = c(M~P, G~D), 68 | K = c(P~M, G~D), 69 | L = c(C~M+D, P~M+G), 70 | .common = c(C~P+G) 71 | ) 72 | 73 | plot_model_set(models, algorithm = 'kk') 74 | ``` 75 | 76 | ### Comparing the models 77 | 78 | Now that we have our models, data and a tree, we can compare the models using `phylo_path` 79 | 80 | ```{r fit models} 81 | (cichlids_results <- phylo_path(models, cichlids, cichlids_tree)) 82 | ``` 83 | 84 | Note that three messages are printed. This is because there are missing values in our data set that are first being removed. Also, since the tree includes species for which data is missing, the tree had to be pruned. This is done automatically with a message to the user. You should check whether the amount of data removed is correct. 85 | 86 | The third messages notes that warnings have been generated, see the **Important notes** at the start of this vignette. I will continue with these results here, but *models with warnings should not be trusted*. 87 | 88 | `phylo_path` notes that indeed all variables are binary. 89 | 90 | ```{r get_summary} 91 | (s <- summary(cichlids_results)) 92 | plot(s) 93 | ``` 94 | 95 | We see that model F is the best supported model. This model notably does not include a link between monogamy and cooperative breeding, giving support to the direct benefits hypothesis. 96 | 97 | ### Evaluating variable importance 98 | 99 | Now that we have selected F as our best model, we still have three factors that affect cooperative breeding: diet, social grouping and parental care. Which one is more important? For this we can fit the model and look at magnitude of the coefficients. In this case, since we want to use the best model we use the function `best()`. One can use `choice()` to choose any arbitrary model, or `average()` to average over several models. 100 | 101 | ```{r} 102 | best_cichlids <- best(cichlids_results) 103 | ``` 104 | 105 | To see the individual coefficients and their standard errors, simply print `best_cichlids`: 106 | 107 | ```{r} 108 | best_cichlids 109 | ``` 110 | 111 | Or plot those: 112 | 113 | ```{r} 114 | coef_plot(best_cichlids, error_bar = "se", reverse_order = TRUE) + ggplot2::coord_flip() 115 | ``` 116 | 117 | But we can also plot the final model: 118 | 119 | ```{r, fig.align='center', fig.width=8, fig.height=4, out.width="600px", fig.dpi = 300} 120 | plot(best_cichlids) 121 | ``` 122 | 123 | --------------------------------------------------------------------------------