[Picante-commits] r211 - in pkg: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Feb 8 23:57:56 CET 2010


Author: skembel
Date: 2010-02-08 23:57:56 +0100 (Mon, 08 Feb 2010)
New Revision: 211

Modified:
   pkg/R/phylodiversity.R
   pkg/R/phylosor.R
   pkg/R/phylostruct.R
   pkg/R/randomizeSample.R
   pkg/man/comm.phylo.cor.Rd
   pkg/man/comm.phylo.qr.Rd
   pkg/man/phylosor.rnd.Rd
   pkg/man/phylostruct.Rd
   pkg/man/randomizeSample.Rd
   pkg/man/ses.mntd.Rd
   pkg/man/ses.mpd.Rd
   pkg/man/ses.pd.Rd
Log:
Renamed randomizeSample function to randomizeMatrix

Modified: pkg/R/phylodiversity.R
===================================================================
--- pkg/R/phylodiversity.R	2010-02-08 22:50:57 UTC (rev 210)
+++ pkg/R/phylodiversity.R	2010-02-08 22:57:56 UTC (rev 211)
@@ -26,7 +26,7 @@
 	}
 	else for (run in 1:runs)
 	{
-		samp.dist <- species.dist(randomizeSample(samp,null.model,...),metric)
+		samp.dist <- species.dist(randomizeMatrix(samp,null.model,...),metric)
 		results$random.corrs[run] <- cor(phylo.dist,samp.dist,use="pairwise")
 	}
 	results$obs.rank <- rank(as.vector(c(results$obs.corr,results$random.corrs)))[1]
@@ -78,7 +78,7 @@
 	}
 	else for (run in 1:runs)
 	{
-		samp.dist <- species.dist(randomizeSample(samp,null.model,...),metric)
+		samp.dist <- species.dist(randomizeMatrix(samp,null.model,...),metric)
 		results$random.qr.slopes[run] <- coef(rq(samp.dist~phylo.dist,tau=quant,
 		    na.action=na.omit))[2]
 	}
