variational_ancestral_reconstruction: Ancestral Trait Reconstruction

View source: R/ancestral_reconstruction.R

variational_ancestral_reconstructionR Documentation

Ancestral Trait Reconstruction

Description

Reconstruct an ancestral trait distribution under the PLVM. Reconstructs the ancestral traits at a specific node on the phylogeny.

Usage

variational_ancestral_reconstruction(
  taxon_specific_latent_trait_expectation,
  taxon_specific_latent_trait_covariance,
  loading_expectation,
  precision_vector,
  metadata,
  n_samples = 1000,
  probs = c(0.025, 0.975),
  perform_checks = TRUE
)

Arguments

taxon_specific_latent_trait_expectation

An L-dimensional vector of real values. The expected value of taxon-specific latent traits under the variational distribution.

taxon_specific_latent_trait_covariance

An L-dimensional vector of positive real values. The variance associated with each taxon-specific latent trait under the variational distribution.

loading_expectation

A D x L matrix of real values. The expected value of the Loading matrix under the vaiational distribution.

precision_vector

A D dimensional vector of positive real values. The independent precision associated with each auxiliary trait.

metadata

A data frame. Contains all the metadata required to map a set of manifest traits to the PLVM auxiliary traits..

n_samples

A positive integer. The number of samples drawn to construct a Monte-Carlo approximation to the approximate posterior distribution of nominal traits.

probs

A numeric vector of values on the unit interval. The desired quantiles for continuous manifest traits.

perform_checks

Logical. Check if function inputs are specified correctly.

Value

A named list of length P. For continuous- or function-valued manifest traits, returns the expectation and marginal standard deviation for each element of the trait. For ordinal or nomianl traits, returns the probability associated with each category.


jpmeagher/vbar documentation built on Nov. 22, 2022, 5:48 a.m.