For a cross-tabulation, plots the phi measures of association with bars of varying height, using ggplot2.

ggassoc_phiplot(data, mapping, measure="phi", max.asso=NULL,
sort="none", axes.labs=TRUE, ticks.labs=TRUE, text.size=3)

## Arguments

data dataset to use for plot aesthetic being used. It must specify x and y. character. The measure for attractions: "phi" (default) for phi coefficients, "pem" for percentages of maximum deviation (PEM). numeric value, specifying the lower and upper limit of the scale for the color gradient filling the rectangles, i.e. for the measures of association. It corresponds to the maximum absolute value of association one wants to represent in the plot. If NULL (default), the limit is automatically adjusted to the data. character. If "both", rows and columns are sorted according to the first factor of a correspondence analysis of the contingency table. If "x", only rows are sorted. If "y", only columns are sorted. If "none" (default), no sorting is done. Whether to display the labels of the axes, i.e. the names of x and y. Default is TRUE. Whether to display the labels of the categories of x and y. Default is TRUE. Size of the association measure. If NULL, the text is not added to the plot.

## Details

The phi measure of association measures how much each combination of categories of x and y is over/under-represented. The bars vary in width according to the number of observations in the categories of the x variables. They vary in height according to the phi measure of association. Bars are black if phi is positive and white if phi is negative.

Cramer's V measure of global association between x and y is displayed in upper-left corner of the plot.

This function can be used as a high-level plot with ggduo and ggpairs functions of the GGally package.

a ggplot object

## References

Cibois Philippe, 2004, Les écarts à l'indépendance. Techniques simples pour analyser des données d'enquêtes, Collection "Méthodes quantitatives pour les sciences sociales"

## Author

Nicolas Robette

assoc.twocat, phi.table, catdesc, assoc.yx, darma, ggassoc_crosstab, ggpairs
data(Taste)