ggadd_corr | R Documentation |

Adds a heatmap representing the correlation coefficients to a MCA cloud of individuals, for a numerical supplementary variable or one category of a categorical supplementary variable, using the ggplot2 framework.

ggadd_corr(p, resmca, var, cat=levels(var)[1], axes=c(1,2), xbins=20, ybins=20, min.n=1, pal="RdYlBu", limits=NULL, legend="right")

`p` |
ggplot object with the cloud of variables |

`resmca` |
object of class |

`var` |
factor or numerical vector. The supplementary variable used for the heatmap. |

`cat` |
character string. numeric vector of indexes of the categories to plot (by default, ellipses are plotted for every categories). Only used if var is a factor. |

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

`xbins` |
integer. Number of bins in the x axis. Default is 20. |

`ybins` |
integer. Number of bins in the y axis. Default is 20. |

`min.n` |
integer. Minimal number of points for a tile to be drawn. By default, every tiles are drawn. |

`pal` |
character string. Name of a diverging ColorBrewer palette. Default is "RdYlBu". |

`limits` |
numerical vector of length 2. Lower and upper limits of the correlation coefficients for the color scale. Should be centered around 0 for a better view of under/over-representations (for example c(-0.2,0.2)). By default, the maximal absolute value of the correlation coefficients is used. |

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

For each tile of the heatmap, a correlation coefficient is computed between the supplementary variable and the fact of belonging to the tile. This gives a view of the under/over-representation of the supplementary variable according to the position in the cloud of individuals.

a ggplot object

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`

, `ggcloud_indiv`

, `ggadd_supvar`

, `ggadd_interaction`

, `ggadd_ellipses`

, `ggadd_density`

## Performs a specific MCA on 'Taste' example data set ## ignoring every 'NA' (i.e. 'not available') categories, ## draws the cloud of categories ## and adds a correlation heatmap for Age=50+. 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_indiv(mca, col='lightgrey') ggadd_corr(p, mca, var=Taste$Age, cat="50+", xbins=10, ybins=10)

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.