[Adephylo-commits] r71 - in pkg: R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Dec 2 17:36:09 CET 2008
Author: jombart
Date: 2008-12-02 17:36:09 +0100 (Tue, 02 Dec 2008)
New Revision: 71
Modified:
pkg/R/orthobasis.R
pkg/R/orthogram.R
pkg/man/orthobasis.Rd
pkg/man/orthogram.Rd
pkg/man/proxTips.Rd
Log:
Some arguments fixed (distinction Abouheif/oriAbouheif)
Modified: pkg/R/orthobasis.R
===================================================================
--- pkg/R/orthobasis.R 2008-12-02 16:23:11 UTC (rev 70)
+++ pkg/R/orthobasis.R 2008-12-02 16:36:09 UTC (rev 71)
@@ -2,7 +2,7 @@
# orthobasis.phylo
###################
orthobasis.phylo <- function(x=NULL, prox=NULL,
- method=c("patristic","nNodes","Abouheif","sumDD"), a=1){
+ method=c("patristic","nNodes","oriAbouheif","Abouheif","sumDD"), a=1){
if(!require(phylobase)) stop("phylobase package is not installed")
if(!require(ade4)) stop("ade4 package is not installed")
Modified: pkg/R/orthogram.R
===================================================================
--- pkg/R/orthogram.R 2008-12-02 16:23:11 UTC (rev 70)
+++ pkg/R/orthogram.R 2008-12-02 16:36:09 UTC (rev 71)
@@ -1,195 +1,196 @@
orthogram <- function (x, orthobas = NULL, prox = NULL,
nrepet = 999, posinega = 0, tol = 1e-07, cdot = 1.5,
cfont.main = 1.5, lwd = 2, nclass,
- high.scores = 0,alter=c("greater", "less", "two-sided"))
-{
- if(is.numeric(x)&is.vector(x)){
- type <- "numeric"
- ## } else if(is.factor(x)){
- ## type <- "factor"
- ## } else if (inherits(x, "dudi")){
- ## type <- "dudi"
- } else {
- ## stop("x must be a numeric vector, a factor or a dudi object")
- stop("x must be a numeric vector")
- }
- ## if(type == "dudi") {
- ## nobs <- nrow(x$tab)
- ## } else {
- ## nobs <- length(x)
- ## }
- ## if (!is.null(neig)) {
- ## orthobas <- scores.neig(neig)
- ## } else if (!is.null(phylog)) {
- ## if (!inherits(phylog, "phylog")) stop ("'phylog' expected with class 'phylog'")
- ## orthobas <- phylog$Bscores
- ## }
+ high.scores = 0,alter=c("greater", "less", "two-sided")){
- ## if (is.null(orthobas)){
- ## stop ("'orthobas','neig','phylog' all NULL")
- ## }
+ if(!require(ade4)) stop("The ade4 package is not installed.")
+ if(is.numeric(x)&is.vector(x)){
+ type <- "numeric"
+ ## } else if(is.factor(x)){
+ ## type <- "factor"
+ ## } else if (inherits(x, "dudi")){
+ ## type <- "dudi"
+ } else {
+ ## stop("x must be a numeric vector, a factor or a dudi object")
+ stop("x must be a numeric vector")
+ }
+ ## if(type == "dudi") {
+ ## nobs <- nrow(x$tab)
+ ## } else {
+ ## nobs <- length(x)
+ ## }
+ ## if (!is.null(neig)) {
+ ## orthobas <- scores.neig(neig)
+ ## } else if (!is.null(phylog)) {
+ ## if (!inherits(phylog, "phylog")) stop ("'phylog' expected with class 'phylog'")
+ ## orthobas <- phylog$Bscores
+ ## }
- ## retrieve the orthobasis from a proximity matrix
- if(is.null(orthobas)){
- if(is.null(prox)) stop("Neither orthobas or prox are provided.")
- orthobas <- orthobasis.phylo(prox=prox)
- }
+ ## if (is.null(orthobas)){
+ ## stop ("'orthobas','neig','phylog' all NULL")
+ ## }
- if (!inherits(orthobas, "data.frame")) stop ("'orthobas' is not a data.frame")
- if (nrow(orthobas) != nobs) stop ("non convenient dimensions")
- if (ncol(orthobas) != (nobs-1)) stop (paste("'orthobas' has",ncol(orthobas),"columns, expected:",nobs-1))
- vecpro <- as.matrix(orthobas)
- npro <- ncol(vecpro)
+ ## retrieve the orthobasis from a proximity matrix
+ if(is.null(orthobas)){
+ if(is.null(prox)) stop("Neither orthobas or prox are provided.")
+ orthobas <- orthobasis.phylo(prox=prox)
+ }
- w <- t(vecpro/nobs)%*%vecpro
- if (any(abs(diag(w)-1)>tol)) {
+ if (!inherits(orthobas, "data.frame")) stop ("'orthobas' is not a data.frame")
+ if (nrow(orthobas) != nobs) stop ("non convenient dimensions")
+ if (ncol(orthobas) != (nobs-1)) stop (paste("'orthobas' has",ncol(orthobas),"columns, expected:",nobs-1))
+ vecpro <- as.matrix(orthobas)
+ npro <- ncol(vecpro)
- stop("'orthobas' is not orthonormal for uniform weighting")
- }
- diag(w) <- 0
- if ( any( abs(as.numeric(w))>tol) )
- stop("'orthobas' is not orthogonal for uniform weighting")
- if (nrepet < 99) nrepet <- 99
- if (posinega !=0) {
- if (posinega >= nobs-1) stop ("Non convenient value in 'posinega'")
- if (posinega <0) stop ("Non convenient value in 'posinega'")
- }
- if(type!="dudi"){
- if (any(is.na(x)))
- stop("missing value in 'x'")
- }
- if(type == "factor"){
- dudi1 <- dudi.acm(data.frame(x), scannf = F, nf = min(nobs, nlevels(x)))
- }
- if(type == "dudi") {
- if (!all.equal(x$lw, rep(1/nobs, nobs)))
- stop("not implemented for non-uniform row weights")
- dudi1 <- redo.dudi(x, newnf = x$rank)
- if(any(colMeans(dudi1$li)>tol))
- stop("not implemented for non-centered analysis")
- }
+ w <- t(vecpro/nobs)%*%vecpro
+ if (any(abs(diag(w)-1)>tol)) {
- if(type == "numeric") {
- z <- x - mean(x)
- et <- sqrt(mean(z * z))
- if ( et <= tol*(max(z)-min(z))) stop ("No variance")
- z <- z/et
- w <- .C("VarianceDecompInOrthoBasis",
- param = as.integer(c(nobs,npro,nrepet,posinega)),
- observed = as.double(z),
- vecpro = as.double(vecpro),
- phylogram = double(npro),
- phylo95 = double(npro),
- sig025 = double(npro),
- sig975 = double(npro),
- R2Max = double(nrepet+1),
- SkR2k = double(nrepet+1),
- Dmax = double(nrepet+1),
- SCE = double(nrepet+1),
- ratio = double(nrepet+1),
- PACKAGE="ade4"
- )
- } else {
- w <- .C("MVarianceDecompInOrthoBasis",
- param = as.integer(c(nobs,npro,nrepet,posinega)),
- observed = as.double(as.matrix(dudi1$li)),
- nvar = as.integer(ncol(dudi1$li)),
- inertot = as.double(sum(dudi1$eig)),
- vecpro = as.double(vecpro),
- phylogram = double(npro),
- phylo95 = double(npro),
- sig025 = double(npro),
- sig975 = double(npro),
- R2Max = double(nrepet+1),
- SkR2k = double(nrepet+1),
- Dmax = double(nrepet+1),
- SCE = double(nrepet+1),
- ratio = double(nrepet+1),
- PACKAGE="adephylo"
- )
- }
- ##return(w$phylogram)
- ## multiple graphical window (6 graphs)
- ## 1 pgram
- ## 2 cumulated pgram
- ## 3-6 Randomization tests
+ stop("'orthobas' is not orthonormal for uniform weighting")
+ }
+ diag(w) <- 0
+ if ( any( abs(as.numeric(w))>tol) )
+ stop("'orthobas' is not orthogonal for uniform weighting")
+ if (nrepet < 99) nrepet <- 99
+ if (posinega !=0) {
+ if (posinega >= nobs-1) stop ("Non convenient value in 'posinega'")
+ if (posinega <0) stop ("Non convenient value in 'posinega'")
+ }
+ if(type!="dudi"){
+ if (any(is.na(x)))
+ stop("missing value in 'x'")
+ }
+ if(type == "factor"){
+ dudi1 <- dudi.acm(data.frame(x), scannf = F, nf = min(nobs, nlevels(x)))
+ }
+ if(type == "dudi") {
+ if (!all.equal(x$lw, rep(1/nobs, nobs)))
+ stop("not implemented for non-uniform row weights")
+ dudi1 <- redo.dudi(x, newnf = x$rank)
+ if(any(colMeans(dudi1$li)>tol))
+ stop("not implemented for non-centered analysis")
+ }
- def.par <- par(no.readonly = TRUE)
- on.exit(par(def.par))
- layout (matrix(c(1,1,2,2,1,1,2,2,3,4,5,6),4,3))
- par(mar = c(0.1, 0.1, 0.1, 0.1))
- par(usr = c(0,1,-0.05,1))
+ if(type == "numeric") {
+ z <- x - mean(x)
+ et <- sqrt(mean(z * z))
+ if ( et <= tol*(max(z)-min(z))) stop ("No variance")
+ z <- z/et
+ w <- .C("VarianceDecompInOrthoBasis",
+ param = as.integer(c(nobs,npro,nrepet,posinega)),
+ observed = as.double(z),
+ vecpro = as.double(vecpro),
+ phylogram = double(npro),
+ phylo95 = double(npro),
+ sig025 = double(npro),
+ sig975 = double(npro),
+ R2Max = double(nrepet+1),
+ SkR2k = double(nrepet+1),
+ Dmax = double(nrepet+1),
+ SCE = double(nrepet+1),
+ ratio = double(nrepet+1),
+ PACKAGE="ade4"
+ )
+ } else {
+ w <- .C("MVarianceDecompInOrthoBasis",
+ param = as.integer(c(nobs,npro,nrepet,posinega)),
+ observed = as.double(as.matrix(dudi1$li)),
+ nvar = as.integer(ncol(dudi1$li)),
+ inertot = as.double(sum(dudi1$eig)),
+ vecpro = as.double(vecpro),
+ phylogram = double(npro),
+ phylo95 = double(npro),
+ sig025 = double(npro),
+ sig975 = double(npro),
+ R2Max = double(nrepet+1),
+ SkR2k = double(nrepet+1),
+ Dmax = double(nrepet+1),
+ SCE = double(nrepet+1),
+ ratio = double(nrepet+1),
+ PACKAGE="adephylo"
+ )
+ }
+ ##return(w$phylogram)
+ ## multiple graphical window (6 graphs)
+ ## 1 pgram
+ ## 2 cumulated pgram
+ ## 3-6 Randomization tests
+ def.par <- par(no.readonly = TRUE)
+ on.exit(par(def.par))
+ layout (matrix(c(1,1,2,2,1,1,2,2,3,4,5,6),4,3))
+ par(mar = c(0.1, 0.1, 0.1, 0.1))
+ par(usr = c(0,1,-0.05,1))
- ylim <- max(c(w$phylogram, w$phylo95))
- names(w$phylogram) <- as.character(1:npro)
- phylocum <- cumsum(w$phylogram)
- lwd0=2
- fun <- function (y, last=FALSE) {
- delta <- (mp[2]-mp[1])/3
- sel <- 1:(npro - 1)
- segments(mp[sel]-delta,y[sel],mp[sel]+delta, y[sel],lwd=lwd0)
- if(last) segments(mp[npro]-delta,y[npro],mp[npro]+delta, y[npro],lwd=lwd0)
- }
- sig50 <- (1:npro)/npro
- y0 <- phylocum - sig50
- h.obs <- max(y0)
- x0 <- min(which(y0 == h.obs))
- par(mar = c(3.1, 2.5, 2.1, 2.1))
- if(type == "numeric"){
- z0 <- apply(vecpro, 2, function(x) sum(z * x))
- mp <- barplot(w$phylogram, col = grey(1 - 0.3 * (sign(z0) > 0)), ylim = c(0, ylim * 1.05))
- } else {
- mp <- barplot(w$phylogram, ylim = c(0, ylim * 1.05))
- }
- scores.order <- (1:length(w$phylogram))[order(w$phylogram, decreasing=TRUE)[1:high.scores]]
- fun(w$phylo95,TRUE)
- abline(h = 1/npro)
- if (posinega!=0) {
- verti = (mp[posinega]+mp[posinega+1])/2
- abline (v=verti, col="red",lwd=1.5)
- }
- title(main = "Variance decomposition",font.main=1, cex.main=cfont.main)
- box()
- obs0 <- rep(0, npro)
- names(obs0) <- as.character(1:npro)
- barplot(obs0, ylim = c(-0.05, 1.05))
- abline(h=0,col="white")
- if (posinega!=0) {
- verti = (mp[posinega]+mp[posinega+1])/2
- abline (v=verti, col="red",lwd=1.5)
- }
- title(main = "Cumulative decomposition",font.main=1, cex.main=cfont.main)
- points(mp, phylocum, pch = 21, cex = cdot, type = "b")
- segments(mp[1], 1/npro, mp[npro], 1, lty = 1)
- fun(w$sig975)
- fun(w$sig025)
- arrows(mp[x0], sig50[x0], mp[x0], phylocum[x0], ang = 15, le = 0.15,
- lwd = 2)
- box()
- if (missing(nclass)) {
- nclass <- as.integer (nrepet/25)
- nclass <- min(c(nclass,40))
- }
- plot.randtest (as.randtest (w$R2Max[-1],w$R2Max[1],call=match.call()),main = "R2Max",nclass=nclass)
- if (posinega !=0) {
- plot.randtest (as.randtest (w$ratio[-1],w$ratio[1],call=match.call()),main = "Ratio",nclass=nclass)
- } else {
- plot.randtest (as.randtest (w$SkR2k[-1],w$SkR2k[1],call=match.call()),main = "SkR2k",nclass=nclass)
- }
- plot.randtest (as.randtest (w$Dmax[-1],w$Dmax[1],call=match.call()),main = "DMax",nclass=nclass)
- plot.randtest (as.randtest (w$SCE[-1],w$SCE[1],call=match.call()),main = "SCE",nclass=nclass)
+ ylim <- max(c(w$phylogram, w$phylo95))
+ names(w$phylogram) <- as.character(1:npro)
+ phylocum <- cumsum(w$phylogram)
+ lwd0=2
+ fun <- function (y, last=FALSE) {
+ delta <- (mp[2]-mp[1])/3
+ sel <- 1:(npro - 1)
+ segments(mp[sel]-delta,y[sel],mp[sel]+delta, y[sel],lwd=lwd0)
+ if(last) segments(mp[npro]-delta,y[npro],mp[npro]+delta, y[npro],lwd=lwd0)
+ }
+ sig50 <- (1:npro)/npro
+ y0 <- phylocum - sig50
+ h.obs <- max(y0)
+ x0 <- min(which(y0 == h.obs))
+ par(mar = c(3.1, 2.5, 2.1, 2.1))
+ if(type == "numeric"){
+ z0 <- apply(vecpro, 2, function(x) sum(z * x))
+ mp <- barplot(w$phylogram, col = grey(1 - 0.3 * (sign(z0) > 0)), ylim = c(0, ylim * 1.05))
+ } else {
+ mp <- barplot(w$phylogram, ylim = c(0, ylim * 1.05))
+ }
+ scores.order <- (1:length(w$phylogram))[order(w$phylogram, decreasing=TRUE)[1:high.scores]]
+ fun(w$phylo95,TRUE)
+ abline(h = 1/npro)
+ if (posinega!=0) {
+ verti = (mp[posinega]+mp[posinega+1])/2
+ abline (v=verti, col="red",lwd=1.5)
+ }
+ title(main = "Variance decomposition",font.main=1, cex.main=cfont.main)
+ box()
+ obs0 <- rep(0, npro)
+ names(obs0) <- as.character(1:npro)
+ barplot(obs0, ylim = c(-0.05, 1.05))
+ abline(h=0,col="white")
+ if (posinega!=0) {
+ verti = (mp[posinega]+mp[posinega+1])/2
+ abline (v=verti, col="red",lwd=1.5)
+ }
- w$param <- w$observed <- w$vecpro <- NULL
- w$phylo95 <- w$sig025 <- w$sig975 <- NULL
- if (posinega==0) {
- w <- as.krandtest(obs=c(w$R2Max[1],w$SkR2k[1],w$Dmax[1],w$SCE[1]),sim=cbind(w$R2Max[-1],w$SkR2k[-1],w$Dmax[-1],w$SCE[-1]),names=c("R2Max","SkR2k","Dmax","SCE"),alter=alter,call=match.call())
- } else {
- w <- as.krandtest(obs=c(w$R2Max[1],w$SkR2k[1],w$Dmax[1],w$SCE[1],w$ratio[1]),sim=cbind(w$R2Max[-1],w$SkR2k[-1],w$Dmax[-1],w$SCE[-1],w$ratio[-1]),names=c("R2Max","SkR2k","Dmax","SCE","ratio"),alter=alter,call=match.call())
- }
+ title(main = "Cumulative decomposition",font.main=1, cex.main=cfont.main)
+ points(mp, phylocum, pch = 21, cex = cdot, type = "b")
+ segments(mp[1], 1/npro, mp[npro], 1, lty = 1)
+ fun(w$sig975)
+ fun(w$sig025)
+ arrows(mp[x0], sig50[x0], mp[x0], phylocum[x0], ang = 15, le = 0.15,
+ lwd = 2)
+ box()
+ if (missing(nclass)) {
+ nclass <- as.integer (nrepet/25)
+ nclass <- min(c(nclass,40))
+ }
+ plot.randtest (as.randtest (w$R2Max[-1],w$R2Max[1],call=match.call()),main = "R2Max",nclass=nclass)
+ if (posinega !=0) {
+ plot.randtest (as.randtest (w$ratio[-1],w$ratio[1],call=match.call()),main = "Ratio",nclass=nclass)
+ } else {
+ plot.randtest (as.randtest (w$SkR2k[-1],w$SkR2k[1],call=match.call()),main = "SkR2k",nclass=nclass)
+ }
+ plot.randtest (as.randtest (w$Dmax[-1],w$Dmax[1],call=match.call()),main = "DMax",nclass=nclass)
+ plot.randtest (as.randtest (w$SCE[-1],w$SCE[1],call=match.call()),main = "SCE",nclass=nclass)
- if (high.scores != 0)
- w$scores.order <- scores.order
- return(w)
-}
+ w$param <- w$observed <- w$vecpro <- NULL
+ w$phylo95 <- w$sig025 <- w$sig975 <- NULL
+ if (posinega==0) {
+ w <- as.krandtest(obs=c(w$R2Max[1],w$SkR2k[1],w$Dmax[1],w$SCE[1]),sim=cbind(w$R2Max[-1],w$SkR2k[-1],w$Dmax[-1],w$SCE[-1]),names=c("R2Max","SkR2k","Dmax","SCE"),alter=alter,call=match.call())
+ } else {
+ w <- as.krandtest(obs=c(w$R2Max[1],w$SkR2k[1],w$Dmax[1],w$SCE[1],w$ratio[1]),sim=cbind(w$R2Max[-1],w$SkR2k[-1],w$Dmax[-1],w$SCE[-1],w$ratio[-1]),names=c("R2Max","SkR2k","Dmax","SCE","ratio"),alter=alter,call=match.call())
+ }
+
+ if (high.scores != 0)
+ w$scores.order <- scores.order
+ return(w)
+} # end orthogram
Modified: pkg/man/orthobasis.Rd
===================================================================
--- pkg/man/orthobasis.Rd 2008-12-02 16:23:11 UTC (rev 70)
+++ pkg/man/orthobasis.Rd 2008-12-02 16:36:09 UTC (rev 71)
@@ -21,8 +21,8 @@
\code{\link{proxTips}}.
}
\usage{
-me.phylo(x=NULL, prox=NULL, method=c("patristic","nNodes","Abouheif","sumDD"), a=1)
-orthobasis.phylo(x=NULL, prox=NULL, method=c("patristic","nNodes","Abouheif","sumDD"), a=1)
+me.phylo(x=NULL, prox=NULL, method=c("patristic","nNodes","oriAbouheif","Abouheif","sumDD"), a=1)
+orthobasis.phylo(x=NULL, prox=NULL, method=c("patristic","nNodes","oriAbouheif","Abouheif","sumDD"), a=1)
}
\arguments{
\item{x}{A tree of class \code{\link[pkg:ape]{phylo}},
@@ -32,7 +32,9 @@
ambiguity) specifying the method used to compute proximities;
possible values are:\cr
- \code{patristic}: (inversed sum of) branch lengths \cr
- - \code{nNodes}: (inversed) number of nodes on the path between the nodes \cr
+ - \code{nNodes}: (inversed) number of nodes on the path between the
+ nodes \cr
+ - \code{oriAbouheif}: original Abouheif's proximity, with diagonal (see details) \cr
- \code{Abouheif}: Abouheif's proximity (see details) \cr
- \code{sumDD}: (inversed) sum of direct descendants of all nodes on the path
(see details in \code{\link{proxTips}}).}
Modified: pkg/man/orthogram.Rd
===================================================================
--- pkg/man/orthogram.Rd 2008-12-02 16:23:11 UTC (rev 70)
+++ pkg/man/orthogram.Rd 2008-12-02 16:36:09 UTC (rev 71)
@@ -3,14 +3,14 @@
\alias{orthogram}
\title{Orthonormal decomposition of variance}
\description{
-This function performs the orthonormal decomposition of variance of a quantitative variable on an orthonormal basis. It also returns the results of five non parametric tests associated to the variance decomposition.
+This function performs the orthonormal decomposition of variance of a quantitative variable on an orthonormal basis. It also returns the results of five non parametric tests associated to the variance decomposition.
It thus provides tools (graphical displays and test) for analysing phylogenetic, spatial and temporal pattern of one quantitative variable.
}
\usage{
-orthogram(x, orthobas = NULL, neig = NULL, phylog = NULL,
- nrepet = 999, posinega = 0, tol = 1e-07, na.action = c("fail",
- "mean"), cdot = 1.5, cfont.main = 1.5, lwd = 2, nclass,
- high.scores = 0,alter=c("greater", "less", "two-sided"))
+orthogram(x, orthobas = NULL, prox = NULL,
+ nrepet = 999, posinega = 0, tol = 1e-07, cdot = 1.5,
+ cfont.main = 1.5, lwd = 2, nclass,
+ high.scores = 0,alter=c("greater", "less", "two-sided"))
}
\arguments{
\item{x}{a numeric vector corresponding to the quantitative variable}
@@ -50,51 +50,30 @@
\references{
Ollier, S., Chessel, D. and Couteron, P. (2005) Orthonormal Transform to Decompose the Variance of a Life-History Trait across a Phylogenetic Tree. \emph{Biometrics}, \bold{62}, 471--477.
}
-\author{Sébastien Ollier \email{ollier at biomserv.univ-lyon1.fr} \cr
-Daniel Chessel
+\author{
+ Original code: Sébastien Ollier and Daniel Chessel.\cr
+ Current maintainer: St\ephane Dray <dray at biomserv.univ-lyon1.fr>
}
-\seealso{\code{\link{gridrowcol}}, \code{\link{orthobasis}}, \code{\link{mld}}}
+\seealso{
+ \code{\link{orthobasis.phylo}}
+}
\examples{
-# a phylogenetic example
+## a phylogenetic example
data(ungulates)
-ung.phy <- newick2phylog(ungulates$tre)
-FemBodyMass <- log(ungulates$tab[,1])
-NeonatBodyMass <- log((ungulates$tab[,2]+ungulates$tab[,3])/2)
-plot(FemBodyMass,NeonatBodyMass, pch = 20, cex = 2)
-abline(lm(NeonatBodyMass~FemBodyMass))
-z <- residuals(lm(NeonatBodyMass~FemBodyMass))
-dotchart.phylog(ung.phy,val = z, clabel.n = 1,
- labels.n = ung.phy$Blabels, cle = 1.5, cdot = 2)
-table.phylog(ung.phy$Bscores, ung.phy,clabel.n = 1,
- labels.n = ung.phy$Blabels)
-orthogram(z, ung.phy$Bscores)
-orthogram(z, phyl=ung.phy) # the same thing
+tre <- read.tree(text=ungulates$tre)
+plot(tre)
-# a spatial example
-data(irishdata)
-neig1 <- neig(mat01 = 1*(irishdata$link > 0))
-sco1 <- scores.neig(neig1)
-z <- scalewt(irishdata$tab$cow)
-orthogram(z, sco1)
+## look at two traits
+afbw <- log(ungulates$tab[,1])
+neonatw <- log((ungulates$tab[,2]+ungulates$tab[,3])/2)
+names(afbw) <- tre$tip.label
+names(neonatw) <- tre$tip.label
+plot(afbw, neonatw) # relationship between traits
+abline(lm(neonatw~afbw))
+x <- phylo4d(tre, cbind.data.frame(afbw, neonatw)) # traits on the phylogeny
-# a temporal example
-data(arrival)
-w <- orthobasis.circ(24)
-orthogram(arrival$hours, w)
-par(mfrow = c(1,2))
-dotcircle(arrival$hours)
-dotcircle(w[,2])
-par(mfrow = c(1,1))
+## orthogram for trait afbw
+prox <- proxTips(tre, method="Abouheif") # compute Abouheif's proximities
+orthogram(afbw, )
-data(lynx)
-ortho <- orthobasis.line(114)
-orthogram(lynx,ortho)
-attributes(lynx)$tsp
-par(mfrow = c(2,1))
-par(mar = c(4,4,2,2))
-plot.ts(lynx)
-plot(ts(ortho[,23], start = 1821, end = 1934, freq = 1), ylab = "score 23")
-par(mfrow = c(1,1))
}
-\keyword{spatial}
-\keyword{ts}
Modified: pkg/man/proxTips.Rd
===================================================================
--- pkg/man/proxTips.Rd 2008-12-02 16:23:11 UTC (rev 70)
+++ pkg/man/proxTips.Rd 2008-12-02 16:36:09 UTC (rev 71)
@@ -52,7 +52,7 @@
- \code{nNodes}: (inversed) number of nodes on the path between the nodes \cr
- \code{oriAbouheif}: original Abouheif's proximity, with diagonal (see details) \cr
- \code{Abouheif}: Abouheif's proximity without diagonal (see details) \cr
- - \code{sumDD}: (inversed) sum of direct descendants of all nodes on the path
+ - \code{sumDD}: (inversed) sum of direct descendants of all nodes on the path
(see details) \cr
}
\item{a}{the exponent used to compute the proximity}
More information about the Adephylo-commits
mailing list