Learn R Programming

simba (version 0.3-4)

sim.yo: Calculate a binary similarity index you define.

Description

Enables the calculation of any binary similarity index via the provision of a formula.

Usage

sim.yo(x, coord = NULL, method = "(2*a)/((2*a) + b + c)", dn = NULL, 
normalize = FALSE, listin = FALSE, listout = FALSE, ...)

Arguments

x
Vegetation data, either as matrix with rows = plots and columns = species (similarities are calculated between rows!), or as data.frame with first three columns representing plots, species and
coord
A data.frame with two columns containing the coordinate values of the sampling units. If given, it triggers the simultaneous calculation of the geographical distances between the sampling units, the coordinates of virtual centre-points betwee
method
Give the formula for a binary similarity index. Defaults to the formula of Sørensen index. See sim for more examples and general explanations.
dn
Neighbor definition. A geographic distance represented by a numeric or a two value vector defining a ring around each plot. Only takes effect when coord != NULL. If specified, the output does only contain similarities between neighboring plot
normalize
Logical value indicating whether the values for a, b and c which are calculated in the process should be normalized to 100% (per row, which means per plot comparison). If normalize = TRUE an asymmetric index must
listin
if x is given in database (list) format this must be set to TRUE (there is no automatic detection of the format)
listout
If output is wanted in database format rather than as a dist-object set this to TRUE. Output is automatically given in database-format, when coord is specified.
...
Arguments to other functions

Value

  • If listout = FALSE a distance matrix of class dist is returned. If listout = TRUE, a data.frame is returned with 7 columns giving the names of the compared plots in the first two and the calculated similarity measure in the third column. The rest of the columns give the values for a, b, c, and d (in this order). Naming of the first three columns can be changed but defaults to NBX (one of the compared plots), NBY (the other one), used index (the values of the calculated index). If coord != NULL, the following columns are given in addition and the columns a:d shift to the end of the data.frame.
  • distanceGeographical distance between compared plots
  • XFor plotting purposes, the x-coordinate of the virtual position of the calculated similarity value in the center between the two compared plots
  • YFor plotting purposes, the y-coordinate of the virtual position of the calculated similarity value in the center between the two compared plots
  • xdistGeographical distance between compared plots, on the x-axis only
  • ydistGeographical distance between compared plots, on the y-axis only

encoding

UTF-8

Details

Presumably this function will rarely be used because sim already allows for the calculation of a large variety of binary similarity coefficients. But just in case you found or thought of an alternative this function is provided. For details regarding similarity indices see sim. You have to give your formula in quotation marks like this: "(2*a)/((2*a) + b + c)".

References

Sørensen, T. (1948) A method of establishing groups of equal amplitude in plant sociology based on similarity of species content. Biologiske Skrifter 5: 1-34.

See Also

vegdist, designdist, dist.binary, dsvdis, dist for other dissimilarity coefficients, and sim for a variety of formulae for similarity coefficients.

Examples

Run this code
data(abis)

##calculate the default Sørensen index
abis.soer <- sim.yo(abis.spec)

##calculate a custom similarity index
abis.sim <- sim.yo(abis.spec, method="(2*a)/((a) + b + c)")

Run the code above in your browser using DataLab