Learn R Programming

Momocs (version 1.1.6)

conf_ell: Confidence ellipses

Description

Draw (gaussian) confidence ellipses

Usage

conf_ell(x, y, conf = 0.95, nb.pts = 60)

Arguments

x
numeric values on the x axis
y
numeric values on the y axis
conf
the level of confidence
nb.pts
the number of points to return, to draw the ellipsis

Value

a list with $ell coordinates of the ellipse and $seg coordinates of its vertices a matrix of (x; y) coordinates to draw the ellipsis

See Also

Other plotting functions: Ntable, coo_arrows, coo_draw, coo_listpanel, coo_lolli, coo_plot, coo_ruban, ldk_chull, ldk_confell, ldk_contour, ldk_labels, ldk_links, plot_devsegments

Examples

Run this code
x <- rnorm(100, sd=3)
y <- rnorm(100)
plot(x, y, asp=1)
ce095 <- conf_ell(x, y, conf=0.95) # no need for conf arg since it's .95 by default
ce090 <- conf_ell(x, y, conf=0.90)
ce050 <- conf_ell(x, y, conf=0.50)
cols <- col_hot(10)
lines(ce050$ell, col=cols[5]) # you can also coo_close(ce050$ell)
lines(ce090$ell, col=cols[8])
lines(ce095$ell, col=cols[9])
segments(ce095$seg[1, 1], ce095$seg[1, 2], ce095$seg[2, 1], ce095$seg[2, 2])
segments(ce095$seg[3, 1], ce095$seg[3, 2], ce095$seg[4, 1], ce095$seg[4, 2])

Run the code above in your browser using DataLab