Coder Social home page Coder Social logo

ericmarcon / entropart Goto Github PK

View Code? Open in Web Editor NEW
8.0 2.0 5.0 38.96 MB

Entropy Partitioning to Measure Diversity

Home Page: https://ericmarcon.github.io/entropart/

R 92.53% TeX 7.47%
diversity species measure entropy-partitioning estimator biodiversity

entropart's Introduction

Entropy Partitioning to Measure Diversity

CRAN version R-CMD-check codecov CodeFactor

entropart is an R package that provides functions to calculate alpha, beta and gamma diversity of communities, including phylogenetic and functional diversity.

Estimation-bias corrections are available.

Details

In the entropart package, individuals of different species are counted in several communities which may (or not) be agregated to define a metacommunity. In the metacommunity, the probability to find a species in the weighted average of probabilities in communities. This is a naming convention, which may correspond to plots in a forest inventory or any data organized the same way.

Basic functions allow computing diversity of a community. Data is simply a vector of probabilities (summing up to 1) or of abundances (integer values that are numbers of individuals). Calculate entropy with functions such as Tsallis, Shannon, Simpson, Hurlbert or GenSimpson and explicit diversity (i.e. effective number of species) with Diversity and others. By default, the best available estimator of diversity will be used, according to the data.

Communities can be simulated by rCommunity, explicitely declared as a species distribution (as.AbdVector or as.ProbaVector), and plotted.

Phylogenetic entropy and diversity can be calculated if a phylogenetic (or functional), ultrametric tree is provided. See PhyloEntropy, Rao for examples of entropy and PhyloDiversity to calculate phylodiversity, with the state-of-the-art estimation-bias correction. Similarity-based diversity is calculated with Dqz, based on a similarity matrix.

Vignettes

A quick introduction is in vignette("entropart").

A full documentation is available online, in the "Articles" section of the web site of the vignette. It is a continuous update of the paper published in the Journal of Statistical Software (Marcon & Hérault, 2015).

The development version documentation is also available.

Reference

Marcon, E. and Herault, B. (2015). entropart: An R Package to Measure and Partition Diversity. Journal of Statistical Software. 67(8): 1-26.

entropart's People

Contributors

ericmarcon avatar rekyt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

entropart's Issues

DivPart - correction to non-integer values

Dear Eric,

I am trying to analyse diversity in microsat data using your package (I am interested in estimating genetic differentiation at the regional and population levels) and encountered the following 'problem': when using DivPart with biased=F and Correction="Best" settings, I get warnings that correction cannot be applied to non-integer Ns values, but the object created indicate that correction has been applied.

Here is a reproducable example:

library(entropart)
library(adegenet)
data(nancycats)
loclist<-seploc(nancycats)
df_gendat<-as(loclist[[2]], "data.frame") #we use only one locus (the second in this example)
df_gendat<-df_gendat[complete.cases(df_gendat),]
df_reduced<-df_gendat[1:180,]
pop_list<-c(rep("pop1",15),rep("pop2",25),rep("pop3",15),rep("pop4",25),rep("pop5",20),rep("pop6",20),rep("pop7",25),rep("pop8",15),rep("pop9",20)) #populations (9 populations in total)
reg_list<-c(rep("two",40),rep("three",60),rep("four",80)) #regions (3 regions in total; the first region consists of two populations, the second consists of three populations and the third consists of four populations, respectively)
df2_gendat<-cbind(reg_list,pop_list,df_reduced)
abun<-t(rowsum(df2_gendat[,3:ncol(df2_gendat)],df2_gendat$pop_list,na.rm=T))
two<-cbind(abun[,"pop1"],abun[,"pop2"]); colnames(two)<-c("pop1","pop2")
three<-cbind(abun[,"pop3"],abun[,"pop4"],abun[,"pop5"]); colnames(three)<-c("pop3","pop4","pop5")
four<-cbind(abun[,"pop6"],abun[,"pop7"],abun[,"pop8"],abun[,"pop9"]); colnames(four)<-c("pop6","pop7","pop8","pop9")
MC_two <- MetaCommunity(Abundances = two)
MC_three <- MetaCommunity(Abundances = three)
MC_four <- MetaCommunity(Abundances = four)
merged_total <- MergeMC(list(MC_two, MC_three, MC_four),Weights=c(2,3,4))
est_obs<-DivPart(q=1, merged_total, Biased=F, Correction="Best")
summary(est_obs)

Should I ignore these warnings? It may be related to unequal sample sizes (i.e. number of individuals) within populations - at least I do not get this warning when I set the number of individuals to be equal in all populations here.

Thank you for your help in advance!

Best wishes,
Zoltán

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.