@@ -174,11 +174,11 @@
     null.model <- match.arg(null.model)
     mpd.rand <- switch(null.model,
     	taxa.labels = t(replicate(runs, mpd(samp, taxaShuffle(dis), abundance.weighted=abundance.weighted))),
-    	sample.pool = t(replicate(runs, mpd(randomizeSample(samp,null.model="richness"), dis, abundance.weighted))),
-    	phylogeny.pool = t(replicate(runs, mpd(randomizeSample(samp,null.model="richness"),
+    	sample.pool = t(replicate(runs, mpd(randomizeMatrix(samp,null.model="richness"), dis, abundance.weighted))),
+    	phylogeny.pool = t(replicate(runs, mpd(randomizeMatrix(samp,null.model="richness"),
     		taxaShuffle(dis), abundance.weighted))),
-    	independentswap = t(replicate(runs, mpd(randomizeSample(samp,null.model="independentswap", iterations), dis, abundance.weighted))),
-    	trialswap = t(replicate(runs, mpd(randomizeSample(samp,null.model="trialswap", iterations), dis, abundance.weighted)))
+    	independentswap = t(replicate(runs, mpd(randomizeMatrix(samp,null.model="independentswap", iterations), dis, abundance.weighted))),
+    	trialswap = t(replicate(runs, mpd(randomizeMatrix(samp,null.model="trialswap", iterations), dis, abundance.weighted)))
     )
     mpd.rand.mean <- apply(X = mpd.rand, MARGIN = 2, FUN = mean, na.rm=TRUE)
     mpd.rand.sd <- apply(X = mpd.rand, MARGIN = 2, FUN = sd, na.rm=TRUE)
@@ -201,11 +201,11 @@
     null.model <- match.arg(null.model)
     mntd.rand <- switch(null.model,
     	taxa.labels = t(replicate(runs, mntd(samp, taxaShuffle(dis), abundance.weighted))),
-    	sample.pool = t(replicate(runs, mntd(randomizeSample(samp,null.model="richness"), dis, abundance.weighted))),
-    	phylogeny.pool = t(replicate(runs, mntd(randomizeSample(samp,null.model="richness"),
+    	sample.pool = t(replicate(runs, mntd(randomizeMatrix(samp,null.model="richness"), dis, abundance.weighted))),
+    	phylogeny.pool = t(replicate(runs, mntd(randomizeMatrix(samp,null.model="richness"),
     		taxaShuffle(dis), abundance.weighted))),
-    	independentswap = t(replicate(runs, mntd(randomizeSample(samp,null.model="independentswap", iterations), dis, abundance.weighted))),
-    	trialswap = t(replicate(runs, mntd(randomizeSample(samp,null.model="trialswap", iterations), dis, abundance.weighted)))
+    	independentswap = t(replicate(runs, mntd(randomizeMatrix(samp,null.model="independentswap", iterations), dis, abundance.weighted))),
+    	trialswap = t(replicate(runs, mntd(randomizeMatrix(samp,null.model="trialswap", iterations), dis, abundance.weighted)))
     )
     mntd.rand.mean <- apply(X = mntd.rand, MARGIN = 2, FUN = mean, na.rm=TRUE)
     mntd.rand.sd <- apply(X = mntd.rand, MARGIN = 2, FUN = sd, na.rm=TRUE)
@@ -598,11 +598,11 @@
     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"),
+    	sample.pool = t(replicate(runs, as.vector(pd(randomizeMatrix(samp,null.model="richness"), tree, ...)$PD))),
+    	phylogeny.pool = t(replicate(runs, as.vector(pd(randomizeMatrix(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)))
+    	independentswap = t(replicate(runs, as.vector(pd(randomizeMatrix(samp,null.model="independentswap", iterations), tree, ...)$PD))),
+    	trialswap = t(replicate(runs, as.vector(pd(randomizeMatrix(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)

Modified: pkg/R/phylosor.R
===================================================================
--- pkg/R/phylosor.R	2010-02-08 22:50:57 UTC (rev 210)
+++ pkg/R/phylosor.R	2010-02-08 22:57:56 UTC (rev 211)
@@ -67,7 +67,7 @@
 			else
 			for (r in 1:runs)
 			{
-				Res<-c(Res,list(phylosor(randomizeSample(samp, null.model),tree)))
+				Res<-c(Res,list(phylosor(randomizeMatrix(samp, null.model),tree)))
 			}
 			}
 

Modified: pkg/R/phylostruct.R
===================================================================
--- pkg/R/phylostruct.R	2010-02-08 22:50:57 UTC (rev 210)
+++ pkg/R/phylostruct.R	2010-02-08 22:57:56 UTC (rev 211)
@@ -4,7 +4,7 @@
   null.model<-match.arg(null.model)
   if(metric=="sppregs")
   {
-  nulls<-t(replicate(runs,sppregs(randomizeSample(samp,null.model=null.model,it=it),env,tree,fam=fam)$correlations))
+  nulls<-t(replicate(runs,sppregs(randomizeMatrix(samp,null.model=null.model,it=it),env,tree,fam=fam)$correlations))
   obs<-sppregs(samp,env,tree,fam=fam)$correlations
   mean.null<-apply(nulls,2,mean)
   quantiles.null<-t(apply(nulls,2,quantile,probs=c(alpha/2,1-(alpha/2))))
@@ -15,10 +15,10 @@
   } else {
 
     nulls<-switch(metric,
-                       psv = replicate(runs,mean(psv(as.matrix(randomizeSample(samp,null.model=null.model,it=it)),tree,compute.var=FALSE)[,1],na.rm=TRUE)),
-                       psr = replicate(runs,mean(psr(as.matrix(randomizeSample(samp,null.model=null.model,it=it)),tree,compute.var=FALSE)[,1],na.rm=TRUE)),
-                       pse = replicate(runs,mean(pse(as.matrix(randomizeSample(samp,null.model=null.model,it=it)),tree)[,1],na.rm=TRUE)),
-                       psc = replicate(runs,mean(psc(as.matrix(randomizeSample(samp,null.model=null.model,it=it)),tree)[,1],na.rm=TRUE)))
+                       psv = replicate(runs,mean(psv(as.matrix(randomizeMatrix(samp,null.model=null.model,it=it)),tree,compute.var=FALSE)[,1],na.rm=TRUE)),
+                       psr = replicate(runs,mean(psr(as.matrix(randomizeMatrix(samp,null.model=null.model,it=it)),tree,compute.var=FALSE)[,1],na.rm=TRUE)),
+                       pse = replicate(runs,mean(pse(as.matrix(randomizeMatrix(samp,null.model=null.model,it=it)),tree)[,1],na.rm=TRUE)),
+                       psc = replicate(runs,mean(psc(as.matrix(randomizeMatrix(samp,null.model=null.model,it=it)),tree)[,1],na.rm=TRUE)))
     quantiles.null<-quantile(nulls,probs=c(alpha/2,1-(alpha/2)))
     mean.null<-mean(nulls)
     mean.obs<-switch(metric,

Modified: pkg/R/randomizeSample.R
===================================================================
--- pkg/R/randomizeSample.R	2010-02-08 22:50:57 UTC (rev 210)
+++ pkg/R/randomizeSample.R	2010-02-08 22:57:56 UTC (rev 211)
@@ -2,7 +2,7 @@
   library.dynam("picante",pkg,lib)
 } 
 
-`randomizeSample` <-
+`randomizeMatrix` <-
 function(samp, null.model=c("frequency","richness","independentswap","trialswap"),
     iterations=1000)
 {

Modified: pkg/man/comm.phylo.cor.Rd
===================================================================
--- pkg/man/comm.phylo.cor.Rd	2010-02-08 22:50:57 UTC (rev 210)
+++ pkg/man/comm.phylo.cor.Rd	2010-02-08 22:57:56 UTC (rev 211)
@@ -16,7 +16,7 @@
   \item{metric}{ Metric of co-occurrence to use (see \code{\link{species.dist}})}
   \item{null.model}{ Null model to use (see Details section for description) }
   \item{runs}{ Number of runs (randomizations) }
-  \item{...}{ Additional arguments to \link{randomizeSample}}
+  \item{...}{ Additional arguments to \link{randomizeMatrix}}
 }
 \value{
     A list with elements:
@@ -40,7 +40,7 @@
 }
 \references{ Cavender-Bares J., D.A. Ackerly, D. Baum and F.A. Bazzaz. 2004. Phylogenetic overdispersion in Floridian oak communities, American Naturalist, 163(6):823-843. }
 \author{ Steven Kembel <skembel at uoregon.edu> }
-\seealso{ \code{\link{randomizeSample}} }
+\seealso{ \code{\link{randomizeMatrix}} }
 \examples{
 data(phylocom)
 comm.phylo.cor(phylocom$sample, phylocom$phylo, metric="cij",null.model="sample.taxa.labels")}

Modified: pkg/man/comm.phylo.qr.Rd
===================================================================
--- pkg/man/comm.phylo.qr.Rd	2010-02-08 22:50:57 UTC (rev 210)
+++ pkg/man/comm.phylo.qr.Rd	2010-02-08 22:57:56 UTC (rev 211)
@@ -19,7 +19,7 @@
   \item{quant}{ Quantile of slope to be fit (using \code{\link[quantreg]{rq}}) }
   \item{runs}{ Number of runs (randomizations) }
   \item{show.plot}{ Option to display a plot of co-occurrence versus phylogenetic distance with quantile regression slope fit }
-  \item{...}{ Additional arguments to \link{randomizeSample}}
+  \item{...}{ Additional arguments to \link{randomizeMatrix}}
 }
 \value{
     A list with elements:
@@ -48,7 +48,7 @@
 Slingsby, J. A. and G. A. Verboom. 2006. Phylogenetic relatedness limits coexistence at fine spatial scales: evidence from the schoenoid sedges (Cyperaceae: Schoeneae) of the Cape Floristic Region, South Africa. The American Naturalist 168:14-27.
 }
 \author{ Steven Kembel <skembel at uoregon.edu> }
-\seealso{ \code{\link{randomizeSample}} }
+\seealso{ \code{\link{randomizeMatrix}} }
 \examples{
 data(phylocom)
 comm.phylo.qr(phylocom$sample, phylocom$phylo, metric="cij",null.model="sample.taxa.labels")}

Modified: pkg/man/phylosor.rnd.Rd
===================================================================
--- pkg/man/phylosor.rnd.Rd	2010-02-08 22:50:57 UTC (rev 210)
+++ pkg/man/phylosor.rnd.Rd	2010-02-08 22:57:56 UTC (rev 211)
@@ -36,7 +36,7 @@
 }
 \references{Bryant, J.B., Lamanna, C., Morlon, H., Kerkhoff, A.J., Enquist, B.J., Green, J.L. 2008. Microbes on mountainsides: Contrasting elevational patterns of bacterial and plant diversity. Proceedings of the National Academy of Sciences 105 Supplement 1: 11505-11511}
 \author{ Helene Morlon <morlon.helene at gmail.com> and Steven Kembel <skembel at uoregon.edu> }
-\seealso{ \code{\link{phylosor}}, \code{\link{randomizeSample}}  }
+\seealso{ \code{\link{phylosor}}, \code{\link{randomizeMatrix}}  }
 \examples{
 data(phylocom)
 phylosor.rnd(phylocom$sample,phylocom$phylo,cstSor=TRUE,null.model="richness",runs=5)

Modified: pkg/man/phylostruct.Rd
===================================================================
--- pkg/man/phylostruct.Rd	2010-02-08 22:50:57 UTC (rev 210)
+++ pkg/man/phylostruct.Rd	2010-02-08 22:57:56 UTC (rev 211)
@@ -12,9 +12,9 @@
   \item{tree}{ phylo tree object or a phylogenetic covariance matrix }
   \item{env}{ environmental data matrix }
   \item{metric}{ if \code{metric="psv"}, \code{"psr"}, \code{"pse"}, or \code{"psc"} compares the observed mean of the respective metric to a null distribution at a given alpha; if \code{metric="sppregs"} compares the three correlations produced by \code{\link{sppregs}} to null distributions }
-  \item{null.model}{ permutation procedure used to create the null distribution, see \code{\link{randomizeSample}}}
+  \item{null.model}{ permutation procedure used to create the null distribution, see \code{\link{randomizeMatrix}}}
   \item{runs}{ the number of permutations to create the distribution, a rule of thumb is (number of communities)/alpha  }
-  \item{it}{ the number of swaps for the independent and trial-swap null models, see \code{\link{randomizeSample}} }
+  \item{it}{ the number of swaps for the independent and trial-swap null models, see \code{\link{randomizeMatrix}} }
   \item{alpha}{ probability value to compare the observed mean/correlations to a null distribution }
   \item{fam}{ as in \code{\link{sppregs}} }
 }
@@ -42,6 +42,6 @@
 Gotelli N.J. (2000) Null model analysis of species co-occurrence patterns. Ecology, 81, 2606-2621}
 
 \author{ Matthew Helmus \email{mrhelmus at gmail.com} }
-\seealso{ \code{\link{psd}} ,\code{\link{sppregs}}, \code{\link{randomizeSample}} }
+\seealso{ \code{\link{psd}} ,\code{\link{sppregs}}, \code{\link{randomizeMatrix}} }
 
 \keyword{univar}
\ No newline at end of file

Modified: pkg/man/randomizeSample.Rd
===================================================================
--- pkg/man/randomizeSample.Rd	2010-02-08 22:50:57 UTC (rev 210)
+++ pkg/man/randomizeSample.Rd	2010-02-08 22:57:56 UTC (rev 211)
@@ -1,12 +1,12 @@
-\name{randomizeSample}
-\alias{randomizeSample}
+\name{randomizeMatrix}
+\alias{randomizeMatrix}
 
 \title{ Null models for community data matrix randomization}
 \description{
   Various null models for randomizing community data matrices
 }
 \usage{
-randomizeSample(samp, null.model = c("frequency", "richness", "independentswap", "trialswap"),iterations = 1000)    
+randomizeMatrix(samp, null.model = c("frequency", "richness", "independentswap", "trialswap"),iterations = 1000)    
 }
 
 \arguments{
@@ -35,5 +35,5 @@
 \author{ Steven Kembel <skembel at uoregon.edu> }
 \examples{
 data(phylocom)
-randomizeSample(phylocom$sample, null.model="richness")}
+randomizeMatrix(phylocom$sample, null.model="richness")}
 \keyword{manip}

Modified: pkg/man/ses.mntd.Rd
===================================================================
--- pkg/man/ses.mntd.Rd	2010-02-08 22:50:57 UTC (rev 210)
+++ pkg/man/ses.mntd.Rd	2010-02-08 22:57:56 UTC (rev 211)
@@ -47,7 +47,7 @@
 }
 \references{ Webb, C.O., Ackerly, D.D., and Kembel, S.W. 2008. Phylocom: software for the analysis of phylogenetic community structure and trait evolution. Version 4.0.1. \url{http://www.phylodiversity.net/phylocom/}. }
 \author{ Steven Kembel <skembel at uoregon.edu> }
-\seealso{ \code{\link{mntd}}, \code{\link{randomizeSample}}  }
+\seealso{ \code{\link{mntd}}, \code{\link{randomizeMatrix}}  }
 \examples{
 data(phylocom)
 ses.mntd(phylocom$sample, cophenetic(phylocom$phylo),null.model="taxa.labels")}

Modified: pkg/man/ses.mpd.Rd
===================================================================
--- pkg/man/ses.mpd.Rd	2010-02-08 22:50:57 UTC (rev 210)
+++ pkg/man/ses.mpd.Rd	2010-02-08 22:57:56 UTC (rev 211)
@@ -46,7 +46,7 @@
 
 \references{ Webb, C.O., Ackerly, D.D., and Kembel, S.W. 2008. Phylocom: software for the analysis of phylogenetic community structure and trait evolution. Version 4.0.1. \url{http://www.phylodiversity.net/phylocom/}. }
 \author{ Steven Kembel <skembel at uoregon.edu> }
-\seealso{ \code{\link{mpd}}, \code{\link{randomizeSample}}  }
+\seealso{ \code{\link{mpd}}, \code{\link{randomizeMatrix}}  }
 \examples{
 data(phylocom)
 ses.mpd(phylocom$sample, cophenetic(phylocom$phylo),null.model="taxa.labels")}

Modified: pkg/man/ses.pd.Rd
===================================================================
--- pkg/man/ses.pd.Rd	2010-02-08 22:50:57 UTC (rev 210)
+++ pkg/man/ses.pd.Rd	2010-02-08 22:57:56 UTC (rev 211)
@@ -48,7 +48,7 @@
 
 Proches, S., Wilson, J.R.U. and Cowling, R.M. 2006. How much evolutionary history in a 10 x 10m plot? Proceedings of Royal Society of London B, Biological Sciences 273:1143-1148.}
 \author{ Steven Kembel <skembel at uoregon.edu> }
-\seealso{ \code{\link{pd}}, \code{\link{randomizeSample}}  }
+\seealso{ \code{\link{pd}}, \code{\link{randomizeMatrix}}  }
 \examples{
 data(phylocom)
 ses.pd(phylocom$sample, phylocom$phylo, null.model="taxa.labels", runs=99)}



More information about the Picante-commits mailing list