Creates a correlation matrix from variables, questions, or a table.
Technical details
Description
See What is Correlation? and What is a Correlation Matrix? for more information about correlation and correlation matrices.
Inputs
-
Input type The type of input to use. A choice between Variables, Questions/Variable sets and Table.
- Variables The variables to use in the correlation matrix. Select two or more Numeric or Numeric-Multi variables from the Variables dropdown box. This will run the correlation on the respondent-level values.
- Variable sets The variable sets to use in the correlation matrix. This will run the correlation on the respondent-level values.
- Table The table to use in the correlation matrix. Correlations are calculated between columns in the table.
- Ignore For question inputs, these are the question categories to ignore; for table inputs, these are the columns and rows in the source table to ignore.
- Missing data See Missing Data Options.
-
Correlation type Choose between the standard Pearson's correlation or Spearman's correlation.
- Pearson (default) - based on the actual data.
- Spearman - based on the ranks of the data (this is less susceptible to outliers and thus less likely to represent the true nature of the correlation).
- Categorical as binary Represent unordered categorical variables as binary variables. Otherwise, they are represented as sequential integers (i.e., 1 for the first category, 2 for the second, etc.). Note that categorical variables in Numeric - Multi questions are treated according to their numeric values and not converted to binary.
- Variable names Displays Variable Names in the output.
- Color palette Select colors used in the color scale bar
- Minimum/maximum value Set upper and lower bounds of the color scale. Value beyond this range will be set to NA.
- Show cell values Whether to display cell values, or if this should be determined based on available space (Automatic).
- Show row labels Whether to display row labels.
- Show column labels Whether to display column labels.
Output
Matrix example below using variables as inputs:
Additional Properties
When using this feature you can obtain additional information that is stored by inspecting it using custom R code in an item below:
#change YourReferenceName to the reference name (under Properties > General) of your analysis
item = YourReferenceName
str(item)
Properties which may be of interest are:
- The correlation values themselves:
-
- item$cor # correlation values
- The p-values:
-
- item$p # p-values (note that these are computed using taylor series linearization, whereas the standard errors and resulting statistics that appear on standard tables are computed using calibration, so their results can be different).
- The t-statistics:
-
- item$t # t-statistic
Acknowledgements
Uses the R package survey and the d3heatmap htmlwidget.
Method
- In Displayr: How to Create a Correlation Matrix
- In Q: How to Create a Correlation Matrix
Next
How to Create a Table of Coefficients From a Correlation Matrix