fGeneralisedMean {OnomasticDiversity}R Documentation

Calculate the Generalised Mean

Description

This function obtains the generalised mean of relative abundances for a collection of species introduced by Angelika C. Studeny. It is a method for quantifying species biodiversity that can be adapted to the context of onomastics.

Usage

fGeneralisedMean (x, pki, pki0, s, location, lambda)

Arguments

x

dataframe of the data values for each species not null (because if you have a sample, there might be species that are not represented).

pki

name of a variable which represents the relative frequency for each species.

pki0

variable which represents the relative frequency for each species not null (because if you have a sample, there might be species that are not represented).

location

name of a variable which represents the grouping element.

s

vector which represents total number of species.

lambda

free parameter.

Details

For a community i, the generalised mean of relative abundances is defined by M_t (\lambda) = \left[\frac{1}{S_i} \sum_{k\in S_i} \left(\frac{N_{ki}^t}{N_{ki}^{t0}}\right)^\lambda\right]^{\frac{1}{\lambda}}, where N_{ki}^t denotes the number of individuals of species k at times t, t0 is the baseline year and S_i are all species at the community, species richness, and \lambda can be any non-zero real number.

In onomastic context, N_{ki}^t denotes the absolute frequency of surname k in region (\approx community diversity context) i at times t.

Value

A dataframe containing the following components:

location

represents the grouping element, for example the communities / regions.

generalisedMean

the value of generalised mean.

Author(s)

Maria Jose Ginzo Villamayor

References

Studeny, A.C. (2012). Quantifying Biodiversity Trends in Time and Space. PhD thesis, University of St Andrews.

See Also

fMargalef, fMenhinick, fPielou, fShannon, fSheldon, fSimpson, fSimpsonInf, fGeometricMean, fHeip

Examples

library(sqldf)
data(surnamesgal14)

loc <- length(unique(surnamesgal14$muni))

apes2=sqldf('select  muni, count(surname) as ni,
sum(number) as population from surnamesgal14
group by muni;')

result = fGeneralisedMean(x= surnamesgal14[surnamesgal14$number != 0,],
pki="pki", pki0=surnamesgal14[surnamesgal14$number != 0,"pki"],
location  = "muni", s = apes2$ni[1:loc], lambda = 1 )
result

data(namesmengal16)

loc <- length(unique(namesmengal16$muni))

namesmengal16$pki <- (namesmengal16$number /
namesmengal16$population)

names2=sqldf('select  muni, count(name) as ni,
sum(number) as population from namesmengal16
group by muni;')

result = fGeneralisedMean(x= namesmengal16[namesmengal16$number != 0,],
pki="pki", pki0=namesmengal16[namesmengal16$number != 0,"pki"],
location  = "muni", s = names2$ni[1:loc], lambda = 1 )
result

data(nameswomengal16)

loc <- length(unique(nameswomengal16$muni))

nameswomengal16$pki <- (nameswomengal16$number /
nameswomengal16$population)

names2=sqldf('select  muni, count(name) as ni,
sum(number) as population from nameswomengal16
group by muni;')

result = fGeneralisedMean(x= nameswomengal16[nameswomengal16$number != 0,],
pki="pki", pki0=nameswomengal16[nameswomengal16$number != 0,"pki"],
location  = "muni", s = names2$ni[1:loc], lambda = 1 )
result

[Package OnomasticDiversity version 0.1 Index]