Description Usage Arguments Details Value Author(s) Examples
View source: R/CommunityProfile.R
Calculates the diversity or entropy profile of a community, applying a community function to a vector of orders.
1 2 3 4 5 6 7 8 9 10 | CommunityProfile(FUN, NorP, q.seq = seq(0, 2, 0.1),
NumberOfSimulations = 0, Alpha = 0.05, BootstrapMethod = "Chao2015",
size = 1, ..., CheckArguments = TRUE)
as.CommunityProfile(x, y, low = NULL, high = NULL)
is.CommunityProfile(x)
## S3 method for class 'CommunityProfile'
plot(x, ..., main = NULL,
xlab = "Order of Diversity", ylab = "Diversity", ylim = NULL,
LineWidth = 2, ShadeColor = "grey75", BorderColor = "red")
CEnvelope(Profile, LineWidth = 2, ShadeColor = "grey75", BorderColor = "red", ...)
|
FUN |
The function to be applied to each value of q.seq. Any function accepting a numeric vector (or a two-column matrix) and a number as first two arguments and an argument named |
NorP |
A numeric vector. Contains either abundances or probabilities. |
q.seq |
A numeric vector: the sequence of diversity orders to address. Default is from 0 to 2. |
NumberOfSimulations |
The number of simulations to run, 0 by default. |
Alpha |
The risk level, 5% by default. |
BootstrapMethod |
The method used to obtain the probabilities to generate bootstrapped communities from observed abundances. See |
size |
The size of simulated communities used to compute the bootstrap confidence envelope. 1 (default) means that the actual size must be used. |
x |
An object to be tested or plotted or the vector of orders of community profiles in |
y |
Entropy or diversity values of each order, corresponding to |
low |
Entropy or diversity lower bound of the confidence envelope, corresponding to |
high |
Entropy or diversity higher bound of the confidence envelope, corresponding to |
Profile |
An |
... |
Additional arguments to be passed to |
main |
The main title of the plot. |
xlab |
The x axis label of the plots. |
ylab |
The y axis label of the plot. |
ylim |
The interval of y values plotted. |
LineWidth |
The width of the line that represents the actual profile. |
ShadeColor |
The color of the shaded confidence envelope. |
BorderColor |
The color of the bounds of the confidence envelope. |
CheckArguments |
Logical; if |
The function CommunityProfile
is used to calculate diversity or entropy profiles based on community functions such as Tsallis
or ChaoPD
. The first two arguments of the function must be a probability or abundance vector and a number (q).
Additional arguments cannot be checked. Unexpected results may be returned if FUN
is not used properly.
If NumberOfSimulations
is greater than 0, a bootstrap confidence interval is produced by simulating communities with rCommunity
and calculating their profiles. The size of those communities may be that of the actual community or specified by size
.
CommunityProfile
objects can be plotted. They can also be added to the current plot by CEnvelope
.
A CommunityProfile
, which is a list:
x |
The order q values |
y |
The entropy or diversity values returned by |
low |
The lower bound of the confidence interval |
high |
The upper bound of the confidence interval |
Eric Marcon <[email protected]>, Bruno Herault <[email protected]>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # Load Paracou data (number of trees per species in two 1-ha plot of a tropical forest)
data(Paracou618)
# Plot diversity estimated without bias correction
plot(CommunityProfile(Diversity, Paracou618.MC$Ps, seq(0, 2, 0.2)),
lty=3, ylim=c(50, 350))
# Estimate diversity, with a condidence envelope
# (only 10 simulations to save time, should be 1000)
Profile <- CommunityProfile(Diversity, as.AbdVector(Paracou618.MC$Ns),
seq(0, 2, 0.2), Correction="UnveilJ", NumberOfSimulations=10)
# Complete the plot, and add the legend
CEnvelope(Profile, main="Paracou Plots Diversity")
legend("topright", c("Bias Corrected", "Biased"), lty=c(1,3), inset=0.01)
# Advanced use with beta-diversity functions :
# Profile of the beta entropy of the first community of Paracou618.
# Observed and expected probabilities are bound into a 2-column matrix
# An intermediate function is necessary to separate them before calling TsallisBeta
# The CheckArguments is mandatory but does not need to be set: CommunityProfile() sets it to FALSE
CommunityProfile(function(PandPexp, q, CheckArguments)
{TsallisBeta(PandPexp[, 1], PandPexp[, 2], q)},
NorP=cbind(Paracou618.MC$Psi[, 1], Paracou618.MC$Ps), q.seq=seq(0, 2, 0.2))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.