[Adephylo-commits] r49 - in pkg: . R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Nov 27 17:15:38 CET 2008
Author: jombart
Date: 2008-11-27 17:15:37 +0100 (Thu, 27 Nov 2008)
New Revision: 49
Modified:
pkg/R/orthobasis.R
pkg/TODO
pkg/man/orthobasis.Rd
Log:
Fixed orthobasis, pkg passes the check.
Modified: pkg/R/orthobasis.R
===================================================================
--- pkg/R/orthobasis.R 2008-11-27 14:52:39 UTC (rev 48)
+++ pkg/R/orthobasis.R 2008-11-27 16:15:37 UTC (rev 49)
@@ -24,29 +24,13 @@
n <- nrow(W)
- ## main computation
- W0 <- bicenter.wt(W)
- decomp <- eigen(W0, sym=TRUE)
- E <- decomp$vectors # Moran eigenvectors (ME)
- ## must be re-orthogonalized
- temp <- cbind(rep(1,n) , E)
- temp <- qr.Q(qr(temp))
- E <- as.data.frame(temp[,-1])*sqrt(n)
- row.names(E) <- rownames(W)
- names(E) <- paste("ME", 1:ncol(E), sep=".")
+ ## main computation -> call to orthobasis.mat
+ res <- orthobasis.mat(W, cnw=FALSE)
- ## retrieve Moran' I for each ME
- f1 <- function(vec){
- res <- mean( vec * (W0 %*% vec) )
- return(res)
- }
-
- Ival <- apply(E, 2, f1)
-
## build output
- res <- E
- attr(res,"values") <- Ival
- attr(res,"weights") <- rep(1/n,n)
+ row.names(res) <- rownames(W)
+ names(res) <- paste("ME", 1:ncol(res))
+ names(attr(res,"values")) <- names(res)
attr(res,"call") <- match.call()
attr(res,"class") <- c("orthobasis","data.frame")
Modified: pkg/TODO
===================================================================
--- pkg/TODO 2008-11-27 14:52:39 UTC (rev 48)
+++ pkg/TODO 2008-11-27 16:15:37 UTC (rev 49)
@@ -42,10 +42,11 @@
o proximities between OTUs like Abouheif, etc. -- done (TJ)
o distances between OTUs (like sum of branch lengths) -- done (TJ)
o dummy vectors indicating class of related OTUs (like in orthogram) -- done (TJ)
-* add a orthobasis method for objects inheriting phylo4 or phylo.
-* orthogram
+o add a orthobasis method for objects inheriting phylo4 or phylo. -- done(TJ)
+* orthogram and multivariate orthogram; use Stephane's version
* ppca
* migrate some (all ?) datasets from ade4 to adephylo (lizards, mjrochet, ...)
+* add a Moran's index test
@@ -66,6 +67,6 @@
==========================
* re-implement all relevant phylogenetic methods from ade4 in adephylo
o implement several phylogenetic proximities -- done (TJ)
-* implement an orthobasis for phylogenies
+o implement an orthobasis for phylogenies -- done (TJ)
* write a comprehensive tutorial, going through adephylo, ade4, ape, phylobase, etc.
Modified: pkg/man/orthobasis.Rd
===================================================================
--- pkg/man/orthobasis.Rd 2008-11-27 14:52:39 UTC (rev 48)
+++ pkg/man/orthobasis.Rd 2008-11-27 16:15:37 UTC (rev 49)
@@ -55,12 +55,12 @@
x <- rtree(50)
## compute Moran's eigenvectors
-ME <- me.phylo(x)
+ME <- me.phylo(x, met="Abouheif")
ME
-## plot the 5 first vectors
-obj <- phylo4d(x, ME[,1:5])
-s.phylo4d(obj, cent=FALSE, scale=FALSE)
+## plot the 10 first vectors
+obj <- phylo4d(x, as.data.frame(ME[,1:10]))
+s.phylo4d(obj, cex.sym=.7, cex.lab=.7)
}
}
\keyword{manip}
More information about the Adephylo-commits
mailing list