computeVarianceCovariancePartition: Phylogenetic variance and covariance partition including (or...

View source: R/computeVarianceCovariancePartition.R

computeVarianceCovariancePartitionR Documentation

Phylogenetic variance and covariance partition including (or not) environment

Description

Compute total variance and covariance and separate it into its phylogenetic and non-phylogenetic components. If environmental variable is included, four variance and covariance is separated into four components: non-attributed phylogenetic variance-covariance, environmental phylogenetic variance-covariance, non-phylogenetic (labile) environmental variance-covariance and residual variance-covariance.

Usage

computeVarianceCovariancePartition(
  traits = NULL,
  environmental_variable = NULL,
  dataset = NULL,
  terminal_taxa = NULL,
  phylogeny = NULL,
  model_specifications = NULL,
  show_relative_variance = T,
  force_run = T,
  save = F,
  verbose = F
)

Arguments

traits

(character). Name of the trait or list of traits to calculate variances and covariances. They must be in the dataset.

environmental_variable

(character). Names of the environmental variables They must be contained in dataset.

dataset

(data frame). Data frame containing the trait of interest and a column describing terminal appearing as tip labels of the phylogeny.

terminal_taxa

(character). Terminal taxon as named in the dataset (e.g., species).

phylogeny

(phylo) Phylogeny with tip labels contained in dataset$animal

model_specifications

(list). Mcmcglmm models specifications as specified by the defineModelsSpecification of this package. If not defined, the function internally uses the default in defineModelsSpecification function.

show_relative_variance

(logical). If true, variance is shown relative to the total variance (recommended when using different variables). Otherwise, absolute variances are reported.

force_run

(logical) If false, models already run and saved in outputs folder are not run again.

save

(logical) If false, results are not saved in the outputs folder.

verbose

(logical) If false, function runs quietly. Otherwise, iterations and diagnostics are shown while running.

Details

The function can automaticallys save results. For that, first run initializeTrEvol to create the folders and subfolders structure.

Examples

## Not run: 
# Simulate example data
simulated_traits.data <- simulateDataSet()

# Compute variance-covariance structure for simulated traits using default parameters
variance_covariance_results <- computeVarianceCovariancePartition(
traits = c("phylo_G1_trait1", "phylo_G1_trait2"),
environmental_variable = "phylo_G1_env",
data = simulated_traits.data$data
phylogeny = simulated_traits.data$phylogeny
)

## End(Not run)

pablosanchezmart/TrEvol documentation built on April 23, 2024, 4:05 p.m.