Diversity index: Difference between revisions
Jump to navigation
Jump to search
(→Answer: removed print functions) |
(→Answer: beta diversity added) |
||
Line 74: | Line 74: | ||
} | } | ||
gamma <- qD(pi, q) | |||
alpha <- qDa(qDj, wj$wj, q) | |||
beta. <- gamma / alpha | |||
beta.A <- gamma - alpha | |||
beta.W <- gamma / alpha - 1 | |||
beta.P <- 1 - alpha / gamma | |||
qt <- gsub("999", "∞", q) | qt <- gsub("999", "∞", q) | ||
outlabel <- c(paste("Alpha diversity with q=", qt, sep=""), paste(" | outlabel <- c( | ||
outsymbol <- c(paste(qt, "Da", sep=""), paste(qt, " | paste("Gamma diversity with q=", qt, sep=""), | ||
paste("Alpha diversity with q=", qt, sep=""), | |||
paste("Beta diversity (strict) with q=", qt, sep=""), | |||
paste("Beta diversity (absolute turnover) with q=", qt, sep=""), | |||
paste("Beta diversity (Whittaker's turnover) with q=", qt, sep=""), | |||
paste("Beta diversity (proportional turnover) with q=", qt, sep="")) | |||
outsymbol <- c( | |||
paste(qt, "D", sep=""), | |||
paste(qt, "Da", sep=""), | |||
paste(qt, "Beta.", sep=""), | |||
paste(qt, "Beta.A", sep=""), | |||
paste(qt, "Beta.W", sep=""), | |||
paste(qt, "Beta.P", sep="")) | |||
out <- data.frame(Name = c(outlabel, "Richness", "Shannon index", | out <- data.frame(Name = c(outlabel, "Richness", "Shannon index", | ||
Line 85: | Line 102: | ||
Symbol = c(outsymbol, "S", "H' or log(1D)", "λ or 1/(2D)", "1/λ or 2D", | Symbol = c(outsymbol, "S", "H' or log(1D)", "λ or 1/(2D)", "1/λ or 2D", | ||
"1-λ or 1-1/(2D)", "1/(∞D)"), | "1-λ or 1-1/(2D)", "1/(∞D)"), | ||
Value = c( | Value = c(gamma, alpha, beta., beta.A, beta.W, beta.P, length(pi), log(qD(pi,1)), | ||
1/qD(pi,2), qD(pi,2), 1-1/qD(pi,2), 1/qD(pi,999))) | 1/qD(pi,2), qD(pi,2), 1-1/qD(pi,2), 1/qD(pi,999))) | ||
return(out) | return(out) |
Revision as of 07:50, 10 January 2012
Moderator:Jouni (see all) |
This page is a stub. You may improve it into a full page. |
Upload data
|
Question
How to calculate diversity indices?
Answer
Upload your data to Opasnet Base. Use the function diversity to calculate the most common indices.
Actual function diversity
Examples
Example 1 to use function
Example 2
----#: . Mikä ihme tässä koodissa on vikana? q.diviä ei muka löydy mutten ymmärrä miksei. Ongelma on diversity-funktiossa, joka on määritelty sivun ensimmäisessä rcodessa. --Jouni 00:36, 9 January 2012 (EET) to Teemu Rintala (type: truth; paradigms: science: comment)
- ----#: . Ilmeisesti funktioparametrien defaulteiksi ei saa laittaa ennalta määrittelemättömiä muuttujia. Vaihdoin defaultiksi "q = 0", "q = q.div" sijaan. --Teemu R 16:23, 9 January 2012 (EET) (type: truth; paradigms: science: comment)
- ←--#: . OK. Luulin, että funktion sisältä kutsuttava funktio voi saada toisen funktion sisällä olevia oletusarvoja, muttei näin välttämättä ole. Oletusarvot ovat kuitenkin tärkeitä, koska qD-funktiota käytetään tapplyssa, jossa voi antaa vain yhden parametrin ja loput tulevat oletusarvoista. Toteutin tämän niin, että käytetään q.wikiä, joka yleensä kysytään käyttäjärajapinnassa tai muuten. --Jouni 20:15, 9 January 2012 (EET) (type: truth; paradigms: science: defence)
The data should be given in R format as a list of values in parenthesis, beginning with c:
c(3,5,3,5,2,1,3,3,4,2) or equivalently c(0.1,0.2,0.4,0.1,0.2)
where the values are either
- identifiers of the species 1,2,3... in which the individuals belong (one entry per individual), or
- abundancies of species, i.e. proportions of individuals belonging to each species among the whole population (one entry per species).
Rationale
Diversity indices are thoroughly described in Wikipedia.
See also
References
Related files
<mfanonymousfilelist></mfanonymousfilelist>