ggadd_corr.Rd
Adds a heatmap representing the correlation coefficients to a MCA cloud of individuals, for a numerical supplementary variable or one category of a categorical supplementary variable.
ggplot2
object with the cloud of variables
object of class MCA
, speMCA
, csMCA
, stMCA
or multiMCA
factor or numerical vector. The supplementary variable used for the heatmap.
character string. The category of var
to plot (by default, the first level of var
is plotted). Only used if var is a factor.
numeric vector of length 2, specifying the components (axes) to plot. Default is c(1,2).
integer. Number of bins in the x axis. Default is 20.
integer. Number of bins in the y axis. Default is 20.
integer. Minimal number of points for a tile to be drawn. By default, every tiles are drawn.
character string. Name of a (preferably diverging) palette from the RColorBrewer
package. Default is "RdYlBu".
numerical vector of length 2. Lower and upper limits of the correlation coefficients for the color scale. Should be centered around 0 for a better view of under/over-representations (for example c(-0.2,0.2)). By default, the maximal absolute value of the correlation coefficients is used.
the position of legends ("none", "left", "right", "bottom", "top", or two-element numeric vector). Default is right.
a ggplot2
object
For each tile of the heatmap, a correlation coefficient is computed between the supplementary variable and the fact of belonging to the tile. This gives a view of the under/over-representation of the supplementary variable according to the position in the cloud of individuals.
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 Taste example data set
data(Taste)
junk <- c("FrenchPop.NA", "Rap.NA", "Rock.NA", "Jazz.NA", "Classical.NA",
"Comedy.NA", "Crime.NA", "Animation.NA", "SciFi.NA", "Love.NA",
"Musical.NA")
mca <- speMCA(Taste[,1:11], excl = junk)
# correlation heatmap for Age = 50+
p <- ggcloud_indiv(mca, col = "lightgrey")
ggadd_corr(p, mca, var = Taste$Age, cat = "50+", xbins = 10, ybins = 10)