Diversity index: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
|||
Line 16: | Line 16: | ||
####### qD calculates true diversity for abundance pi with exponent q. | ####### qD calculates true diversity for abundance pi with exponent q. | ||
qD <- function(pi, q = | qD <- function(pi, q = 0){ # q.div is the q used by the diversity function. | ||
pi <- pi/sum(pi) | pi <- pi/sum(pi) | ||
out <- rep(NA, length(q)) | out <- rep(NA, length(q)) | ||
Line 32: | Line 32: | ||
###### qDa calculates alpha diversity using gamma diversities of each transect. | ###### qDa calculates alpha diversity using gamma diversities of each transect. | ||
qDa <- function(divj, wj = 1, q = | qDa <- function(divj, wj = 1, q = 0){ | ||
q. <- rep(q, each = length(wj)) | q. <- rep(q, each = length(wj)) | ||
out <- ifelse(q. == 1, exp(sum(wj * log(divj))), (sum(wj * divj^(1-q.)))^(1/(1 - q.))) | out <- ifelse(q. == 1, exp(sum(wj * log(divj))), (sum(wj * divj^(1-q.)))^(1/(1 - q.))) | ||
Line 133: | Line 133: | ||
{{todo|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. --[[User:Jouni|Jouni]] 00:36, 9 January 2012 (EET)|Teemu Rintala}} | {{todo|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. --[[User:Jouni|Jouni]] 00:36, 9 January 2012 (EET)|Teemu Rintala}} | ||
{{comment|# |Ilmeisesti funktioparametrien defaulteiksi ei saa laittaa ennalta määrittelemättömiä muuttujia. Vaihdoin defaultiksi "q = 0", "q = q.div" sijaan.|--[[User:Teemu R|Teemu R]] 16:23, 9 January 2012 (EET)}} | |||
The data should be given in R format as a list of values in parenthesis, beginning with c: | The data should be given in R format as a list of values in parenthesis, beginning with c: |
Revision as of 14:23, 9 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
TODO: {{#todo: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)|Teemu Rintala|}}
----#: . --Teemu R 16:23, 9 January 2012 (EET) {{{3}}} (type: truth; paradigms: science: comment)
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>