Learn R Programming

spacodiR (version 0.13.0115)

spacodi.by.nodes: conducting randomization tests of turnover in diversity through time

Description

spacodi.by.nodes is a function for testing the null expectation of uniform diversity turnover across nodes of a phylogeny.

Usage

spacodi.by.nodes(sp.plot, phy, sp.parm = "Bst", obs.only = FALSE, return.all = TRUE, n.rep = 10, method = "1s", parm = NULL, dmat = NULL, rand.test = TRUE, r.rep = 10000, ...)

Arguments

sp.plot
a community dataset in spacodiR format (see as.spacodi)
phy
a phylogenetic tree of class phylo; see read.tree
sp.parm
a parameter of interest (one of "Ist","Pst","Bst","PIst" or analogs for trait data); see Details
obs.only
Boolean; whether only estimated sp.parmss for the empirical data are returned
return.all
Boolean; whether results for all nodes are returned for the empirical data (regardless NA estimates)
n.rep
number of permutations to perform on the dataset
method
reshuffling or simulation procedure to perform (see Details for optional methods)
parm
additional parameters, required for methods "1a", "2x", and "3x" (see Details)
dmat
an optional matrix of spatial distances between plots, for use only with method "3t"
rand.test
Boolean; whether a randomization test of observed and expected sp.parms is performed
r.rep
number of randomization iterations to perform
...
additional settings to be set for functions called by spacodi.matrices

Value

spacodi.by.nodes returns a list of three elements:
  • observed.sp.parm: estimated sp.parm for nodes of the tree (either all nodes, if return.all=TRUE or for only those nodes for which sp.parm is non-null)
  • expected.sp.parm: expected sp.parm for all nodes of the emprical data for which sp.parm is calculable; nodes in this element of the output array are row names
  • randomization.test: results from randomization tests of sp.parm for each node. Note: if randomization test is used, some randomization iterations may return NA for particular nodes (see details above). The tally of valid expected sp.parms from permutation is recorded as a column in this element (i.e., randomization.test$valid.comparisons). Be wary of significant results that are based off few valid comparisons.

Details

spacodi.by.nodes is a function to conduct randomization tests on estimated and observed sp.parmss through time. See spacodi.calc for further information on the possible estimators to use, whether considering phylogenetic or trait diversity.

spacodi.by.nodes computes measures of community structure for nodes of a phylogeny that subtend greater than two species and where nodes subtend species that are sampled in multiple plots. 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 removed from the dataset. This behavior can be controlled directly in spacodi.calc with the prune option. For significance testing, permuted datasets may be generated by one of several methods:

  • method = "1a" shuffling based on abundance classes of species (see resamp.1a); requires specification of abund.class.ratio as a parm
  • method = "1s" shuffling of abundances across entire dataset (see resamp.1s)

  • method = "2s" shuffling of abundances across species but within plots (see resamp.2s)
  • method = "2x" Gotelli swapping of abundances for pairs of species and within a pair of plots (see resamp.2x); requires specification of level as a parm
  • method = "3i" shuffling of abundances within species and among plots (see resamp.3i)
  • method = "3t" shuffling of abundances to adjacent plots but within species (see resamp.3t); if supplied, dmat is used to condition abundance shuffling, where closer plots, on average, have higher likelihoods of abundances being swapped
  • method = "3x" Gotelli swapping of abundances for pairs of plots and within a pair of species (see resamp.3x); requires specification of level as a parm
  • References

    HARDY OJ and B SENTERRE. 2007. Characterizing the phylogenetic structure of communities by an additive partitioning of phylogenetic diversity. Journal of Ecology 95:493-506. HARDY OJ. 2008. Testing the spatial phylogenetic structure of local communities: statistical performances of different null models and test statistics on a locally neutral community. Journal of Ecology 96:914-926.

    See Also

    spacodi.calc for interpretation of results; resamp.test; randomizeMatrix

    Examples

    Run this code
    # load a species-by-plots matrix, along with a tree
    data(sp.example)
    attributes(sp.example)
    attach(sp.example)
    spl
    phy
    
    # generate a plot of observed and expected Bst
    sp.permut<-spacodi.by.nodes(sp.plot=spl, phy=phy, n.rep=35)
    sp.permut$randomization.test
    
    # plot observed and expected Bst
    spacodi.permutplot(spacodi.permutations=sp.permut, envelope=FALSE)
    
    

    Run the code above in your browser using DataLab