plotConfidenceEllipse: Add confidence ellipse for groups of points on scatter plot

Description Usage Arguments Examples

View source: R/plotseries.R

Description

The method shows confidence ellipse for groups of points on a scatter plot made using 'mdaplot()' function with 'cgroup' parameter. It will work only if 'cgroup' is a factor.

Usage

1
plotConfidenceEllipse(p, conf.level = 0.95, lwd = 1, lty = 1, opacity = 0)

Arguments

p

plot data returned by function 'mdaplot()'.

conf.level

confidence level to make the ellipse for (between 0 and 1).

lwd

thickness of line used to show the hull.

lty

type of line used to show the hull.

opacity

of opacity is 0 ellipse is transparent otherwise semi-transparent.

Examples

1
2
3
4
5
6
7
8
9
# adds 90% confidence ellipse with semi-transparent area over two clusters of points

library(mdatools)
data(people)
group <- factor(people[, "Sex"], labels = c("Male", "Female"))

# first make plot and then add confidence ellipse
p <- mdaplot(people, type = "p", cgroup = group)
plotConfidenceEllipse(p, conf.level = 0.90, opacity = 0.2)

mdatools documentation built on Sept. 13, 2021, 9:07 a.m.