density_frequency: Plant density and phenotypic frequency

Description Usage Arguments Details Value Author(s) References

View source: R/density_frequency.R

Description

For a set of flocal plants you are interested in, calculate the density of neighbouring plants, and (optionally) their local phenotypic frequency.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
density_frequency(
  focal,
  population,
  scale,
  shape = 2,
  focal_phenotypes = NULL,
  population_phenotypes = NULL,
  density_function = "gaussian",
  density_correction = TRUE
)

Arguments

focal, population

Positional information about a set of focal plants and plants from the wider population of neighbours. This may be a vector of positions, or (more likely) a data.frame of coordinates, with a column for each axis. Arbitrary numbers of coordinate axes are allowed.

scale

Float indicating the scale at which to look at neighbours. If 'density_function' is set to 'gaussian', this is the standard deviation of the Gaussian function to use. If 'density_function' is set to 'generalised', this the 'scale' paramater of the generalised gaussian function. See ?snaptools::d_generalised_gaussian for details. If 'density_function' is set to 'radius', this is the radius within which plants are classified as neighbours.

shape

Shape parameter for the generalised gaussian distribution. Only functional if 'density_function' is set to 'generalised'. See ?snaptools::d_generalised_gaussian for details.

focal_phenotypes, population_phenotypes

Optional vectors of phenotype data for each individual in focal and population.

density_function

String indicating whether to calculate density using a Gaussian function of distance, or counting the number of neighbours within a certain radius. Must take the values 'gaussian', generalised or 'radius'. See 'Description' for details.

density_correction

Logical. If TRUE, the denominator for estimating frequency (i.e. the density of all plants) is calculated excluding plants with missing phenotype data. The estimate of overall density in the output is unaffected.

Details

Density can be calculated two ways. Most simply, we can count the number of neighbours within a given radius, which is simple to interpret, but gives coarse resolution. I have found that small changes to the radius can have enormous effects on estimates of density.

Alternatively, one can apply a Gaussian function to distances using the standard deviation parameter as a scale. The density of plants around a focal plant is then the sum of this function on distances to all neighbours in the population. This has the advantage of smoothing effects with distance, and ensuring that nearer neighbours have a greater influence than mor distant neighbours. However, interpretation is not as straightforward as using a fixed radius.

Thirdly, the Gaussian approach can be extended by using a generalised Gaussian distribution by specifying a 'shape' parameter. This distribution is useful for describing dispersal kernels, because it allows for rare long-distance migration by modelling this as leptokurtosis. See ?snaptools::d_generalised_gaussian for details.

Phenotypic frequency is defined as the density of neighbours of the same phenotype relative to the density of all neighbours. Thus, it is only defined for categorical phenotypes.

Value

A vector of densities for each plant in focal. If phenotypes are supplied, a data.frame of densities and phenotypic frequencies are returned.

Author(s)

Tom Ellis

References

Ellis T (2016), "*The role of pollinator-mediated selection in the maintenance of a flower color polymorphism in an Antirrhinum majus hybrid zone*", PhD thesis, IST Austria, available at https://repository.ist.ac.at/526/


ellisztamas/snaptools documentation built on May 19, 2020, 2:03 p.m.