ggadd_kellipses.Rd
Adds concentration ellipses and other kinds of k-inertia ellipses for a categorical variable to a MCA cloud of individuals.
ggplot2
object with the cloud of individuals
object of class MCA
, speMCA
, csMCA
, stMCA
or multiMCA
Factor. The categorical variable used to plot ellipses.
numeric vector of indexes of the categories to plot (by default, ellipses are plotted for every categories)
numeric vector of length 2, specifying the components (axes) to plot. Default is c(1,2).
numeric. The kappa value (i.e. "index") of the inertia ellipses. By default, kappa = 2, which means that concentration ellipses are plotted.
Logical. Should the labels of the categories be plotted at the center of ellipses ? Default is TRUE.
Size of the labels of the categories at the center of ellipses. Default is 3.
Size of the lines of the ellipses. Default is 0.5.
If TRUE (default), the points are coloured according to their subcloud.
the position of legends ("none", "left", "right", "bottom", "top", or two-element numeric vector). Default is right.
a ggplot2
object
If kappa=2, ellipses are called "concentration" ellipses and, for a normally shaped subcloud, contain 86.47 percents of the points of the subcloud. If kappa=1, ellipses are "indicator" ellipses and contain 39.35 percents of the points of the subcloud. If kappa=1.177, ellipses are "median" ellipses and contain 50 percents of the points of the subcloud. This function has to be used after the cloud of individuals has been drawn.
Ellipses are colored according to the categories of the variable, using the default ggplot2
palette. The palette can be customized using any scale_color_*
function, such as scale_color_brewer()
, scale_color_grey()
or scale_color_manual()
.
Le Roux B. and Rouanet H., Multiple Correspondence Analysis, SAGE, Series: Quantitative Applications in the Social Sciences, Volume 163, CA:Thousand Oaks (2010).
Le Roux B. and Rouanet H., Geometric Data Analysis: From Correspondence Analysis to Stuctured Data Analysis, Kluwer Academic Publishers, Dordrecht (June 2004).
# specific MCA of Music example data set
data(Music)
junk <- c("FrenchPop.NA", "Rap.NA", "Rock.NA", "Jazz.NA", "Classical.NA")
mca <- speMCA(Music[,1:5], excl = junk)
# concentration ellipses for Age
p <- ggcloud_indiv(mca, col = "lightgrey")
ggadd_ellipses(p, mca, Music$Age)