- CHANGES IN APE VERSION 2.1-4
+ CHANGES IN APE VERSION 2.2
NEW FEATURES
subtreeplot), and to return the graphical coordinates of tree
(without plotting).
+ o The new function corPagel() implements the Pagel's "lambda"
+ correlation structure.
+
BUG FIXES
Package: ape
-Version: 2.1-4
-Date: 2008-04-17
+Version: 2.2
+Date: 2008-04-18
Title: Analyses of Phylogenetics and Evolution
Author: Emmanuel Paradis, Ben Bolker, Julien Claude, Hoa Sien Cuong,
Richard Desper, Benoit Durand, Julien Dutheil, Olivier Gascuel,
-## PGLS.R (2006-10-12)
+## PGLS.R (2008-04-18)
## Phylogenetic Generalized Least Squares
-## Copyright 2004 Julien Dutheil, and 2006 Emmanuel Paradis
+## Copyright 2004 Julien Dutheil, and 2006-2008 Emmanuel Paradis
## This file is part of the R-package `ape'.
## See the file ../COPYING for licensing issues.
return(phy)
}
}
+
+### by EP:
+
+corPagel <- function(value, phy, form = ~1, fixed = FALSE)
+{
+ if (value < 0 || value > 1)
+ stop("the value of lambda must be between 0 and 1.")
+ if (!("phylo" %in% class(phy)))
+ stop('object "phy" is not of class "phylo"')
+ attr(value, "formula") <- form
+ attr(value, "fixed") <- fixed
+ attr(value, "tree") <- phy
+ class(value) <- c("corPagel", "corPhyl", "corStruct")
+ value
+}
+
+corMatrix.corPagel <-
+ function(object, covariate = getCovariate(object), corr = TRUE, ...)
+{
+ if (!any(attr(object, "index")))
+ stop("object has not been initialized")
+ mat <- vcv.phylo(attr(object, "tree"), cor = corr)
+ index <- attr(object, "index")
+ mat <- mat[index, index]
+ tmp <- diag(mat)
+ mat <- object[1]*mat
+ diag(mat) <- tmp
+ mat
+}
+
+coef.corPagel <- function(object, unconstrained = TRUE, ...)
+{
+ if (unconstrained) {
+ if (attr(object, "fixed")) return(numeric(0))
+ else return(object[1])
+ }
+ aux <- object[1]
+ names(aux) <- "lambda"
+ aux
+}
\alias{floating.pie.asp}
\alias{checkLabel}
\alias{getMRCA}
+\alias{plot.cophylo2}
+\alias{plot.phylo.coor}
\title{Internal Ape Functions}
\description{
Internal ape functions.
\alias{corPhyl}
\title{Phylogenetic Correlation Structures}
\description{
- Standard classes of phylogenetic correlation structures (\code{corPhyl}) available in \pkg{ape}.
-}
-\value{
- Available standard classes:
- \item{corBrownian}{Brownian model (Felsenstein 1985),}
- \item{corMartins}{The covariance matrix defined in Martins and Hansen (1997),}
- \item{corGrafen}{The covariance matrix defined in Grafen (1989).}
- See classes documentation for reference and detailed description.
+ Classes of phylogenetic correlation structures (\code{"corPhyl"})
+ available in \pkg{ape}.
+
+ \item{corBrownian}{Brownian motion model (Felsenstein 1985)}
+ \item{corMartins}{The covariance matrix defined in Martins and Hansen
+ (1997)}
+ \item{corGrafen}{The covariance matrix defined in Grafen (1989)}
+ \item{corPagel}{The covariance matrix defined in Freckelton et al. (2002)}
+
+ See the help page of each class for references and detailed
+ description.
}
\seealso{
- \code{\link[nlme]{corClasses}} and \code{\link[nlme]{gls}} in the \pkg{nlme} librarie,
- \code{\link{corBrownian}}, \code{\link{corMartins}}, \code{\link{corGrafen}}.
+ \code{\link[nlme]{corClasses}} and \code{\link[nlme]{gls}} in the
+ \pkg{nlme} librarie, \code{\link{corBrownian}},
+ \code{\link{corMartins}}, \code{\link{corGrafen}},
+ \code{\link{corPagel}}
}
-\author{Julien Dutheil \email{julien.dutheil@univ-montp2.fr}}
+\author{Julien Dutheil \email{julien.dutheil@univ-montp2.fr}, Emmanuel
+ Paradis}
\examples{
library(nlme)
cat("((((Homo:0.21,Pongo:0.21):0.28,",
--- /dev/null
+\name{corPagel}
+\alias{corPagel}
+\alias{coef.corPagel}
+\alias{corMatrix.corPagel}
+\title{Pagel's ``lambda'' Correlation Structure}
+\usage{
+corPagel(value, phy, form = ~1, fixed = FALSE)
+\method{corMatrix}{corPagel}(object, covariate = getCovariate(object),
+ corr = TRUE, ...)
+\method{coef}{corPagel}(object, unconstrained = TRUE, \dots)
+}
+\arguments{
+ \item{value}{the (initial) value of the parameter
+ \eqn{\gamma}{gamma}.}
+ \item{phy}{an object of class \code{"phylo"}.}
+ \item{form}{(ignored).}
+ \item{fixed}{a logical specifying whether \code{gls} should
+ estimate \eqn{\gamma}{gamma} (the default) or keep it fixed.}
+ \item{object}{an (initialized) object of class \code{"corPagel"}.}
+ \item{covariate}{(ignored).}
+ \item{corr}{a logical value specifying whether to return the
+ correlation matrix (the default) or the variance-covariance matrix.}
+ \item{unconstrained}{a logical value. If \code{TRUE} (the default),
+ the coefficients are returned in unconstrained form (the same used
+ in the optimization algorithm). If \code{FALSE} the coefficients are
+ returned in ``natural'', possibly constrained, form.}
+ \item{\dots}{further arguments passed to or from other methods.}
+}
+\description{
+ The correlation structure from the present model is derived from the
+ Brownian motion model by multiplying the off-diagonal elements (i.e.,
+ the covariances) by \eqn{\gamma}{gamma}. The variances are thus the
+ same than for a Brownian motion model.
+}
+\value{
+ an object of class \code{"corPagel"}, the coefficients from an object
+ of this class, or the correlation matrix of an initialized object of
+ this class. In most situations, only \code{corPagel()} will be called
+ by the user.
+}
+\author{Emmanuel Paradis}
+\references{
+ Freckleton, R. P., Harvey, P. H. and M. Pagel, M. (2002) Phylogenetic
+ analysis and comparative data: a test and review of evidence.
+ \emph{American Naturalist}, \bold{160}, 712--726.
+
+ Pagel, M. (1999) Inferring the historical patterns of biological
+ evolution. \emph{Nature}, \bold{401},877--884.
+}
+\keyword{models}