Package 'PVR'

Title: Phylogenetic Eigenvectors Regression and Phylogentic Signal-Representation Curve
Description: Estimates (and controls for) phylogenetic signal through phylogenetic eigenvectors regression (PVR) and phylogenetic signal-representation (PSR) curve, along with some plot utilities.
Authors: Thiago Santos
Maintainer: Thiago Santos <[email protected]>
License: GPL (>= 2)
Version: 0.3
Built: 2025-02-22 03:08:46 UTC
Source: https://github.com/cran/PVR

Help Index


Computes Phylogenetic eigenVectors Regression and Phylogentic Signal-Representation curve (with null and neutral expectations).

Description

Computes PVR and PSR curve along with some plot utilitties.

Details

Package: PVR
Type: Package
Version: 1.0
Date: 2018-05-29
License: GPL >= 2

Author(s)

Santos, T; Diniz-Filho, J.A.F.; Rangel, T.F.; Bini, L.M.

Maintainer: Thiago Santos <[email protected]>

References

Diniz-Filho, J.A.F., Sant'Ana, C.E.R. and Bini, L.M. (1998). An eigenvector method for estimating phylogenetic inertia. Evolution 52:1247-1262.

Diniz-filho, J.A.F., Rangel, T.F., Santos, T. and Bini, L.M. (2012). Exploring patterns of interespecific variation in quantitative traits using sequential phylogenetic eigenvector regressions. Evolution, 66(4):1079-1090.

Diniz-filho, J.A.F., Bini, L.M., Rangel, T.F., Morales-Castilla, I., Olalla-Tarraga, M.A., Rodriguez, M.A. and Hawkins, B.A. (2012). On the selection of phylogenetic eigenvectors for ecological analyses. Ecography, 35:239-249.

See Also

PVR-class, PSR-class, PVR, PSR, PVRdecomp, PSRplot, VarPartplot

Examples

library(splancs)
#Creating a 10 tips ultrametric random phylogeny
library(ape)
tree <- rcoal(10)
#Decomposing phylogenetic distance matrix derived from tree into a set of orthogonal vectors
x <- PVRdecomp(tree)
trait <- runif(10)
y <- PSR(x, trait)
y

Creates a phylogenetic signal-representation (PSR) curve for a given phylogeny and trait set and computes its area.

Description

Phylogenetic signal-representation (PSR) curve, built upon phylogenetic eigenvector regression (PVR). Sequential PVR models are fitted after successively increasing the number of eigenvectors and plotting their R2 against the accumulated eigenvalues. The PSR area, expressing deviations from Brownian motion, is strongly correlated with Blomberg's K-statistics, so nonlinear PSR curves reveal if traits are evolving at a slower or higher rate than expected. The PSR area is also correlated with phylogenetic half-life under an OU process, so both methods describe the relationship between interspecific variation and time since divergence among species shape.

Usage

PSR(x, trait = NULL, null.model = FALSE, Brownian.model = FALSE, times = 1000)

Arguments

x

A object of class PVR (created using PVRdecomp function).

trait

A vector, data frame or matrix that contains contiuous or binary traits sets (for data frames and matrices, each column must represent a trait set). For now, only the first colunm will be used.

null.model

Logical. Should the function estimates the null expectation for the PSR area. Default is FALSE.

Brownian.model

Logical. Should the function estimates the Brownian (neutral) expectation for the PSR area. Default is FALSE.

times

Number of iterations used in null.model and Brownian.model.

Value

PSR function returns a object of (S4) class PSR that extends the (S4) class PVR, by adding: a PSR slot that contains the area (and p if null.model = TRUE) for each trait set, the cumulative eigenvalues and R2 that determine the curve; a slot with the null and neutral expectations (if any).

Author(s)

Santos, T; Diniz-Filho, J.A.F.; Rangel, T.F.; Bini, L.M.

References

Diniz-Filho, J.A.F., Sant'Ana, C.E.R. and Bini, L.M. (1998). An eigenvector method for estimating phylogenetic inertia. Evolution 52:1247-1262.

Diniz-filho, J.A.F., Rangel, T.F., Santos, T. and Bini, L.M. (2012). Exploring patterns of interespecific variation in quantitative traits using sequential phylogenetic eigenvector regressions. Evolution, 66(4):1079-1090.

Diniz-filho, J.A.F., Bini, L.M., Rangel, T.F., Morales-Castilla, I., Olalla-Tarraga, M.A., Rodriguez, M.A. and Hawkins, B.A. (2012). On the selection of phylogenetic eigenvectors for ecological analyses. Ecography, 35:239-249.

See Also

PVR, PVRdecomp, PSRplot, VarPartplot

Examples

