CIplot_biv: Bivariate confidence and data ellipses

Description Usage Arguments Details Author(s) References See Also Examples

View source: R/CIplot_biv.r

Description

Draws confidence and data ellipses in bivariate scatterplots

Usage

1
2
3
4
5
6
CIplot_biv(x, y, group, wt=rep(1/length(x),length(x)), 
           varnames=c("x","y"), groupnames=sort(unique(group)), 
           groupcols=rainbow(length(unique(group))), 
           shownames=TRUE, xlim=c(NA,NA), ylim=c(NA,NA), 
           lty=1, lwd=1, add=FALSE, alpha=0.95, ellipse=0, 
           shade=FALSE, frac=0.01, cex=1) 

Arguments

x

x-variable (horizontal) of scatterplot

y

y-variable (vertical) of scatterplot

group

Grouping variable

wt

Set of weights on the cases (operates when ellipse=1)

varnames

Vector of two labels for the axes (default is x and y)

groupnames

Vector of labels for the groups (default is 1, 2, etc...)

groupcols

Vector of colours for the groups

shownames

Whether to show group names at group centroids or not (default is TRUE)

xlim

Possible new x-limits for plot

ylim

Possible new y-limits for plot

lty

Line type for the ellipses (default is 1)

lwd

Line width for the ellipses (default is 1)

add

=TRUE if ellipses/intervals are added to existing plot (default is FALSE)

alpha

Confidence level of ellipses (default is 0.95)

ellipse

Type of ellipse (see Details below; default is 0 for normal-based ellipses)

shade

=TRUE for ellipse shading (default=FALSE)

frac

Proportional part defining the width of the bars at the edges of confidence intervals (for ellipse=3 and 4)

cex

Character expansion factor for group names

Details

The function CIplot_biv makes various types of confidence and data ellipses, according to option ellipse. Set ellipse<0 for regular data-covering ellipses. Set ellipse=0 (default) for normal-theory confidence ellipses. Setellipse=1 for bootstrap confidence ellipses. The option ellipse=2 for the delta method is not implemented yet. Set ellipse=3 for normal-theory confidence error bars lined up with axes. Set ellipse=4 for bootstrap confidence error bars along axes. The package ellipse is required.

Author(s)

Michael Greenacre

References

Greenacre, M. (2016), Data reporting and visualization in ecology, Polar Biology, 39:2189-2205.

See Also

DOT

Examples

1
2
3
4
5
6
7
8
# Generate some bivariate normal data in three groups with different means
# Means (1,0), (0,1) and (0,0)
means  <- matrix(c(1,0,0,1,0,0), ncol=3)
data   <- matrix(nrow=300, ncol=2)
groups <- sample(rep(c(1,2,3), 100))
for(i in 1:300) data[i,] <- rnorm(c(1,1), mean=means[,groups[i]])
# Plot confidence ellipses with shading
CIplot_biv(data[,1], data[,2], group=groups, shade=TRUE)

easyCODA documentation built on Sept. 20, 2020, 1:07 a.m.