Adds the main and partial effects of a supplmentary variable to a MCA cloud of individuals, with one or more supplementary partialled out

ggadd_partial(p, resmca, var, control, sel = 1:nlevels(var),
axes = c(1,2), col = "black", textsize = 4, lines = TRUE, dashes = TRUE, 
legend = "right", force = 1, max.overlaps = Inf)

Arguments

p

ggplot2 object with the cloud of variables or the cloud of individuals

resmca

object created with MCA, speMCA, csMCA, wcMCA, bcMCA, stMCA or multiMCA function

var

factor. The categorical supplementary variable.

control

data frame of supplementary variables to be partialled out (i.e. control variables)

sel

numeric vector of indexes of the categories of the supplementary variable. By default, every categories are used.

axes

numeric vector of length 2, specifying the components (axes) to plot. Default is c(1,2).

col

the color for the labels and lines. Default is "black".

textsize

size of the labels of categories. Default is 4.

lines

logical. Whether to add colored lines between the points of the categories of v1. Default is TRUE.

dashes

logical. Whether to add gray dashed lines between the points of the categories of v2. Default is TRUE.

legend

the position of legends ("none", "left", "right", "bottom", "top", or two-element numeric vector). Default is right.

force

force of repulsion between overlapping text labels. Defaults to 1. If 0, labels are not repelled at all.

max.overlaps

exclude text labels that overlap too many things. Defaults to Inf, which means no labels are excluded.

Value

a ggplot2 object

Note

Coordinates of the partial effect of the supplementary variables are derives from linear regression, with individual coordinates as dependent variable, and the supplementary and control variables as independent variables.

References

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).

Author

Nicolas Robette

Examples

# 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)
# effect of education,
# with age partialled out (partial effect) or not (main effect)
p <- ggcloud_indiv(mca, col = "grey95")
ggadd_partial(p, mca, Taste$Educ, Taste$Age)
#> Warning: Using alpha for a discrete variable is not advised.