Package Spaa': R Topics Documented
Package Spaa': R Topics Documented
URL https://github.com/helixcn/spaa
NeedsCompilation no
Repository CRAN
Date/Publication 2016-06-09 19:59:58
R topics documented:
         spaa-package . . .      .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .    2
         add.col . . . . . . .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .    4
         data2mat . . . . . .    .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .    5
         datasample . . . .      .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .    6
         deg2dec . . . . . .     .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .    6
         dist2list . . . . . .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .    7
         freq.calc . . . . . .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .    8
         geodist . . . . . . .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .    9
         lab.mat . . . . . . .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   10
         lgeodist . . . . . .    .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   11
         list2dist . . . . . .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   12
         niche.overlap . . .     .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   13
         niche.overlap.boot .    .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   14
                                                                             1
2                                                                                                                                                              spaa-package
          niche.overlap.boot.pair      .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   15
          niche.overlap.pair . . .     .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   16
          niche.width . . . . . .      .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   17
          plotlowertri . . . . . .     .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   18
          plotnetwork . . . . . .      .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   20
          sp.assoc . . . . . . . .     .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   22
          sp.pair . . . . . . . . .    .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   24
          splist . . . . . . . . . .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   26
          sub.sp.matrix . . . . .      .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   27
          testdata . . . . . . . .     .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   28
          turnover . . . . . . . .     .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   28
          XYname . . . . . . . .       .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   30
Index 31
Description
     Miscellaneous functions for analysis of species association and niche overlap.
Details
                                                   Package:                    spaa
                                                   Type:                       Package
                                                   Version:                    0.2.1
                                                   Date:                       2013-8-23
                                                   License:                    GPL-2
                                                   LazyLoad:                   yes
Author(s)
     Author: Jinlong Zhang <jinlongzhang01@gmail.com>
     Maintainer: Jinlong Zhang <jinlongzhang01@gmail.com>
Examples
     data(testdata)
     testdata
     data(splist)
     splist
     ## adding information
spaa-package                                                                 3
    ##example turnover()
    plotlab1 <- XYname(4,6)
    xxx <- 1:240
    dim(xxx) <- c(24, 10)
    rownames(xxx) <- plotlab1
    ### Distance between each pair of plots
    ddd <- dist(xxx)
    ### label matrix
    labmat1 <- lab.mat(plotlab1)
4                                                                                           add.col
     ## geodist() example
     ## Paris
     L1 = deg2dec(-2,20,14)
     phi1 = deg2dec(48, 50, 11)
     ## Washington DC
     L2 = deg2dec(77,03,56)
     phi2 = deg2dec(38,55,17)
     ##High precision Great Circle distance
     geodist(L1, phi1, L2, phi2)
Description
     This function can be used to add one column from dataframe B to dataframe A, according to the
     column names speciefied.
Usage
     add.col(inputA, inputB, add, according)
Arguments
     inputA            inputA A dataframe which a column to be added according to one row infor-
                       mation. Must contain a column name equals to one column name in dataframe
                       B at the least.
     inputB            inputB A dataframe which a column to be abstracted from, must contain a col-
                       umn equals to at least one column name in dataframe A.
     add               add the column name in dataframe B to be add to dataframe A. musth be char-
                       acter.
     according         according the common column name specified to match the data entries from
                       dataframe A and dataframe B. must be character.
Details
     This function can be used to add one column from dataframe B to dataframe A, according to the
     column names specified. Users have to make sure the to dataframes at least share the common
     names specified. This function may be an alternative for merge
Author(s)
     Jinlong Zhang
data2mat                                                                                                5
See Also
    See Alsomerge
Examples
    data(splist)
    data(testdata)
    ## add genera from dataframe B to      dataframe A.
    add.col(inputA = testdata, inputB      = splist, add = "genera",
    according = "species")
    ## add family from dataframe B to      dataframe A.
    add.col(inputA = testdata, inputB      = splist, add = "family",
    according = "species")
Description
    This function can be used to convert the species list to species matrix. The rows of the output matrix
    are plots, or sites. The columns are the species.
Usage
    data2mat(data = data)
