bayesianOverlap: Calculate the overlap between two ellipses based on their...

View source: R/bayesianOverlap.R

bayesianOverlapR Documentation

Calculate the overlap between two ellipses based on their posterior distributions.

Description

This function loops over the posterior distribution of the means and covariances matrices of two specified groups.

Usage

bayesianOverlap(
  ellipse1,
  ellipse2,
  ellipses.posterior,
  draws = 10,
  p.interval = 0.95,
  n = 100,
  do.plot = FALSE
)

Arguments

ellipse1

character code of the form "x.y" where x is an integer indexing the community, and y an integer indexing the group within that community. This specifies the first of two ellipses whose overlap will be compared.

ellipse2

same as ellipse1 specifying a second ellipse.

ellipses.posterior

a list of posterior means and covariances fitted using siberEllipses().

draws

an integer specifying how many of the posterior draws are to be used to estimate the posterior overlap. Defaults to 10 which uses the first 10 draws. In all cases, the selection will be 1:draws so independence of the posterior draws is assumed. Setting to NULL will use all the draws (WARNING - like to be very slow).

p.interval

the prediction interval used to scale the ellipse as per addEllipse().

n

the number of points on the edge of the ellipse used to define it. Defaults to 100 as per addEllipse().

do.plot

logical switch to determine whether the corresponding ellipses should be plotted or not. A use-case would be in conjunction with a low numbered draws so as to visualise a relatively small number of the posterior ellipses. Defaults to FALSE.

Value

A data.frame comprising three columns: the area of overlap, the area of the first ellipse and the area of the second ellipse and as many rows as specified by draws.


SIBER documentation built on Oct. 19, 2023, 5:09 p.m.