View source: R/ggadd_partial.R
ggadd_partial | R Documentation |
Adds the main and partial effects of a supplementary variable to a MCA cloud of individuals, with one or more supplementary partialled out
ggadd_partial(p, resmca, var, controls, excl = NULL,
axes = c(1,2), col = "black", textsize = 4, lines = TRUE, dashes = TRUE,
legend = "right", force = 1, max.overlaps = Inf)
p |
|
resmca |
object created with |
var |
factor. The categorical supplementary variable. |
controls |
data frame of supplementary variables to be partialled out (i.e. control variables) |
excl |
character vector of categories from the var to exclude from the plot. If NULL (default), all the supplementary categories are plotted. |
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. |
a ggplot2
object
The partial effects of the supplementary variable are computed with the Average Marginal Effects of a linear regression, with individual coordinates as dependent variable, and the supplementary and control variables as independent variables.
Nicolas Robette
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).
ggcloud_variables
, ggadd_supvar
, ggadd_supvars
, ggadd_interaction
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.