Arguments
    data               The input data
Details
    The input data will have to include :species,plots or sites, abundance, specifically, a column
    named "abundance" must be specified.
Value
    Return a species matrix with each row for each plot, and each column for species.
Author(s)
    Jinlong Zhang <jinlongzhang01@gmail.com>
References
    None
6                                                                                             deg2dec
Examples
     data(testdata)
     spmatrix <- data2mat(testdata)
Description
     Community matrix
Usage
     data(datasample)
Format
     A data frame with 8 plots on the following 14 species.
Details
     including 14 species, 8 plots of Gutianshan Natural Reserve, Zhejiang, China, values are the value
     of importance in the plot for each species.
Source
     Hu Zheng-hua, Qian Hai-Yuan, Yu Ming-jian. 2009. The niche of dominant species populations
     in Castanopsis eyrei forest in Gutian Mountain National Natural Reserve. Acta Ecologica Sinica.
     Vol.29, 3670-3677
Examples
     data(datasample)
Description
     Convert latitude or longitude from degree to decimal format
Usage
     deg2dec(h, m, s)
dist2list                                                                                           7
Arguments
     h                  Degree
     m                  Minute
     s                  Second
Details
     Convert latitude or longitude from degree to decimal format.
Value
     Degree of decimal format
Note
     Places with eastern hemisphere should have longitude and southern hemisphere less than zero.
Author(s)
     Jinlong Zhang <jinlongzhang01@gmail.com>
Examples
     ## deg2dec() example
     ##Paris
     L1 = deg2dec(-2,20,14)
     phi1 = deg2dec(48, 50, 11)
     ##Washington DC
     L2 = deg2dec(77,03,56)
     phi2 = deg2dec(38,55,17)
Description
     Convert distance matrix to pairwised list
Usage
     dist2list(dist)
Arguments
     dist               distance matrix
8                                                                                               freq.calc
Details
     Pairwise list with first column indicates the rows of the original distance matrix, second column
     indicates the columns indicates the rows of the original distance matrix, and the third indicats the
     values.
Value
     Dataframe with three columns.
Author(s)
     Jinlong Zhang <jinlongzhang01@gmail.com>
References
     Tuomisto, H. (2003). "Dispersal, Environment, and Floristic Variation of Western Amazonian
     Forests." Science 299(5604): 241-244.
See Also
     list2dist
Examples
     ##dist2list() example
     x <- matrix(rnorm(100), nrow=5)
     sampledata <- dist(x)
     ddd <- dist2list(sampledata)
Description
     This function calculates the species relative frequency which equals to the numbers of occupied
     plots partitioned by the total number of plots for each species.
Usage
     freq.calc(matr)
Arguments
     matr               The standard species matrix
geodist                                                                                                9
Details
    The input data is a standard species matrix with rows for plots and column for species.
Value
    Returns a vector that contains relative frequency for each species included in the input matrix.
Author(s)
    Jinlong Zhang <jinlongzhang01@gmail.com>
References
    None
Examples
    data(testdata)
    spmatrix <- data2mat(testdata)
    freq.calc(spmatrix)
Description
    Hight precision Great circle distance between two places assuming the earth is elliptic sphere.
Usage
    geodist(L1, phi1, L2, phi2)
Arguments
    L1                 Longitude of first place in decimal format.
    phi1               Latitude of first place in decimal format.
    L2                 Longitude of second place in decimal format.
    phi2               Latitude of second place in decimal format.
Details
    Hight precision great circle distance between two places assuming the earth is elliptic sphere.
Value
    Hight precision great circle distance.
10                                                                            lab.mat
Author(s)
      Jinlong Zhang <jinlongzhang01@gmail.com>
References
      Jean Meeus 1991 Astronomical Algorithms Willmann-Bell 80-83
See Also
      lgeodist
Examples
      ## geodist() example
      ## Paris
      L1 = deg2dec(-2,20,14)
      phi1 = deg2dec(48, 50, 11)
      ## Washington DC
      L2 = deg2dec(77,03,56)
      phi2 = deg2dec(38,55,17)
      ##High precision Great Circle distance
      geodist(L1, phi1, L2, phi2)
