initialise_plvm: Initialise CAVI for a PLVM

View source: R/initialise_plvm.R

initialise_plvmR Documentation

Initialise CAVI for a PLVM

Description

Specify a set of initial values for Co-ordinate Ascent Variational Inference (CAVI) on the Phylogenetic Latent Variable Model (PLVM).

Usage

initialise_plvm(
  manifest_trait_df,
  metadata,
  L,
  phy,
  id_label = "taxon_id",
  loading_prior_correlation,
  auxiliary_traits = NULL,
  precision = NULL,
  ard_precision = rep(1, L),
  ard_shape = 1,
  ard_rate = 1,
  loading = NULL,
  method = "varimax",
  within_taxon_amplitude = NULL,
  heritable_amplitude = NULL,
  length_scale = 2,
  perform_checks = TRUE,
  random_seed = NULL
)

Arguments

manifest_trait_df

The data frame of manifest traits. If included allows for a non-exhaustive series of checks comparing metadata provided to that implicit in the manifest traits.

metadata

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

L

An integer. The dimension of latent traits.

phy

An object of class "phylo".

id_label

Either a string or numeric indexing the variable in manifest_trait_df identifying the taxon to which each observation belongs.

loading_prior_correlation

A D'xD' correlation matrix. The correlation within loadings under the Gaussian prior.

auxiliary_traits

An NxD' matrix of real numbers. The initial matrix of auxiliary traits. When non null checks that the auxiliary trait matrix is of the correct type and size.

precision

A vector length n_traits taking positive real values. The Precision with which auxiliary traits are observed. Precision parameters for discrete traits are fixed at 1. When non-null checks that the precision parameters have been specified correctly.

ard_precision

An L-dimensional vector of real numbers. The initial ARD precision hyper-parameters on the loadings.

ard_shape

A positive real-valued scalar. The shape of the Gamma distribution generating initial ARD precision hyper-parameters

ard_rate

A positive real-valued scalar. The rate of the Gamma distribution generating initial ARD precision hyper-parameters

loading

A D'xL matrix of real values. The initial loading matrix. When non null checks that the loading matrix is of the correct type and size.

method

A string. Either "random" or "pca" indicating the type of initialisation adopted.

within_taxon_amplitude

An L-dimensional vector of real values on the interval [0, 1]. The within-taxon variation parameters for each of the L latent traits.

heritable_amplitude

A positive real-valued scalar. The amplitude of the phylogenetic OU process. Note that this is the square root of the variance and so should be thought of as a standard deviation parameter.

length_scale

A positive real number. The length-scale of the Ornstein-Uhlenbeck process.

perform_checks

Logical. Check if function inputs are specified correctly.

random_seed

A single value, interpreted as an integer, or NULL.

Value

A list of intital values for a PLVM..

See Also

specify_manifest_trait_metadata


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