/packages/archive/2010/04.2010/04.30.2010/spacodi/man/Bst.by.nodes.Rd

http://github.com/eastman/spacodiR · Unknown · 108 lines · 81 code · 27 blank · 0 comment · 0 complexity · 551b0bc549b77a96119b9b5719568bc8 MD5 · raw file

  1. \name{Bst.by.nodes}
  2. \alias{Bst.by.nodes}
  3. \title{conducting randomization tests of phylogenetic turnover through time}
  4. \usage{Bst.by.nodes(sp.plot, phy, obs.only = FALSE, return.all = TRUE, n.rep = 10, method = "1s", parm = NULL, dmat = NULL, rand.test = TRUE, r.rep = 10000)}
  5. \arguments{
  6. \item{sp.plot}{a community-phylogenetic dataset in \code{SPACoDi} format (see \code{\link{as.spacodi}})}
  7. \item{phy}{a fully resolved phylogenetic tree, most sensibly ultrametric}
  8. \item{obs.only}{a logical indicator determining whether only estimated \code{Bst}s for the empirical data are returned}
  9. \item{return.all}{a logical indicator determing whether results for all nodes are returned for the empirical data (regardless of whether \code{Bst} is non-null)}
  10. \item{n.rep}{number of permutations to perform on the dataset}
  11. \item{method}{reshuffling or simulation procedure to perform (see details for optional methods)}
  12. \item{parm}{additional parameters, required for methods \code{"1a", "2x", and "3x"} (see details)}
  13. \item{dmat}{an optional matrix of spatial distances between plots, for use only with method \code{"3t"}}
  14. \item{rand.test}{a logical indicator for whether a randomization test of observed and expected \code{Bst}s is performed}
  15. \item{r.rep}{number of randomization iterations to perform}
  16. }
  17. \details{
  18. \code{Bst.by.nodes} is a function to conduct randomization tests on estimated and observed \code{Bst}s through time.
  19. Bst is a measure of local phyletic proximity excess between individuals of distinct species,
  20. thereby expressing phylogenetic turnover. This measure considers the balance between
  21. phylogenetic diversity within and among plots.
  22. \code{Bst.by.nodes} computes phylogenetic community diversity for nodes of
  23. a phylogeny that subtend greater than two species and where nodes subtend species
  24. that are sampled in multiple plots.
  25. Note: whether for the empirical data or for permuted datasets, if fewer than two species are sampled in a given plot, the plot will be dynamically
  26. removed from the dataset. This behavior can be controlled directly in \code{\link{spacodi.calc}} with teh \code{prune.plots} option.
  27. For significance testing, permuted datasets may be generated by one of several \code{methods}:
  28. \itemize{
  29. \item \code{method = "1a"} shuffling based on abundance classes of species (see \code{\link{resamp.1a}});
  30. requires specification of \code{abund.class.ratio} as a \code{parm} (see examples)
  31. \item \code{method = "1s"} shuffling of abundances across entire dataset (see \code{\link{resamp.1s}})
  32. \item \code{method = "2s"} shuffling of abundances across species but within plots (see \code{\link{resamp.2s}})
  33. \item \code{method = "2x"} Gotelli swapping of abundances for pairs of species and within a pair of plots (see \code{\link{resamp.2x}});
  34. requires specification of \code{level} as a \code{parm} (see examples)
  35. \item \code{method = "3i"} shuffling of abundances within species and among plots (see \code{\link{resamp.3i}})
  36. \item \code{method = "3t"} shuffling of abundances to adjacent plots but within species (see \code{\link{resamp.3t}}); if supplied, \code{dmat}
  37. is used to condition abundance shuffling, where closer plots, on average, have higher likelihoods of abundances being swapped
  38. \item \code{method = "3x"} Gotelli swapping of abundances for pairs of plots and within a pair of species (see \code{\link{resamp.3x}});
  39. requires specification of \code{level} as a \code{parm} (see examples)
  40. \item \code{method = "r.sp.plot"} simulation of species-by-plots matrices, informed by empirical data (see \code{\link{r.sp.plot}})
  41. }
  42. }
  43. \value{
  44. \code{Bst.by.nodes} returns a list of three elements:
  45. \itemize{
  46. \item \code{observed.Bst}{: estimated \code{Bst} for nodes of the tree (either all nodes, if \code{return.all=TRUE} or for only
  47. those nodes for which \code{Bst} is non-null)}
  48. \item \code{expected.Bst}{: expected \code{Bst} for all nodes of the emprical data for which \code{Bst} is calculable; nodes in
  49. this element of the output array are row names}
  50. \item \code{randomization.test}{: results from randomization tests of \code{Bst} for each node. Note: if randomization test is used,
  51. some randomization iterations may return NA for particular nodes (see details above). The tally of valid expected
  52. \code{Bst}s from permutation is recorded as a column in this element (i.e., \code{randomization.test$valid.comparisons}).
  53. Be wary of significant results that are based off few valid comparisons.}
  54. }
  55. }
  56. \references{
  57. HARDY OJ and B SENTERRE. 2007. Characterizing the
  58. phylogenetic structure of communities by an additive partitioning of
  59. phylogenetic diversity. Journal of Ecology 95:493-506.
  60. HARDY OJ. 2008. Testing the spatial phylogenetic
  61. structure of local communities: statistical performances of
  62. different null models and test statistics on a locally neutral
  63. community. Journal of Ecology 96:914-926.
  64. }
  65. \author{Jonathan Eastman and Timothy Paine}
  66. \seealso{\code{\link{spacodi.calc}} for interpretation of results; \code{\link{randomization.test.sp}}}
  67. \examples{
  68. # load a species-by-plots matrix, along with a tree
  69. data(sp.example)
  70. attributes(sp.example)
  71. attach(sp.example)
  72. sp.plot
  73. sp.tree
  74. # generate a plot of observed and expected Bst
  75. sp.permut<-Bst.by.nodes(sp.plot=sp.plot, phy=sp.tree, n.rep=35)
  76. sp.permut$randomization.test
  77. plot(sp.tree)
  78. nodelabels()
  79. # plot observed and expected Bst
  80. Bst.permutation.plot(Bst.permutations=sp.permut, envelope=FALSE)
  81. }