Description
      Convert vector of XY labels to label matrix
Usage
      lab.mat(plotlab)
Arguments
      plotlab            Vector of XY labels
Value
      XY label matrix
Author(s)
      Jinlong Zhang <jinlongzhang01@gmail.com>
lgeodist                                                                                      11
See Also
    turnover
Examples
Description
    Calculating Great circle distance between two places assuming that the earth is sphere.
Usage
    lgeodist(L1, phi1, L2, phi2)
Arguments
    L1                 Longitude of first place in decimal format.
    phi1               Latitude of first place in decimal format.
    L2                 Longitude of second place in decimal format.
    phi2               Latitude of second place in decimal format.
Value
    Low precision great circle distance between two places.
Note
    This function assuming that the earth is sphere.
Author(s)
    Jinlong Zhang <jinlongzhang01@gmail.com>
References
    Jean Meeus 1991 Astronomical Algorithms Willmann-Bell 80-81
See Also
    geodist
12                                                                                        list2dist
Examples
      #lgeodist() example
      ##Paris
      L1 = deg2dec(-2,20,14)
      phi1 = deg2dec(48, 50, 11)
      ##Washington DC
      L2 = deg2dec(77,03,56)
      phi2 = deg2dec(38,55,17)
      #Great circle distance
      lgeodist(L1, phi1, L2, phi2)
Description
      Convert pairwise list to distance matrix
Usage
      list2dist(dat)
Arguments
      dat                dataframe with three columns
Details
      Dataframe with first column as the column names in the distance matrix, second column as the
      rownames in the distance matrix, third column the values.
Value
      distance matrix
Author(s)
      Jinlong Zhang <jinlongzhang01@gmail.com>
References
      Tuomisto, H. (2003). "Dispersal, Environment, and Floristic Variation of Western Amazonian
      Forests." Science 299(5604): 241-244.
See Also
      dist2list
niche.overlap                                                                                      13
Examples
    ##list2dist() example
    x <- matrix(rnorm(100), nrow=5)
    sampledata <- dist(x)
    ddd <- dist2list(sampledata)
    list2dist(ddd)
Description
    Compute niche overlap between each pair of species.
Usage
    niche.overlap(mat, method = c("levins", "schoener",
           "petraitis", "pianka", "czech", "morisita"))
Arguments
    mat                A community data matrix with each column for each species, and each row for
                       each plot.
    method             Index of niche overlap to be specified.
Details
    To be added.
Value
    A distance matrix contains niche overlap index between each pair of species.
Author(s)
    Jinlong Zhang <jinlongzhang01@gmail.com>
References
    Zhang Jin-tun,(2004 ) Quantitative Ecology, Science Press, Beijing
    Nicholas J. Gotelli. 2000. Null model analysis of species co-occurrence patterns. Ecology 81:2606-
    2621. http://esapubs.org/archive/ecol/E081/022/EcoSim
See Also
    niche.overlap.pair
14                                                                                    niche.overlap.boot
Examples
Description
      Bootstrap of niche overlap between species.
Usage
      niche.overlap.boot(mat, method = c("pianka", "schoener", "petraitis",
          "czech", "morisita", "levins"), times = 999, quant = c(0.025, 0.975))
Arguments
      mat                A community data matrix with columns representing species, and rows repre-
                         senting sites.
      method             A character string indicating the index of niche overlap to be applied.
      times              Interger, Number of bootstrap to be implemented.
      quant              Quantile of bootstrap results, the confidence intervals.
Details
      This function bootstraps the niche overlap within each pair of species. \ pianka: Pianka’s niche
      overlap index\ schoener: Schoener’s niche overlap index\ petraitis: Petraitis’ niche overlap index\
      czech: Czechanowski index \ morisita: Morisita’s overlap index\ levins: Levin’s overlap index\ see
      more information from Gotelli, N(2009).\
Value
      a data frame with each row for each pair of species the columns are "Observed", \ "Boot mean", \
      "Boot std", \ "Boot CI1", \ "Boot CI2", \ "times" \
