macroeco.empirical.ssad

macroeco.empirical.ssad(patch, cols, splits)

Calculates an empirical intra-specific spatial abundance distribution

Parameters:

patch : Patch obj

Patch object containing data for analysis

cols : str

Indicates which column names in patch data table are associated with species identifiers, counts, energy, and mass. See Notes.

splits : str

If multiple analyses for subsets of patch data table are desired, specifies how columns should be split. See Notes.

Returns:

list :

List of tuples containing results, where the first element of each tuple is a string indicating the split values used for that result and second element is a dataframe giving the result. Result has one column giving the individuals of species in each

subplot. :

Notes

The parameter cols is a string describing which column in the data table should be used for which “special columns” in analysis. The five possible special columns are

  • spp_col - Unique species identifiers
  • count_col - Number of individuals at a location
  • x_col - x coordinate of location
  • y_col - y coordinate of location
  • energy_col - Energetic requirements of individual(s) at a location

For example, setting cols to spp_col: spp: count_col: number will use the column named “spp” in the data table to represent the unique species identifiers, and the column “number” in the data table to represent the count of individuals at a point.

Different special columns are required for different analyses. count_col is used when multiple individuals of a species may be found at a single recorded location, as is the case in gridded censuses where all individuals in a quadrat are “assigned” to a single point. If count_col is not specified, each record in the data table will be presumed to represent a single individual (i.e., a count of 1).

Note that the value of spp_col may be set to a columm in the data table giving the genus, family, functional group, etc., which allows for analysis of this metric by those groups.

The parameter splits is a semicolon-separated string in the form of “column: value”, where column is a name of a column in the patch data table and value is either (a) an integer giving the number of equally-spaced divisions of a column, or (b) the special keyword ‘split’, which evaluates all unique levels of a column.

For example, presume a data table has columns for x and y spatial coordinates and a column for year, of which there are three. The string “x:2; y:2; year:split” will perform the analysis separately for each of four subplots of the patch (created by dividing the x and y coordinates each into two equally sized divisions) within each of the three years, for a total of 12 separate analyses. Note that if you pass in the x split you MUST also pass in a y split (even if it is just “y:1”) or vice versa. Otherwise, the computed areas will be incorrect.

Examples

>>> # Using the ANBO data provided in demo_files_ANBO.zip found at
>>> # https://github.com/jkitzes/macroeco/releases/
>>> import macroeco as meco
>>> # Pass in path to metadata in order to make patch object
>>> pat = meco.empirical.Patch('~/Desktop/ANBO.txt')
>>> # Get the spatial abundance distribution for all species for each of
>>> # the cells in the ANBO plot
>>> all_spp_ssads = meco.empirical.ssad(pat, cols='spp_col:spp; count_col:count', splits='row:4; column:4')
>>> # Convert to dict for easy searching
>>> all_ssads_dict = dict(all_spp_ssads)
>>> # Look up the spatial abundance distribution for 'grass'
>>> all_ssads_dict['grass']
     y
0    42
1    20
2    60
3    60
4    88
5    86
6    20
7     0
8   110
9    12
10  115
11  180
12  160
13  120
14   26
15   11
>>> # Each value in 'y' gives the abundance of grass in one of the 16 cells

See http://www.macroeco.org/tutorial_macroeco.html for additional examples and explanation