Learn R Programming

GDAtools (version 1.7)

ggadd_attractions: Adds attractions between categories via segments to a cloud of variables

Description

Adds attractions between categories, as measured by phi coefficients or percentages of maximum deviation (PEM), by plotting segments onto a MCA cloud of variables, using the ggplot2 framework.

Usage

ggadd_attractions(p, resmca, axes=c(1,2), measure="phi", min.asso=0.3,
col.segment="lightgray", col.text="black", text.size=3)

Arguments

p

ggplot object with the cloud of variables

resmca

object of class MCA, speMCA, csMCA, stMCA or multiMCA.

axes

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

measure

character. The measure for attractions: "phi" (default) for phi coefficients, "pem" for percentages of maximum deviation (PEM).

min.asso

numerical value between 0 and 1. The minimal attraction value for segments to be plotted. Default is 0.3.

col.segment

Character. Color of the segments. Default is lightgray.

col.text

Character. Color of the labels of the categories. Default is black.

text.size

Size of the labels of categories. Default is 3.

Value

a ggplot object

References

Cibois, Philippe. Les m<U+00E9>thodes d<U+2019>analyse d<U+2019>enqu<U+00EA>tes. Nouvelle <U+00E9>dition [en ligne]. Lyon: ENS <U+00C9>ditions, 2014. Disponible sur Internet : <http://books.openedition.org/enseditions/1443>

See Also

ggcloud_variables, ggcloud_indiv, ggadd_ellipses, ggadd_corr, ggadd_interaction, ggadd_density

Examples

Run this code
# NOT RUN {
## Performs a specific MCA on 'Taste' example data set
## ignoring every 'NA' (i.e. 'not available') categories,
## draws the cloud of categories
## and adds segments between categories with attractions.
data(Taste)
getindexcat(Taste[,1:11])
mca <- speMCA(Taste[,1:11],excl=c(3,6,9,12,15,18,21,24,27,30,33))
p <- ggcloud_variables(mca, col="white", legend="none")
ggadd_attractions(p, mca, measure="phi", min.asso=0.1)
# }

Run the code above in your browser using DataLab