Author(s)
      Jinlong Zhang <jinlongzhang01@gmail.com>
References
      Zhang Jin-tun,(2004 ) Quantitative Ecology, Science Press, Beijing\
      Nicholas J. Gotelli. 2000. Null model analysis of species co-occurrence patterns. Ecology 81:2606-
      2621. http://esapubs.org/archive/ecol/E081/022/EcoSim
niche.overlap.boot.pair                                                                                15
See Also
    niche.overlap.boot.pair
Examples
    data(datasample)
    niche.overlap.boot(datasample[,1:4],         method   =   "pianka")
    niche.overlap.boot(datasample[,1:4],         method   =   "schoener")
    niche.overlap.boot(datasample[,1:4],         method   =   "czech")
    niche.overlap.boot(datasample[,1:4],         method   =   "levins")
  niche.overlap.boot.pair
                         Niche overlap boostrap utility function
Description
    Compute the bootstrap value between two vectors. This is a internal function called by niche.overlap.boot,
    users are encouraged to use the latter function.
Usage
    niche.overlap.boot.pair(vectorA, vectorB, method = c("levins",
         "schoener", "petraitis", "pianka", "czech", "morisita"),
          times = 999, quant = c(0.025, 0.975))
Arguments
    vectorA               A numerical vector including species A’s abundance or value of importance.
    vectorB               A numerical vector including species B’s abundance or value of importance.
    method                Niche overlap indeces to be applied.
    times                 Number of bootstraps
    quant                 Confidence interval of the bootstrap results.
Details
    To do.
Value
    This function will return a vector including the following elements:\ "Observed", \ "Boot mean", \
    "Boot std", \ "Boot CI1", \ "Boot CI2", \ "times" \
Note
    Users are ecouraged to call niche.overlap.boot rather than this function.
16                                                                                  niche.overlap.pair
Author(s)
      Jinlong Zhang <jinlongzhang01@gmail.com>
References
      Zhang Jin-tun,(2004 ) Quantitative Ecology, Science Press, Beijing
See Also
      niche.overlap.boot
Examples
Description
      Compute niche overlap index between one pair of species. Users are encouraged to used niche.overlap
      istead of this function.
Usage
      niche.overlap.pair(vectA, vectB, method = c("pianka",
           "schoener","petraitis","czech","morisita", "levins"))
Arguments
      vectA              A numerical vector including species A’s abundance or value of importance.
      vectB              A numerical vector including species B’s abundance or value of importance.
      method             Niche overlap index to be applied.
Details
      None
Value
      Niche overlap index.
niche.width                                                                                        17
Author(s)
    Jinlong Zhang <jinlongzhang01@gmail.com>
References
    Zhang Jin-tun,(2004 ) Quantitative Ecology, Science Press, Beijing
    Nicholas J. Gotelli. 2000. Null model analysis of species co-occurrence patterns. Ecology 81:2606-
    2621. http://esapubs.org/archive/ecol/E081/022/EcoSim
See Also
    niche.overlap
Examples
Description
    Compute niche width of the species in a community.
Usage
    niche.width(mat, method = c("shannon", "levins"))
Arguments
    mat                A community data matrix with each column for each species, and each row for
                       each plot.
    method             Index of niche width.
Details
    To be added
Value
    A vetor contains niche width index of species in community.
18                                                                                            plotlowertri
Author(s)
      Jinlong Zhang <jinlongzhang01@gmail.com>
References
      Zhang Jin-tun,(2004 ) Quantitative Ecology, Science Press, Beijing
See Also
      niche.overlap for niche overlap
Examples
Description
      Function for plotting lower semi matrix. These plots are often used to illustrate the relationship in
      Pearson’s correlation, similarity or dissimilarity index between sites or species.
Usage
      plotlowertri(input, valuename = "r",
      pchlist = c(19, 17, 15, 1, 5, 2, 7), interval = 6,
      cex = 1, ncex = 1, int =1.2, add.number = TRUE,
      size = FALSE, add.text = FALSE, show.legend = TRUE,
      digits = 2)
