prl_prepare_data: Prepare data for analysing with phurl models

Description Usage Arguments Value

View source: R/prepare_data.R

Description

Prepare data for analysing with phurl models

Usage

1
2
3
prl_prepare_data(tree, traits = NULL, species_column = NULL,
  scale_edges = TRUE, centre = TRUE, transform_traits = NULL,
  standardise_traits = TRUE)

Arguments

tree

Phylogenetic tree of class phylo or tibble (e.g. using as_tibble)

traits

Trait data. Can be a named vector, a matrix or data.frame with named rows, where the rownames are the species names, or a data.frame or tibble with a column specifying the species name. If species names are not referenced in either the rownames or a column, data will be matched to the tree using order only (e.g. assuming data rows are in the same order as tree$tip.label). Can also be NULL in which case only the predictor variables derived from the phylogeny are generated. This can be useful to feed into the simulation functions, or to use in a custom model somewhere else.

species_column

Character value specifying which column of traits refers to the species names, if they are not specified in the rownames. If not NULL, this will override any rownames in traits

scale_edges

Should the edges be scaled to a maximum of 1? This is highly recommended for regularised models. Default TRUE.

centre

Should the resulting edge path predictor matrix be centred to so that each column has a mean of 0? This is recommended to improve convergence of the models. Default TRUE.

transform_traits

List of transformations to apply to trait values. If named, will be matched to column names, else they will be applied in order, and recycled if necessary.

standardise_traits

Should traits values be standardised by subtracting the mean and dividing by them standard deviation? Recommended. Default TRUE.

Value

A object of class phurl


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