nicheROVER (version 1.0)

overlap.plot: Plot the overlap metric

Description

Plots the posterior distribution of the niche region overlap metric calculated for each pairwise combination of species.

Usage

overlap.plot(over.stat, nbreaks = 50, equal.axis = FALSE, species.names,
  col, mean.cred = TRUE, mean.cred.col = "green", xlab)

Arguments

over.stat

an array with dim(over.stat) = c(nspecies, nspecies, nreps) containing nreps calculations

nbreaks

number of breaks in the histogram. Defaults to 50.

equal.axis

logical. If TRUE, all histograms in a given column of the output (corresponding to different Species \(A\) for the same Species \(B\)) are plotted on the same range.

species.names

a vector of species names. Defaults to dimnames(over.stat)[[1]].

col

a vector of the colours in which each species will be drawn.

mean.cred

logical. If TRUE, vertical lines for mean and 95% credible intervals will be included in the historgram of each overlap metric.

mean.cred.col

colour of the mean and credible interval lines in the histogram.

xlab

optional plot title, located on the bottom. Default is no title.

Value

Returns a series of histograms illustrating the probability of pairwise species overlap.

Details

This function uses the overlap metric information in over.stat calculated by overlap to create 2-dimensional plots of interspecific niche region overlap.

See Also

overlap, niw.post, niiw.post.

Examples

Run this code
# NOT RUN {
# fish data
data(fish)

# parameter draws from the "default" posteriors of each fish
nsamples <- 500
system.time({
 fish.par <- tapply(1:nrow(fish), fish$species,
                    function(ii) niw.post(nsamples = nsamples, X = fish[ii,2:4]))
})

# overlap calculation
system.time({
 over <- overlap(fish.par, nreps = nsamples, nprob = nsamples, alpha = c(.95, .99))
})

# overlap plot
clrs <- c("black", "red", "blue", "orange") # color for each species
ii <- 1 # which niche region alpha level to use
overlap.plot(over[,,,ii], col = clrs, mean.cred.col = "turquoise",
            xlab = paste0("Overlap Probability (%) -- Niche Region Size: ",
                          dimnames(over)[[4]][ii]))
# }

Run the code above in your browser using DataLab