View source: R/ggassoc_phiplot.R

ggassoc_phiplot | R Documentation |

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)

`data` |
dataset to use for plot |

`mapping` |
aesthetic being used. It must specify x and y. |

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

`max.asso` |
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. |

`sort` |
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. |

`axes.labs` |
Whether to display the labels of the axes, i.e. the names of x and y. Default is TRUE. |

`ticks.labs` |
Whether to display the labels of the categories of x and y. Default is TRUE. |

`text.size` |
Size of the association measure. If NULL, the text is not added to the plot. |

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

Nicolas Robette

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"

`assoc.twocat`

, `phi.table`

, `catdesc`

,
`assoc.yx`

, `darma`

, `ggassoc_crosstab`

, `ggpairs`

data(Taste) ggassoc_phiplot(data=Taste, mapping=ggplot2::aes(x=Age, y=Classical))

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.