Adds an ellipse around some data to an existing plot

Description

This function adds an ellipse based on means and covariance to an existing plot. The ellipse can be scaled so as to represent any prediction interval of the data you wish, or alternatively any confidence interval of the bivariate means.

Usage

1
2
addEllipse(mu, sigma, m = NULL, n = 100, p.interval = NULL,
  ci.mean = FALSE, ...)

Arguments

mu

a vector of length two specifying the bivariate means

sigma

a 2x2 covariance matrix for the data

m

is the sample size of the dataset on which the ellipse is to be plotted. This is only informative if calculating the confidence interval of the bivariate mean, which requires a correction of 1/sqrt(m). Defaults to NULL and has no effect.

n

the number of data points to be used to plot the ellipse. More points makes for a smoother ellipse, especially if it has high eccentricity. Defaults to n = 100.

p.interval

the quantile to be used to construct a prediction ellipse that contains p.interval proportion of the data. By default, p.interval = NULL and the Standard Ellipse is drawn which contains approximately 40% of the data. Setting p.interval = 0.95 will result in an ellipse that contains approximately 95% of the data.

ci.mean

a logical that determines whether the ellipse drawn is a prediction ellipse of the entire data, or a confidence interval of the bivariate means. Defaults to FALSE. If set to TRUE, then p.interval can be used to generate an appropriate % confidence interval of the bivariate means.

...

additional arguments as a list to be passed to plot.

Value

A 6 x m matrix of the 6 Layman metrics of dX_range, dY_range, TA, CD, MNND and SDNND in rows, for each community by column

Examples

1
2
3

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.