library(splancs)
#Creating a 10 tips ultrametric random phylogeny
library(ape)
tree <- rcoal(10)
#Decomposing phylogenetic distance matrix derived from tree into a set of orthogonal vectors
x <- PVRdecomp(tree)
trait <- runif(10)
y <- PSR(x, trait)
summary(y)

Class "PSR"

Description

A S4 class that extends S4 PVR class in order to accommodate PSR analysis results.

Objects from the Class

Objects can be created by calls of the form new("PSR", ...).

Slots

PSRarea:

Object of class "data.frame" that contains PSR curve area.

PSR:

Object of class "data.frame" that contais accumulated r squared and eigenvalues.

Expect.area.values:

Object of class "list" that contains the expected null and neutral area values.

nullPSR:

Object of class "matrix" nested in the Expect.area.values slot that contains the expected null area values.

BrownianPSR:

Object of class "matrix" nested in the Expect.area.values slot that contains the expected Brownian (neutral) area values.

Eigen:

Object of class "list" that contains the eigenvalues and eigenvectors generated by phylogenetic distance matrix eigendecomposition. Inherited from PVR class.

phyDist:

Object of class "matrix" that contains a phylogenetic distance matrix. Inherited from PVR class.

phylo:

Object of class "phylo" that contains a phylogeny. Inherited from PVR class.

Selection:

Object of class "list" that contains the selection method (along with its statistics) used to select the vectors, the selected vectors IDs and a matrix that contains the selected vectors. Inherited from PVR class.

PVR:

Object of class "list" that contains the Philogenetic EigenVectors Regression r squared and residuals. Inherited from PVR class.

VarPart:

Object of class "list" that contains the variation partition components. Inherited from PVR class.

Extends

Class "PVR", directly.

Methods

plot

signature(x = "PSR"): ...

show

signature(object = "PSR"): ...

Author(s)

Santos, T; Diniz-Filho, J.A.F.; Rangel, T.F.; Bini, L.M.

References

Diniz-Filho, J.A.F., Sant'Ana, C.E.R. and Bini, L.M. (1998). An eigenvector method for estimating phylogenetic inertia. Evolution 52:1247-1262.

Legendre, P. and Legendre, L. (1998). Numerical ecology, 2nd Englished. Elsevier.

Diniz-filho, J.A.F., Rangel, T.F., Santos, T. and Bini, L.M. (2012). Exploring patterns of interespecific variation in quantitative traits using sequential phylogenetic eigenvector regressions. Evolution, 66(4):1079-1090.

Diniz-filho, J.A.F., Bini, L.M., Rangel, T.F., Morales-Castilla, I., Olalla-Tarraga, M.A., Rodriguez, M.A. and Hawkins, B.A. (2012). On the selection of phylogenetic eigenvectors for ecological analyses. Ecography, 35:239-249.

See Also

PVR-class, PVR, PSR, PVRdecomp, PSRplot, VarPartplot

Examples

showClass("PSR")

Plot function for objects of class PSR

Description

Plot PSR curve along with null and neutral expectations curves.

Usage

PSRplot(x, info = c("area", "null", "Brownian", "both"), ...)

Arguments

x

An object of class PSR

info

Type of information to be ploted. It can be "area" (to plot only the PSR curve), "null" (to plot PSR curve and null PSR curve), "neutral" (to plot PSR curve and neutral PSR curve) and "both" (to plot PSR curve and both null and neutral PSR curve).

...

Parameters passed to the plot function.

Author(s)

Santos, T; Diniz-Filho, J.A.F.; Rangel, T.F.; Bini, L.M.

References

Diniz-Filho, J.A.F., Sant'Ana, C.E.R. and Bini, L.M. (1998). An eigenvector method for estimating phylogenetic inertia. Evolution 52:1247-1262.

Diniz-filho, J.A.F., Rangel, T.F., Santos, T. and Bini, L.M. (2012). Exploring patterns of interespecific variation in quantitative traits using sequential phylogenetic eigenvector regressions. Evolution, 66(4):1079-1090.

Diniz-filho, J.A.F., Bini, L.M., Rangel, T.F., Morales-Castilla, I., Olalla-Tarraga, M.A., Rodriguez, M.A. and Hawkins, B.A. (2012). On the selection of phylogenetic eigenvectors for ecological analyses. Ecography, 35:239-249.

See Also

PSR, PVRdecomp, PVR, VarPartplot

Examples

library(splancs)
#Creating a 10 tips ultrametric random phylogeny
library(ape)
tree <- rcoal(10)
#Decomposing phylogenetic distance matrix derived from tree into a set of orthogonal vectors
x <- PVRdecomp(tree)
trait <- runif(10)
res <- PSR(x, trait = trait, null.model = TRUE, Brownian.model = TRUE, times = 10)
PSRplot(res, info = "both")

