Continuous variables are modeled using phylolm::phylolm, while binary traits are modeled using phylolm::phyloglm.

phylo_path(
  model_set,
  data,
  tree,
  model = "lambda",
  method = "logistic_MPLE",
  order = NULL,
  parallel = NULL,
  na.rm = TRUE,
  ...
)

Arguments

model_set

A list of directed acyclic graphs. These are matrices, typically created with define_model_set.

data

A data.frame with data. If you have binary variables, make sure they are either character values or factors!

tree

A phylogenetic tree of class phylo.

model

The evolutionary model used for the regressions on continuous variables. See phylolm::phylolm for options and details. Defaults to Pagel's lambda model

method

The estimation method for the binary models. See phylolm::phyloglm for options and details. Defaults to logistic MPLE.

order

Causal order of the included variable, given as a character vector. This is used to determine which variable should be the dependent in the dsep regression equations. If left unspecified, the order will be automatically determined. If the combination of all included models is itself a DAG, then the ordering of that full model is used. Otherwise, the most common ordering between each pair of variables is used to create a general ordering.

parallel

Superseded From v1.2 phylopath uses the future package for all parallel processing, see details.

na.rm

Should rows that contain missing values be dropped from the data as necessary (with a message)?

...

Arguments passed on to phylolm:

lower.bound: optional lower bound for the optimization of the phylogenetic model parameter.

upper.bound: optional upper bound for the optimization of the phylogenetic model parameter.

starting.value: optional starting value for the optimization of the phylogenetic model parameter.

measurement_error: a logical value indicating whether there is measurement error sigma2_error (see Details).

Arguments passed on to phyloglm:

btol: bound on the linear predictor to bound the searching space.

log.alpha.bound: bound for the log of the parameter alpha.

start.beta: starting values for beta coefficients.

start.alpha: starting values for alpha (phylogenetic correlation).

Value

A phylopath object, with the following components:

d_sep

for each model a table with separation statements and statistics.

model_set

the DAGs

data

the supplied data

tree

the supplied tree

model

the employed model of evolution in phylolm

method

the employed method in phyloglm

dots

any additional arguments given, these are passed on to downstream functions

warnings

any warnings generated by the models

Details

Parallel processing: From v1.2, phylopath uses the future framework for parallel processing. This is compatible with the parallel computation within the underlying phylolm, making it easy to enable parallel processing of multiple models, and of bootstrap replicates. To enable, simply set a parallel plan() using the future package. Typically, you'll want to run future::plan("multisession", workers = n), where n is the number of cores. Now parallel processing is enabled. Return to sequential processing using future::plan("sequential")

Examples

  #see vignette('intro_to_phylopath') for more details
  candidates <- define_model_set(
    A = NL ~ BM,
    B = NL ~ LS,
    .common = c(LS ~ BM, DD ~ NL)
  )
  p <- phylo_path(candidates, rhino, rhino_tree)

  # Printing p gives some general information:
  p
#> A phylogenetic path analysis, on the variables:
#> 	Continuous:	 BM LS NL DD 
#> 	Binary:		  
#> 
#>  Evaluated for these models: A B 
#> 
#>  Containing 6 phylogenetic regressions, of which 4 unique
  # And the summary gives statistics to compare the models:
  summary(p)
#>   model k q     C       p CICc delta_CICc        l        w
#> A     A 3 7  2.65 0.85113 17.9        0.0 1.00e+00 1.00e+00
#> B     B 3 7 22.11 0.00115 37.3       19.5 5.94e-05 5.94e-05