Learn R Programming

Traitspace (version 1.0)

distTraitspace: Calculate the distances

Description

Calculates the distances between the predicted and true/observed relative abundances (by default) or species distributions if byrow = FALSE.

Usage

distTraitspace(result, obs = NULL, byrow = TRUE)

Arguments

result
The output from the traitspace function (class traitspace)
obs
The observed matrix - where, each row corresponds to a site and each column to a species - the order of sites and species should match with the order in which they appear in the predicted matrix. By default, NULL, will generate the observed matrix using t
byrow
By default, TRUE, will compare the relative abundances. If FALSE, will compare the species distribution.

Value

  • A list of distances calculated using the following measures: Euclidean, Manhatten, Hellinger, Kullback-Leibler and Bhattacharya. It calculates both the average distance (averages across all sites or species) as well as individual distances.

References

Basu, A., Shioya, H., & Park, C. (2011). Statistical inference: the minimum distance approach. CRC Press.

See Also

pval, Traitspace, TraitspaceMod, trueP

Examples

Run this code
data(spdata)
species<-spdata$species  #species column
trt<-cbind(spdata$t1,spdata$t2) #two traits
env<-spdata$env     #one env gradient
site<-spdata$site   #site information
result1<-Traitspace(species, trt, env, site)
distTraitspace(result1)

Run the code above in your browser using DataLab