Phylogenetic eigenvectors regression.

Description

The phylogenetic eigenvector regression (PVR) starts by performing an eigendecomposition of a pairwise double-centered phylogenetic distance matrix between species. The eigenvectors (representing the traits under analysis) estimated values express phylogenetic trends in data and residuals express independent evolution of each species.

Usage

PVR(x,phy,trait,envVar,method="moran",weights,
scaled=FALSE,sig=TRUE,sig.t=0.05,MI.t=0.05,psr.t=0.01,
accvalue.t=0.9,...)

Arguments

x

An object of class PVR (created by the PVRdecomp function) or class PSR (requiered by the "PSR" method).

phy

An object of class phylo that contains an ultrametric phylogeny.

trait

A vector, data frame or matrix that contains traits sets (for data frames and matrices, each column must represent a trait set).

envVar

A vector, data frame or matrix that contains environmental variables. Used to estimates the variation of a trait set that is explained by phylogeny and by environment.

method

Character string. A name for the eigenvectors selection method. It can be "moran", "stepwise", "psr" or "sequential".

weights

Weighting matrix based on Phylogenetic distances used in the "moran" method. If no weights matrix is provided, weights will be set to max(D) - Dij, where D is the phylogenetic distance matrix.

scaled

Logical. Should the phylogenetic distances be scaled into the range of 0 to 1. Default is FALSE.

sig

Logical. Should the eigenvectors selected by the "moran" method be selected by the significance of residuals autocorrelation. If FALSE the eigenvectors will be selected by Moran's I values.

MI.t

Minimum residuals Moran's I value used to select eigenvectors when significance is FALSE.

sig.t

The significance treshold used to select eigenvectors by the "moran" method.

psr.t

The minimum acumulate R2 gain treshold used to select eigenvectors by the "PSR" method.

accvalue.t

Relative accumulated eigenvalue treshold use to select the eigenvectors by the "sequential" method.

...

Parameters passed to the stepwise regression used in the "AIC" method

Value

A PVR class object.

Author(s)

Santos, T; Diniz-Filho, J.A.F.; Rangel, T.F.; Bini, L.M.

References

Diniz-Filho, J.A.F., Sant'Ana, C.E.R. and Bini, L.M. (1998). An eigenvector method for estimating phylogenetic inertia. Evolution, 52:1247-1262.

Legendre, P. and Legendre, L. (1998). Numerical ecology, 2nd Englished. Elsevier.

Desdevises, Y., Legendre, P., Azouzi, L. and Morand, S. (2003). Quantifying phylogenetic structured environmental variation, Evolution, 57(11):2647-2652

Diniz-filho, J.A.F., Rangel, T.F., Santos, T. and Bini, L.M. (2012). Exploring patterns of interespecific variation in quantitative traits using sequential phylogenetic eigenvector regressions. Evolution, 66(4):1079-1090.

Diniz-filho, J.A.F., Bini, L.M., Rangel, T.F., Morales-Castilla, I., Olalla-Tarraga, M.A., Rodriguez, M.A. and Hawkins, B.A. (2012). On the selection of phylogenetic eigenvectors for ecological analyses. Ecography, 35:239-249.

See Also

PSR, PVRdecomp, PSRplot, VarPartplot

Examples

library(ape)
tree <- rcoal(10)
#Decomposing phylogenetic distance matrix derived from tree into a set of orthogonal vectors
x <- PVRdecomp(tree)
trait <- runif(10)
y <- PVR(x, trait = trait, method = "moran")
str(y)

Class "PVR"

Description

A S4 class that contains eigenvalues and eigenvectors from decomposition of a phylogenetic distance matrix and PVR r squared and residuals.

Objects from the Class

Objects can be created by calls of the form new("PVR", ...).

Slots

Eigen:

Object of class "list" that contains the eigenvalues and eigenvectors generated by phylogenetic distance matrix eigendecomposition.

phyDist:

Object of class "matrix" that contains a phylogenetic distance matrix.

phylo:

Object of class "phylo" that contains a phylogeny.

Selection:

Object of class "list" that contains the selection method (along with its statistics) used to select the vectors, the selected vectors IDs and a matrix that contains the selected vectors.

PVR:

Object of class "list" that contains the Philogenetic EigenVectors Regression r squared and residuals.

VarPart:

Object of class "list" that contains the variation partition components.

Methods

show

signature(object = "PVR"): Always print the Eigen slot.

Author(s)

Santos, T; Diniz-Filho, J.A.F.; Rangel, T.F.; Bini, L.M.

References

Diniz-Filho, J.A.F., Sant'Ana, C.E.R. and Bini, L.M. (1998). An eigenvector method for estimating phylogenetic inertia. Evolution 52:1247-1262.

