addEllipse: Adds an ellipse around some data to an existing plot

Description Usage Arguments Value Examples

View source: R/addEllipse.R


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.


addEllipse(mu, sigma, m = NULL, n = 100, p.interval = NULL,
  ci.mean = FALSE, small.sample = FALSE, do.plot = TRUE, ...)



a vector of length two specifying the bivariate means


a 2x2 covariance matrix for the data


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.


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.


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.


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.


a logical that determines whether or not the small sample size correction is to be applied (TRUE) or not (FALSE). Defaults to FALSE. This allows SEAc rather than SEA to be plotted, but the correction can be applied to any percentile ellipse.


A logical that determines whether plotting should occur (TRUE and default) or not (FALSE). Setting to false is useful if you want to access the coordinates of the ellipse in order to calculate overlap between ellipses for example.


additional arguments as a list to be passed to plot.


A n x 2 matrix comprising the x and y coordinates of the ellipse.



SIBER documentation built on May 20, 2017, 12:01 a.m.

Search within the SIBER package
Search all R packages, documentation and source code