[Picante-commits] r188 - pkg pkg/R pkg/man www

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Jul 2 23:24:12 CEST 2009


Author: skembel
Date: 2009-07-02 23:24:12 +0200 (Thu, 02 Jul 2009)
New Revision: 188

Modified:
   pkg/DESCRIPTION
   pkg/R/phylodiversity.R
   pkg/man/pd.Rd
   pkg/man/picante-package.Rd
   pkg/man/utility.Rd
   www/index.php
Log:
Added ses.pd function

Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION	2009-05-21 19:05:34 UTC (rev 187)
+++ pkg/DESCRIPTION	2009-07-02 21:24:12 UTC (rev 188)
@@ -1,8 +1,8 @@
 Package: picante
 Type: Package
 Title: R tools for integrating phylogenies and ecology
-Version: 0.7-0
-Date: 2009-5-18
+Version: 0.7-1
+Date: 2009-7-2
 Author: Steven Kembel <skembel at uoregon.edu>, David Ackerly <dackerly at berkeley.edu>, Simon Blomberg <s.blomberg1 at uq.edu.au>, Peter Cowan <pdc at berkeley.edu>, Matthew Helmus <mrhelmus at wisc.edu>, Helene Morlon  <morlon.helene at gmail.com>, Campbell Webb <cwebb at oeb.harvard.edu>
 Maintainer: Steven Kembel <skembel at uoregon.edu>
 Depends: ape, vegan, nlme

Modified: pkg/R/phylodiversity.R
===================================================================
--- pkg/R/phylodiversity.R	2009-05-21 19:05:34 UTC (rev 187)
+++ pkg/R/phylodiversity.R	2009-07-02 21:24:12 UTC (rev 188)
@@ -96,15 +96,21 @@
 
 `taxaShuffle` <-
 function(x) {
-    #todo replace with vegan's permuted.index?
+    #TODO replace with vegan's permuted.index?
     if (!is.matrix(x)) x <- as.matrix(x)
 	rand.names <- sample(rownames(x))
 	rownames(x) <- rand.names
 	colnames(x) <- rand.names
-	x
+	return(x)
 }
 
+`tipShuffle` <- 
+function(phy) {
+    phy$tip.label <- phy$tip.label[sample(length(phy$tip.label))]
+    return(phy)
+}
 
+
 mpd <- function(samp, dis, abundance.weighted=FALSE) 
 {
     N <- dim(samp)[1]
@@ -583,3 +589,27 @@
     rownames(PDout) <- rownames(samp)
     return(PDout)
 }
+
+`ses.pd` <-
+function (samp, tree, null.model = c("taxa.labels", "sample.pool", 
+    "phylogeny.pool", "independentswap", "trialswap"), runs = 999, iterations = 1000, ...) 
+{
+    pd.obs <- as.vector(pd(samp, tree, ...)$PD)
+    null.model <- match.arg(null.model)
+    pd.rand <- switch(null.model,
+    	taxa.labels = t(replicate(runs, as.vector(pd(samp, tipShuffle(tree), ...)$PD))),
+    	sample.pool = t(replicate(runs, as.vector(pd(randomizeSample(samp,null.model="richness"), tree, ...)$PD))),
+    	phylogeny.pool = t(replicate(runs, as.vector(pd(randomizeSample(samp,null.model="richness"),
+    		tipShuffle(tree), ...)$PD))),
+    	independentswap = t(replicate(runs, as.vector(pd(randomizeSample(samp,null.model="independentswap", iterations), tree, ...)$PD))),
+    	trialswap = t(replicate(runs, as.vector(pd(randomizeSample(samp,null.model="trialswap", iterations), tree, ...)$PD)))
+    )
+    pd.rand.mean <- apply(X = pd.rand, MARGIN = 2, FUN = mean, na.rm=TRUE)
+    pd.rand.sd <- apply(X = pd.rand, MARGIN = 2, FUN = sd, na.rm=TRUE)
+    pd.obs.z <- (pd.obs - pd.rand.mean)/pd.rand.sd
+    pd.obs.rank <- apply(X = rbind(pd.obs, pd.rand), MARGIN = 2, 
+        FUN = rank)[1, ]
+    pd.obs.rank <- ifelse(is.na(pd.rand.mean),NA,pd.obs.rank)    
+    data.frame(ntaxa=specnumber(samp),pd.obs, pd.rand.mean, pd.rand.sd, pd.obs.rank, 
+        pd.obs.z, pd.obs.p=pd.obs.rank/(runs+1),runs=runs, row.names = row.names(samp))
+}
\ No newline at end of file

Modified: pkg/man/pd.Rd
===================================================================
--- pkg/man/pd.Rd	2009-05-21 19:05:34 UTC (rev 187)
+++ pkg/man/pd.Rd	2009-07-02 21:24:12 UTC (rev 188)
@@ -20,7 +20,7 @@
 }
 
 \note{
-The data sets need not be species-community data sets but may be any sample data set with an associated phylogeny. PD is not statistically independent of species richness, it positively correlates with species richness across samples.
+The data sets need not be species-community data sets but may be any sample data set with an associated phylogeny. PD is not statistically independent of species richness, it positively correlates with species richness across samples. The function \code{\link{ses.pd}} compares observed PD to the values expected under various randomizations and allows a way to standardize for unequal richness across samples.
 
 If the root is to be included in all calculations of PD (\code{include.root=TRUE}), the tree must be rooted. Single-species samples will be assigned a PD value equal to the distance from the root to the present.
 
@@ -34,6 +34,8 @@
 }
 \references{ Faith D.P. (1992) Conservation evaluation and phylogenetic diversity. Biological Conservation, 61, 1-10. }
 \author{ Matthew Helmus \email{mrhelmus at gmail.com}, Jonathan Davies \email{davies at nceas.ucsb.edu}, Steven Kembel \email{skembel at uoregon.edu}}
