| calculate_diversities {hagis} | R Documentation |
Calculate Diversities Indices
Description
Calculate five pathogen diversity indices.
Diversity indices include:
Simple diversity index, which will show the proportion of unique pathotypes to total samples. As the values gets closer to 1, there is greater diversity in pathoypes within the population. Simple diversity is calculated as:
D = \frac{Np}{Ns}where
Npis the number of pathotypes andNsis the number of samples.Gleason diversity index, an alternate version of Simple diversity index, is less sensitive to sample size than the Simple index.
D = \frac{ (Np - 1) }{ log(Ns)}Where
Npis the number of pathotypes andNsis the number of samples.Shannon diversity index is typically between 1.5 and 3.5, as richness and evenness of the population increase, so does the Shannon index value.
D = -\sum_{i = 1}^{R} p_i \log p_iWhere
p_iis the proportional abundance of speciesi.Simpson diversity index values range from 0 to 1, 1 represents high diversity and 0 represents no diversity. Where diversity is calculated as:
D = \sum_{i = 1}^{R} p_i^2Evenness ranges from 0 to 1, as the Evenness value approaches 1, there is a more even distribution of each pathoype's frequency within the population. Where Evenness is calculated as:
D = \frac{H'}{log(Np) }where
H'is the Shannon diversity index andNpis the number of pathotypes.
Usage
calculate_diversities(x, cutoff, control, sample, gene, perc_susc)
Arguments
x |
a |
cutoff |
value for percent susceptible cutoff. |
control |
value used to denote the susceptible control in the |
sample |
column providing the unique identification for each sample
being tested. |
gene |
column providing the gene(s) being tested. |
perc_susc |
column providing the percent susceptible reactions.
|
Value
a hagis.diversities object.
A hagis.diversities object is a list containing:
Number of Samples
Number of Pathotypes
Simple Diversity Index
Gleason Diversity Index
Shannon Diversity Index
Simpson Diversity Index
Evenness Diversity Index
Examples
# Using the built-in data set, P_sojae_survey
data(P_sojae_survey)
P_sojae_survey
# calculate susceptibilities with a 60 % cutoff value
diversities <- calculate_diversities(x = P_sojae_survey,
cutoff = 60,
control = "susceptible",
sample = "Isolate",
gene = "Rps",
perc_susc = "perc.susc")
diversities