plotAddEllipses: Add Prediction Ellipses to a Plot

Description Usage Arguments Details Value References Examples

View source: R/plot.addEllipses.R

Description

This function draws prediction ellipses around taxa.

Usage

1
2
plotAddEllipses(result, axes = c(1,2), probability = 0.95, col = "black",
                  type = "l", lty = 1, lwd = 1, ...)

Arguments

result

result of pca.calc, pcoa.calc, nmds.calc, or cda.calc, has to by plotted at first.

axes

x, y axes of plot.

probability

probability, that a new independent observation from the same population will fall in that ellipse.

col

the colours for labels.

type

character indicating the type of plotting, for details, see plot: "p" for points, "l" for lines, "b" for both points and lines, "c" for empty points joined by lines, "o" for overplotted points and lines, "s" and "S" for stair steps and "h" for histogram-like vertical lines.

lty

the line type. Line types can either be specified as one of following types: 0=blank, 1=solid (default), 2=dashed, 3=dotted, 4=dotdash, 5=longdash, 6=twodash.

lwd

the line width.

...

further arguments to be passed to lines or other graphical parameters in par.

Details

Prediction ellipses with given probability define the regions where will fall any new independent observation from the respective taxa. The prediction ellipses are quantified using covariance matrices of taxa scores and chi-squared distribution with two degrees of freedom (Friendly et al. 2013).

Value

None. Used for its side effect of adding elements to a plot.

References

Friendly M., Monette G., Fox J. (2013). Elliptical insights: understanding statistical methods through elliptical geometry. Statistical Science 28, 1-39.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
data(centaurea)
centaurea = naMeanSubst(centaurea)
centaurea = deletePopulation(centaurea, populationName = c("LIP", "PREL"))

pcaRes = pca.calc(centaurea)

plotPoints(pcaRes, col = c(rgb(255, 0, 0, max = 255, alpha = 150), # red
                           rgb(0, 255, 0, max = 255, alpha = 150), # green
                           rgb(0, 0, 255, max = 255, alpha = 150), # blue
                           rgb(0, 0, 0, max = 255, alpha = 150)), # black
            legend = FALSE, xlim = c(-5, 7.5), ylim = c(-5, 5.5))

plotAddLegend(pcaRes, col = c("red", "green", "blue", "black"), ncol = 2)

plotAddEllipses(pcaRes, col = c("red", "green", "blue", "black"), lwd = 3)

MorphoTools2 documentation built on Dec. 11, 2021, 9:55 a.m.