three.point.compute {phylolm}R Documentation

Computations with a (generalized) three-point structured tree

Description

Computes PV1QP'V^{-1}Q and the log(detV)\log(\det V) of a (generalized) three-point structured matrix.

Usage

three.point.compute(phy, P, Q = NULL, diagWeight = NULL, 
            check.pruningwise = TRUE, check.names = TRUE)

Arguments

phy

a rooted phylogenetic tree of type phylo with branch lengths, to represent the 3-point structured matrix V0V_0. Note that the matrix of interest is V=DV0DV = D V_0 D.

P, Q

two matrices.

diagWeight

a vector containing the diagonal elements of the diagonal matrix DD if VV has a generalized 3-point structure: V=DV0DV = D V_0 D

check.pruningwise

If FALSE, the tree is assumed to be in pruningwise order.

check.names

if FALSE, the row names of P, Q, and the names of diagWeight are assumed to be the same as the labels of the tips in the tree.

Value

vec11

1V111'V^{-1}1.

P1

PV11P'V^{-1}1.

PP

PV1PP'V^{-1}P.

Q1

QV11Q'V^{-1}1.

QQ

QV1QQ'V^{-1}Q.

PQ

PV1QP'V^{-1}Q.

logd

log(detV)\log(\det V).

Note

The matrix VV is assumed to be V=DV0DV = D V_0 D where DD is the diagonal matrix with non-zero diagonal elements in diagWeight, and where V0V_0 is the 3-point structured covariance matrix determined by phy and its branch lengths. Note that DD do not correspond to measurement error terms.

The number of rows in P and Q and the length of diagWeight need to be the same as the number of tips in the tree. When Q = NULL, the function only returns 1V111'V^{-1}1, PV11P'V^{-1}1 and PV1PP'V^{-1}P.

Author(s)

Lam Si Tung Ho, Robert Lachlan

References

Ho, L. S. T. and Ané, C. (2014). "A linear-time algorithm for Gaussian and non-Gaussian trait evolution models". Systematic Biology 63(3):397-408.

See Also

transf.branch.lengths.

Examples

tre1 = rtree(500)
tre2 = transf.branch.lengths(phy=tre1, model="OUrandomRoot",
                             parameters = list(alpha = 0.5))
Q = rTrait(n=2,tre1)
y = rTrait(n=1,tre1)
P = cbind(1,y)
three.point.compute(tre2$tree,P,Q,tre2$diagWeight)

[Package phylolm version 2.6.2 Index]