Legendre, P. and Legendre, L. (1998). Numerical ecology, 2nd Englished. Elsevier.

Diniz-filho, J.A.F., Rangel, T.F., Santos, T. and Bini, L.M. (2012). Exploring patterns of interespecific variation in quantitative traits using sequential phylogenetic eigenvector regressions. Evolution, 66(4):1079-1090.

Diniz-filho, J.A.F., Bini, L.M., Rangel, T.F., Morales-Castilla, I., Olalla-Tarraga, M.A., Rodriguez, M.A. and Hawkins, B.A. (2012). On the selection of phylogenetic eigenvectors for ecological analyses. Ecography, 35:239-249.

See Also

PSR-class, PVR, PSR, PVRdecomp, PSRplot, VarPartplot

Examples

showClass("PVR")

Phylogenetic distances matrix (eigen)decomposition.

Description

The PVRdecomp function decompose phylogenetic distance matrices (computed based on phylogenies) into a set of orthongonal eigenvectors

Usage

PVRdecomp(phy, type = "newick", dist = NULL, scale = FALSE, ...)

Arguments

phy

An object of class phylo that contains a ultrametric phylogeny with branch lengths or a character string that represents a phylogeny file (must have full path) of type given by type.

type

A character string with the phylogeny file format. It can be "newick" or "nexus". Used only if phy is a character string, ignored otherwise.

dist

A phylogenetic distance matrix. Not used.

scale

Logical. Should the phylogenetic distances be scaled into the range of 0 to 1. Default is FALSE.

...

Not used.

Value

The PVRdecomp funtion returns a object of (S4) class PVR with an Eigen slot that contains eigenvalues and eigenvectors computed after the matrix decomposition.

Author(s)

Santos, T; Diniz-Filho, J.A.F.; Rangel, T.F.; Bini, L.M.

References

Diniz-Filho, J.A.F., Sant'Ana, C.E.R. and Bini, L.M. (1998). An eigenvector method for estimating phylogenetic inertia. Evolution 52:1247-1262.

Diniz-filho, J.A.F., Rangel, T.F., Santos, T. and Bini, L.M. (2012). Exploring patterns of interespecific variation in quantitative traits using sequential phylogenetic eigenvector regressions. Evolution, 66(4):1079-1090.

Diniz-filho, J.A.F., Bini, L.M., Rangel, T.F., Morales-Castilla, I., Olalla-Tarraga, M.A., Rodriguez, M.A. and Hawkins, B.A. (2012). On the selection of phylogenetic eigenvectors for ecological analyses. Ecography, 35:239-249.

See Also

PVR, PSR

Examples

library(ape)
tree <- rcoal(10)
#Decomposing phylogenetic distance matrix derived from tree into a set of orthogonal vectors
x <- PVRdecomp(tree, scale = TRUE)
str(x)

Plot function for objects of class PVR to show variation partition components.

Description

Plot a, b, c and d components of traits variation partition between phylogeny and environment (as defined by Desdevises et al., 2003).

Usage

VarPartplot(x, ...)

Arguments

x

An object of class PVR with a non NULL slot VarPart.

...

Parameters passed to the plot function.

Author(s)

Santos, T; Diniz-Filho, J.A.F.; Rangel, T.F.; Bini, L.M.

References

Diniz-Filho, J.A.F., Sant'Ana, C.E.R. and Bini, L.M. (1998). An eigenvector method for estimating phylogenetic inertia. Evolution 52:1247-1262.

Legendre, P. and Legendre, L. (1998). Numerical ecology, 2nd Englished. Elsevier.

Desdevises, Y., Legendre, P., Azouzi, L. and Morand, S. (2003). Quantifying phylogenetic structured environmental variation, Evolution, 57(11):2647-2652.

Diniz-filho, J.A.F., Rangel, T.F., Santos, T. and Bini, L.M. (2012). Exploring patterns of interespecific variation in quantitative traits using sequential phylogenetic eigenvector regressions. Evolution, 66(4):1079-1090.

Diniz-filho, J.A.F., Bini, L.M., Rangel, T.F., Morales-Castilla, I., Olalla-Tarraga, M.A., Rodriguez, M.A. and Hawkins, B.A. (2012). On the selection of phylogenetic eigenvectors for ecological analyses. Ecography, 35:239-249.

See Also

PSR, PVRdecomp, PVR, PSRplot

Examples

library(ape)
tree <- rcoal(10)
#Decomposing phylogenetic distance matrix derived from tree into a set of orthogonal vectors
x <- PVRdecomp(tree)
trait <- runif(10)
envvar <- runif(10)
y <- PVR(x, trait = trait, envVar = envvar, method = "moran")
VarPartplot(y)