relative.beta: Deviance in Beta-Specificity to Null Models

Description Usage Arguments Details Value References Examples

View source: R/specificity_scripts.R

Description

Calculate the deviance in observed beta-specificity to a null model of beta-specificity per symbiont and average output per host sample.

Usage

1
2
3
4
5
6
7
relative.beta(
  x,
  randomized = null.beta,
  index = c("morisita.horn", "horn", "sorensen"),
  trim = TRUE,
  notify = TRUE
)

Arguments

x

Data frame. Host by symbiont data frame with hosts populating rows and symbionts populating columns.

randomized

Data frame. Output from null.beta function.

index

Character. Method for calculation with the Morisita-Horn, Horn or Sorensen Indices.

trim

Logical. TRUE removes symbionts that occupy one host species from contributing to host specificity average per host sample. FALSE keeps all symbionts per host sample.

notify

Logical. TRUE prints the current iteration of the for loop.

Details

Hosts are labeled by their species name with a period and number identifier (e.g., hostA.1) to differentiate host samples that are of the same species. This naming scheme is required because host specificity is quantified at the level of host species and not host samples. If this naming scheme does not apply to your experimental design, you should still add in identifiers (e.g., .1, .2, .3, etc.) after each host species or sample identifer.

Host specificity for a symbiont is evaluated across the entire host community. More positive values indicate a narrower symbiont niche and higher host specificity.

Deviance calculations are measured per symbiont and averaged per host sample. The host specificities of each symbiont are averaged to calculate the mean host specificity for symbionts within a given host.

A relative host specificity value greater than zero indicates that an symbiont was more host-specific relative to symbionts with the same read abundances within randomized communities.

Value

A list. First element in the list is a data frame with columns that refer to the host sample identifiers, mean relative beta-specificity, standard error of beta-specificities, number of symbionts per host sample and average symbiont read abundance. All subsequent elements of the list are plots of absolute beta-specificity as a function of natural log symbiont read abundance with the null model in black (derived from host specificity of symbionts from randomized communities in grey) and the symbiont absolute beta-specificities in red. Within graphs, there is an inset equation that refers to the null model expectation.

References

Austen Apigo and Ryoko Oono. 2021. Novel metrics reveal plant abundance, but not plant evolutionary history, shape host specificity in foliar fungal symbionts. In review.

Examples

1
2
3
# Calculate relative beta specificity per symbiont per host sample 
beta.dev <- relative.beta(comm.matrix, randomized = null.beta, index = "morisita.horn")
beta.dev # View data frame of output 

austenapigo/lotus documentation built on Aug. 8, 2021, 10:54 a.m.