-\seealso{ \code{\link{psr}} }
-
+\seealso{ \code{\link{psr}}, \code{\link{ses.pd}} }
+\examples{
+data(phylocom)
+pd(phylocom$sample, phylocom$phylo)}
 \keyword{univar}

Modified: pkg/man/picante-package.Rd
===================================================================
--- pkg/man/picante-package.Rd	2009-05-21 19:05:34 UTC (rev 187)
+++ pkg/man/picante-package.Rd	2009-07-02 21:24:12 UTC (rev 188)
@@ -12,8 +12,8 @@
 \tabular{ll}{
 Package: \tab picante\cr
 Type: \tab Package\cr
-Version: \tab 0.7-0\cr
-Date: \tab 2009-5-18\cr
+Version: \tab 0.7-1\cr
+Date: \tab 2009-7-2\cr
 License: \tab GPL-2\cr
 }
 }

Modified: pkg/man/utility.Rd
===================================================================
--- pkg/man/utility.Rd	2009-05-21 19:05:34 UTC (rev 187)
+++ pkg/man/utility.Rd	2009-07-02 21:24:12 UTC (rev 188)
@@ -6,6 +6,7 @@
 \alias{sortColumns}
 \alias{sortRows}
 \alias{taxaShuffle}
+\alias{tipShuffle}
 \title{ Picante utility functions }
 \description{
   Picante utility functions for tree and data manipulation
@@ -18,6 +19,7 @@
 sortColumns(x)
 sortRows(x)
 taxaShuffle(x)
+tipShuffle(phy)
 }
 
 \arguments{
@@ -37,7 +39,8 @@
   \item{pic.variance}{Variance of independent contrasts}
   \item{sortColumns}{A data.frame or matrix with columns sorted by name}
   \item{sortRows}{A data.frame or matrix with rows sorted by name}
-    \item{taxaShuffle}{Matrix with taxa names shuffled}
+   \item{taxaShuffle}{Matrix with taxa names shuffled}
+   \item{tipShuffle}{Phylo object with taxa names shuffled}
 }
 
 \details{

Modified: www/index.php
===================================================================
--- www/index.php	2009-05-21 19:05:34 UTC (rev 187)
+++ www/index.php	2009-07-02 21:24:12 UTC (rev 188)
@@ -41,6 +41,7 @@
 
 <h2>News</h2>
 <ul>
+<li>By popular demand, version 0.7-1 adds the standardized effect size of Faith's PD (ses.pd)</li>
 <li>Several changes and new features in version 0.7
 <ul>
 <li>Added phylobeta diversity measures (comdist/comdistnt)</li>
@@ -57,7 +58,8 @@
 <ul>
 <li>Community phylogenetic and trait diversity</li>
     <ul>
-    <li>Webb's NRI/NTI and related measures of standardized effect size of community phylogenetic structure</li>
+    <li>Faith's PD (phylogenetic diversity) and standardized effect size of PD.</li>
+    <li>Webb's NRI/NTI and related measures of standardized effect size of community phylogenetic structure.</li>
     <li>Mean pairwise distance and mean distance to nearest taxon among co-occurring species (can be used with any interspecific distance measure). Distances can be calculated based on presence or abundance in samples.</li>
     <li>Correlations and quantile regressions between species co-occurrence and phylogenetic distances</li>
     <li>Phylogenetic species richness, evenness and variance of Helmus et al. (2007).</li>
@@ -84,7 +86,7 @@
 
 <h2>Obtaining picante</h2>
 <ul>
-<li>Version 0.7 is available on <a href="http://cran.r-project.org/">CRAN</a>. Simply type <strong><code>install.packages("picante")</code></strong> from within R.</li>
+<li>Version 0.7-1 is available on <a href="http://cran.r-project.org/">CRAN</a>. Simply type <strong><code>install.packages("picante")</code></strong> from within R.</li>
 <li>You can grab the latest nightly build <a href="http://r-forge.r-project.org/R/?group_id=134">here</a>, or by typing <strong><code>install.packages("picante",repos="http://R-Forge.R-project.org")</code></strong> from within R.</li>
 </ul>
 
@@ -94,12 +96,13 @@
 <h2>Citing picante</h2>
 <p>A manuscript describing the software package is in preparation. In the meantime, you can cite picante as:
 <ul><li>
-S.W. Kembel, D.D. Ackerly, S.P. Blomberg, P.D. Cowan, M.R. Helmus, H. Morlon and C.O. Webb. 2009. picante: R tools for integrating phylogenies and ecology. R package version 0.7-0. http://picante.r-forge.r-project.org
+S.W. Kembel, D.D. Ackerly, S.P. Blomberg, P.D. Cowan, M.R. Helmus, H. Morlon and C.O. Webb. 2009. picante: R tools for integrating phylogenies and ecology. R package version 0.7-1. http://picante.r-forge.r-project.org
 </li></ul>
 </p>
 
 <h2>Release history</h2>
 <p><ul>
+<li>Version 0.7-1: Added ses.pd function</li>
 <li>Version 0.7: comm.phylo.qr function (quantile regression of co-occurrence and phylogenetic distance). traitgram function. Changed mnnd terminology to mntd. Added phylogenetic beta diversity measures comdist/comdistnt. Abundance weighting of mpd/mntd.
 <li>Version 0.6: Bugfix release. Changes to pd and phylosor functions.</li>
 <li>Version 0.5: Phylogenetic beta diversity measures (phylosor) with randomization testing.</li>



More information about the Picante-commits mailing list