Learn R Programming

entropart (version 1.4-8)

CommunityProfile: Diversity or Entropy Profile of a community

Description

Calculates the diversity or entropy profile of a community, applying a community function to a vector of orders.

Usage

CommunityProfile(FUN, NorP, q.seq = seq(0, 2, 0.1), 
    NumberOfSimulations = 0, Alpha = 0.05, BootstrapMethod = "Chao2015", 
    …, CheckArguments = TRUE)
as.CommunityProfile(x, y, low = NULL, high = NULL)
is.CommunityProfile(x)
# S3 method for 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", …)

Arguments

FUN

The function to be applied to each value of \(q\).

NorP

A numeric vector or a two-column matrix. Contains either abundances or probabilities. Two-column matrices should contain the observed abundances (or probabilities) in the first column and the expected ones in the second column, to allow using beta diversity functions.

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 rCommunity.

x

An object to be tested or plotted or the vector of orders of community profiles in as.CommunityProfile.

y

Entropy or diversity values of each order, corresponding to x values.

low

Entropy or diversity lower bound of the confidence envelope, corresponding to x values.

high

Entropy or diversity higher bound of the confidence envelope, corresponding to x values.

Profile

An CommunityProfile to be plotted.

Additional arguments to be passed to FUN in CommunityProfile, to plot in plot.CommunityProfile or to lines in CEnvelope.

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 TRUE, the function arguments are verified. Should be set to FALSE to save time when the arguments have been checked elsewhere.

Value

A CommunityProfile, which is a list:

x

The order \(q\) values

y

The entropy or diversity values returned by FUN

low

The lower bound of the confidence interval

high

The upper bound of the confidence interval

Details

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 or a two-column matrix (for beta diversity functions) 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.

CommunityProfile objects can be plotted. They can also be added to the current plot by CEnvelope.

Examples

Run this code
# NOT RUN {
  # 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)
# }

Run the code above in your browser using DataLab