Arguments
      input              The input data, often the results of correlation matrix, can also be class dist
                         object.
      valuename          Value name that will be used in the legend.
      pchlist            The types of point shape to plot see pch par().
      interval           Number of intervals to illustrate the shape of points
      cex                Point size
      ncex               Text size for the add.number, which appeared at the top of each column.
plotlowertri                                                                                         19
Details
    If the matrix contains less than 15 rows/columns, you may have to adjust the row space between
    the text lines in the legend, using argument int. Data in class dist can be include, and will be
    converted to matrix at first internally.
    The lower matrix plot illustrating Pearson’s Correlation between each pair of species. Note some
    value didn’t appeared in the plots, may have appeared the legend. This is due to the distribution of
    data. Be careful in selection of intervals. In this situation you may set show.legend = FALSE, and
    add the legend manually. This may be fixed in the future.
Value
    lower matrix plot
Author(s)
    Jinlong Zhang <jinlongzhang01@gmail.com>
References
    Zhang Qiaoying, Peng Shaolin, Zhang Sumei, Zhang Yunchun, Hou Yuping.(2008). Association of
    dormintant species in Guia hill Municipal Park of Macao. Ecology and Environment. 17:1541-1547
See Also
    See Also plotnetwork
Examples
    data(testdata)
    spmatrix <- data2mat(testdata)
    result <- sp.pair(spmatrix)
      ## Change size
      plotlowertri(cor(sub), size = TRUE, cex = 3)
Description
      This function could be used to plot correlation network, with less than 15 sites (recommended). The
      points lie in a circle with lines connected. Blue lines indicate negative values and the red ones the
      positive ones.
Usage
      plotnetwork(datainput, interval = 8, xlim = c(-2.5,5),
      ylim=c(-3.2,3.2), lty = c(1,2,3,4,4,3,2,1,5), value = "r",
      legendx = 3, legendy = 0, right = 1.2, intcept = 0.22,
      left = 0.35, linelength = 0.3, cex = 3, lwd = 1.5,
      show.legend = TRUE, digits = 2, dit = 1.2,
      number.label = TRUE, text.label = TRUE,
      linecol = c("red", "black"), ...)
plotnetwork                                                                                            21
Arguments
    datainput          The correlation matrix, ex. Pearson’s correlation matrix
    interval           Number of intervals of the values, indicating how to partition the range of input
                       data
    xlim               The x range of the plot. The users need not to change it.
    ylim               The y range of the plot. The users need not to change it.
    lty                Line styles used in connection lines for each interval. Must have number of
                       elements + 1.
    value              Value of the matrix, should be a character, will used in legend.
    legendx            Legend position x.
    legendy            Legend position y.
    right              Legend position adjustment parameter.
    intcept            Legend position adjustment. can be used to specify the row space between each
                       line for the legend.
    left               Legend position adjustment parameter.
    linelength         Line length in the legend.
    cex                Point size for each circle.
    lwd                Line width for each circle.
    ...                Other arguments to be passed from.
    show.legend        Whether the legend should be drawn.
    digits             Number of digits displayed in legend.
    dit                Distance of text labels from each corner.
    number.label       Whether the number label should be drawn.
    text.label         Whether the text label should be drawn.
    linecol            Colours of the lines specified. The positive correlation will be drawn in the first
                       colour specified.
Details
    This function could be used to plot the pairwise connections between less than 20 sites ( above 20
    is not recommended since there would be too many connections).
    The lines will be in red or blue, according the sign of the value of association. Users can adjust the
    line style and legends based on their requirements.
Value
    Correlation network plots.
Author(s)
    Jinlong Zhang <jinlongzhang01@gmail.com>
22                                                                                                sp.assoc
References
      None
Examples
      data(testdata)
      spmatrix <- data2mat(testdata)
      result <- sp.pair(spmatrix)
      plotnetwork(result$Pearson)
Description
      Calculate species association
Usage
      sp.assoc(matr)
Arguments
      matr               standard species matrix , with rows for plots and columns for species.
Details
      Calculate species association using the following formula.
      Number of plots.
      N
      Number of species.
      S
      Number of plots occupied by certain species.
      n
      total number of species for each plot.
      Tj
      mean species number for all the plots.
      t
      Variance of species relative frequency:
