PCMInfo {PCMBase}R Documentation

Meta-information about a tree and trait data associated with a PCM

Description

This function pre-processes the given tree and data in order to create meta-information used during likelihood calculation.

Usage

PCMInfo(
  X,
  tree,
  model,
  SE = matrix(0, PCMNumTraits(model), PCMTreeNumTips(tree)),
  verbose = FALSE,
  preorder = NULL,
  ...
)

Arguments

X

a k x N numerical matrix with possible NA and NaN entries. For i=1,..., N, the column i of X contains the measured trait values for species i (the tip with integer identifier equal to i in tree). Missing values can be either not-available (NA) or not existing (NaN). These two values are treated differently when calculating likelihoods (see PCMPresentCoordinates).

tree

a phylo object with N tips.

model

an S3 object specifying both, the model type (class, e.g. "OU") as well as the concrete model parameter values at which the likelihood is to be calculated (see also Details).

SE

a k x N matrix specifying the standard error for each measurement in X. Alternatively, a k x k x N cube specifying an upper triangular k x k factor of the variance covariance matrix for the measurement error for each tip i=1, ..., N. When SE is a matrix, the k x k measurement error variance matrix for a tip i is calculated as VE[, , i] <- diag(SE[, i] * SE[, i], nrow = k). When SE is a cube, the way how the measurement variance matrix for a tip i is calculated depends on the runtime option PCMBase.Transpose.Sigma_x as follows:

if getOption("PCMBase.Transpose.Sigma_x", FALSE) == FALSE (default):

VE[, , i] <- SE[, , i] %*% t(SE[, , i])

if getOption("PCMBase.Transpose.Sigma_x", FALSE) == TRUE:

VE[, , i] <- t(SE[, , i]) %*% SE[, , i]

Note that the above behavior is consistent with the treatment of the model parameters Sigma_x, Sigmae_x and Sigmaj_x, which are also specified as upper triangular factors. Default: matrix(0.0, PCMNumTraits(model), PCMTreeNumTips(tree)).

verbose

logical indicating if some debug-messages should printed.

preorder

an integer vector of row-indices in tree$edge matrix as returned by PCMTreePreorder. This can be given for performance speed-up when several operations needing preorder are executed on the tree. Default : NULL.

...

additional arguments used by implementing methods.

Value

a named list with the following elements:

X

k x N matrix denoting the trait data;

VE

k x k x N array denoting the measurement error variance covariance matrix for each for each tip i = 1,...,N. See the parameter SE in PCMLik.

M

total number of nodes in the tree;

N

number of tips;

k

number of traits;

RTree

number of parts on the tree (distinct elements of tree$edge.part);

RModel

number of regimes in the model (elements of attr(model, regimes));

p

number of free parameters describing the model;

r

an integer vector corresponding to tree$edge with the regime for each branch in tree;

xi

an integer vector of 0's and 1's corresponding to the rows in tree$edge indicating the presence of a jump at the corresponding branch;

pc

a logical matrix of dimension k x M denoting the present coordinates for each node; in special cases this matrix can be edited by hand after calling PCMInfo and before passing the returned list to PCMLik. Otherwise, this matrix can be calculated in a custom way by specifying the option PCMBase.PCMPresentCoordinatesFun. See also PCMPresentCoordinates and PCMOptions.

This list is passed to PCMLik.


[Package PCMBase version 1.2.14 Index]