prl_fit_traits_continuous_bayesian: Title Fit a continuous model of trait evolution along a...

Description Usage Arguments Details Value

View source: R/fit_models.R

Description

This function fits a Bayesian version of Ridge regression on edge paths, producing a phylogenetically smoothed estimate of trait evolution rates along a phylogeny's branches. Shrinkage limits how much change in rates can occur at each split of the phylogeny.

Usage

1
2
3
4
prl_fit_traits_continuous_bayesian(x, family = c("gaussian"),
  method = c("Ridge"), tree = NULL, regularise_first_split = FALSE,
  n_samples = 1000, thin = 1, warmup = 1000, chains = 4,
  n_cores = NULL, ...)

Arguments

x

Object of class phurl, such as that produced by phurl_prepare_data, or a matrix or data.frame of traits values to be fit (with rownames or order matching tree$tip.label).

family

a character vector specifying the statistical families to be used for each trait. If named, names will be used to match the family to a column in the traits data, otherwise they will be used in order. If the length of the vector is less than the number of traits, it will be recycled with a warning.

method

Method to use. Currently the only option is "Ridge". This is mainly for compatibility with fit_trait_shift, which allows multiple methods.

tree

A phylogeny of class phylo. Only used if x is a matrix of trait values (if x is an object of class phurl it should have a tree already associated with it)

regularise_first_split

Should the edges beginning at the first split in the phylogeny be regularised? If not, these are treated like a a set of 'intercepts' for evolutionary rates, and every subsequent change in these rates along the tree are regularised (penalised).

n_samples

Number of MCMC samples to draw during the fitting process.

thin

Thinning rate for MCMC samples.

warmup

Number of iteration to use for warmup of the MCMC sampling process.

chains

Number of replicate MCMC chains to run.

n_cores

Number of CPU cores to use for sampling.

...

Any other parameters to pass to the underlying fitting function (in this case mcmc)

Details

Test equations:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
yi ~ f(μ, φ)

             ===
             \
  g(μ) = α + /   βj
             ===
               j

βj ~ Normal(0, τ)

τ ~ InvGamma(1, 1)

Value

Object of class phurl, containing a fitted model in the model slot, and a tibble in the results slot containing estimates of rates along each edge, estimates of rate changes at each node, and ancestral character estimates (ACEs), including samples from the full posterior distribution.


rdinnager/phurl documentation built on Dec. 8, 2019, 3:06 p.m.