sp.assoc                                                                                              23
    sigma^{2}{T}= sum{i}=1^{s}P{i}(1-P{i}).
    Variance of species number:
        S^{2}{T}=({1}{N})sum{j=1}^{N}(T{j}-t)^{2} .
    Species relative frequency
    P{i}={n{i}}{N}.
    Variance ratio:
    If VR > 1 Positively associated,
    If VR < 1 Negative associated
    VR = {S{T}^{2}}/{sigma{T}^{2}}
    W: used in comparison with chi square with n degrees of freedom.
        W = VR * N
Value
    Return Variance ratio, W, Chisq, etc, see details
    pi                 Species frequency
    N                  Number of plots
    S                  Number of species
    Tj                 Total number of species for each plot
    Numspmean          Mean number of species
    sigmaTsq           Variance of species relative frequency
    STsq               Variance of species number
    var.ratio          Variance ratio
    W                  W statiscit value: used in comparison with chi square.(n)
Author(s)
    Jinlong Zhang <jinlongzhang01@gmail.com>
References
    Zhang Qiaoying, Peng Shaolin, Zhang Sumei, Zhang Yunchun, Hou Yuping. (2008) Association of
    dormintant species in Guia hill Municipal Park of Macao. Ecology and Environment. 17:1541-1547
    GUO zhongling, MA yuandan, ZHENG Jiping, LIU Wande , JIN Zefeng.(2004) Biodiversity of tree
    species,their populations’spatial distribution pattern and interspecific association in mixed decidu-
    ous broadleaved forest in Changbai Mountains. Chinese Journal of Applied Ecology. 15:2013-2018
    Shi Zuomin, Liu Shirong, Cheng Ruimei, Jiang Youxu.(2001) Interspecific association of plant
    populations in deciduous broad leaved forest in Baotianman. Scientia Silvae Sinicae. 37:30-35
See Also
    See also sp.pair for association between each pair of species.
24                                                                                               sp.pair
Examples
      data(testdata)
      spmatrix <- data2mat(testdata)
      sp.assoc(spmatrix)
Description
      Calculate species association between each pair of species.
Usage
      sp.pair(matr)
Arguments
      matr               Standard species matrix, with rows for plots and columns for species.
Details
      Assume we have speciesA and speciesB, a, b, c, d that corresponding to the co-occurrence could
      be used to conduct the species association analysis between the two species.
      a = number of plots both occupied by speciesA and speciesB.
      b = number of plots only found speciesA.
      c = number of plots only found speciesB.
      d = number of plots without speciesA or speciesB.
      N = a+b+c+d
      This function are using the following formula:
      Chi square (Yate’s correction):
      chi^{2}=((((a*d-b*c)-0.5*N)^2)*N)/(a+b)*(a+c)*(b+d)*(c+d)
      V ratio:
      V = ((a+d)-(b+c))/(a + b + c + d)
      Jaccard index:
      Jaccard =a/(a + b + c)
      Ochiai index:
      Ochiai = a/sqrt((a+b)*(a+c))
      Dice index:
      Dice = 2*a/(2*a + b + c)
      The Association Coefficient(AC):
