Correspondence Analysis of Square Tables can be used to visualize tables of frequencies when the row and column labels are the same. See this blog post for more description and examples.
For more information about correspondence analysis in general, see Dimension Reduction - Correspondence Analysis of a Table.
Examples
Example output: For points close together, you are able to move around the labels on the visualization.
Input Example: A table containing the same row and column headers in the exact same order showing either 'n' (in Q), 'Count' (in Displayr), 'Total %', 'Population', 'Correlation', or 'Index'
Options
Input table The name of a table containing data to be analyzed. The row and column names should match exactly. The table should only contain a single statistic (e.g., Total %). The statistic that is shown first will be used in the analysis. For example, if you have a table showing Total % and Column %, then Column % will be used (whereas Total % is the more orthodox choice).
Note, that if the supplied table contains correlations (either a Q Table or an output from Correlation - Correlation Matrix), then 1 is automatically added to each value in the table. This ensures that all values are positive, so that the assumptions for Correspondence Analysis are met.
Paste or type table As an alternative to Input table, you can instead open up a blank spreadsheet into which you can manually enter or paste table.
Output: Either Scatterplot, Bubble Chart or Text
Bubble sizes: A numeric vector with names that are the same as the row names of the input table. If no vector is supplied then the diagonal of the input table will be used.
Supplementary A comma delimited list of labels which are not used to fit the low-dimensional space, but are plotted in the space.
Rows to ignore, Columns to ignore The names of any rows or columns to be removed from the table prior to analysis.
Horizontal dimension, Vertical dimension The dimensions to plot on the horizontal and vertical axes respectively. Since dimensions are output in order of decreasing variance, the first and second dimensions are usually of most interest.
Flip horizontally, Flip vertically Whether to reverse (i.e. invert the sign of) the output coordinates for the specified dimension(s). This may allow better visualization, especially when comparing maps that are similar apart from reflections.
Use logos for labels When this option is selected, the user can replace the labels in the scatterplot with logos. The logos should be supplied as a comma-separated list of URLs.
Maximum number of labels to plot The option limits the number of labels shown. It is useful when there are many points with overlapping labels. The remaining points will be shown without labels.
Chart title Optional title for the scatterplot or bubble chart.
Color Control the color of the scatterplot points
Additional options are available by editing the code.
DIAGNOSTICS
Quality Table Creates an table containing measures of the quality of a correspondence analysis.
Additional Properties
When using this feature you can obtain additional information that is stored by the R code which produces the output.
- To do so, in Q select Create > R Output and in Displayr select Calculation > Custom Code
- In the R CODE, paste: item = YourReferenceName
- Replace YourReferenceName with the reference name of your item. Find this in the Report tree or by selecting the item and then going to Properties > General > Name from the object inspector on the right.
- Below the first line of code, you can paste in snippets from below or type in str(item) to see a list of available information.
For a more in depth discussion on extracting information from objects in R, checkout our blog post here.
Properties which may be of interest are:
- Row coordinates:
-
- item$row.coordinates # plot row coordinates
- Column coordinates:
-
- item$column.coordinates # plot column coordinates
- Combine row and column coordinates into a single object:
-
- dimensions = rbind(item$row.coordinates,item$column.coordinates) # combined row/column coordinates
- Just take the first 2 dimensions (columns) (appropriate for export into a scatterplot):
-
- dimensions[,1:2]
Acknowledgements
The R package ca is used to compute the correspondence analysis.
Next
Displayr: How to Do Correspondence Analysis of a Square Table
Q: How to Do a Correspondence Analysis of a Square Table