sp.pair                                                                                            25
    if a*d>= b*c:
    AC = (a*d - b*c)/((a+b)*(b+d))
    if b*c>= a*d and d>=a:
    AC=(a*d - b*c)/((a+b)*(a+c))
    if b*c>a*d and a<a:
    AC = (a*d - b*c/((b+d)(d+c))
    Point correlation coefficient
    (PCC):
    PCC = {a*d-b*c}/{(a+b)*(a+c)*(c+d)*(b+d)}
Value
    chisq               chi square matrix
    chisqass            chi square matrix information
    V                   V Value indicating species association is positive or negative
    Ochiai              Ochiai’s index
    Dice                Dice’s index
    Jaccard             Jaccard’s index
    Pearson             Pearson’s correlation
    Spearman            Spearman’s rank correlation
    PCC                 Point correlation coefficient
    AC                  Association coefficient
Author(s)
    Jinlong Zhang <jinlongzhang01@gmail.com>
References
    Zhang Qiaoying, Peng Shaolin, Zhang Sumei, Zhang Yunchun, Hou Yuping.(2008). Association of
    dormintant species in Guia hill Municipal Park of Macao. Ecology and Environment. 17:1541-1547
    Zhou XY, Wang BS, Li MG, Zan QJ.(2000). An analysis of interspecific associations in secondary
    succession forest communities in Heishiding Nature Reserve, Guangdong Province. Acta Phytoe-
    cologica Sinica. 24:332-339.
    JIAN Minfei, LIU qijing, ZHU du, YOU hai.(2009). Inter-specific correlations among dorminant
    populations of tree layer species in evergreen broad-leaved forest in Jiulianshan Mountain of sub-
    tropical China. Chinese Journal of Plant Ecology. 33: 672-680
See Also
    See Also as sp.assoc for species association for total species.
26                                                                        splist
Examples
      data(testdata)
      spmatrix <- data2mat(testdata)
      result <- sp.pair(spmatrix)
Description
Usage
data(splist)
Format
References
None
Examples
      data(splist)
      data(testdata)
      ## add genera from dataframe B to     dataframe A.
      add.col(inputA = testdata, inputB     = splist, add = "genera",
      according = "species")
      ## add family from dataframe B to     dataframe A.
      add.col(inputA = testdata, inputB     = splist, add = "family",
      according = "species")
sub.sp.matrix                                                                                         27
Description
Usage
Arguments
    spmatrix           The spmatrix is a standard species matrix with rows for plots and column for
                       species.
    freq               The value of relative frequency to be specified, species with higher relative fre-
                       quency will be reserved in the output matrix.
    common             The number of most common (according to relative frequency) species to be
                       specified.
Details
    sub.sp.matrix will select the species whose relative frequency above 0.5 (default), or select certain
    number of species according to relative frequency.
Value
Author(s)
References
None
See Also
Examples
      library(vegan)
      data(BCI)
      ## Select the species whose relative frequency
      ## more than 0.5, from BCI data
      sub <- sub.sp.matrix(BCI, freq = 0.5)
      ## Select the top 30 species according to relative frequency
      sub <- sub.sp.matrix(BCI, common = 30)
Description
      Data used in example in list format.
Usage
      data(testdata)
Format
      A data frame with 11 observations on the following 3 variables.
Examples
      data(testdata)
      testdata
Description
      Calculating species turnover based on the mean value between focus quadrat and their neighbours.
Usage
      turnover(lab.mat, dist.mat, type = c("quart", "octal"))
turnover                                                                                              29
Arguments
Details
species turnover based on the mean value between centred quadrat and its neighbours.
Value
Author(s)
References
    Lennon J. 2001 The geographical structure of British bird distributions - diversity, spatial turnover
    and scale Journal of Animal Ecology 70,966-979
See Also
Examples
    ##example turnover()
    plotlab1 <- XYname(4,6)
    xxx <- 1:240
    dim(xxx) <- c(24, 10)
    rownames(xxx) <- plotlab1
    ### Distance between each pair of plots
    ddd <- dist(xxx)
    ### label matrix
    labmat1 <- lab.mat(plotlab1)
    yyy <- turnover(labmat1, ddd)
30                                                                             XYname
Description
      Generating vector of XY labels by providing number of rows and columns
Usage
      XYname(x, y)
Arguments
      x                  Number of X labels
      y                  Number of Y labels
Value
      Vector of XY labels
Author(s)
      Jinlong Zhang <jinlongzhang01@gmail.com>
References
      None
See Also
      lab.mat for converting the vector to matrix of XY labels.
Examples
      ## XYname() example
      XYname(4,6)
Index
                                  31
32                                INDEX
plotlowertri, 18
plotnetwork, 19, 20
sp.assoc, 22, 25
sp.pair, 23, 24
spaa (spaa-package), 2
spaa-package, 2
splist, 26
sub.sp.matrix, 27
subset, 27
testdata, 28
turnover, 11, 28
XYname, 29, 30