Correlation Matrix Calculator
Calculate the Pearson correlation matrix for a dataset containing multiple numerical variables. Enter your observations, select whether the first row contains column names, and calculate the correlation between every pair of variables.
Calculate a Correlation Matrix
Enter your data below. Each row represents one observation, and each column represents one variable. Separate values with commas, semicolons or tabs.
What Is a Correlation Matrix?
A correlation matrix is a square matrix that summarizes the relationships between numerical variables in a dataset. Each entry contains a correlation coefficient describing the strength and direction of the linear relationship between two variables.
This calculator uses the Pearson product-moment correlation coefficient. It is commonly used in statistics, finance, economics, scientific research, data analysis and machine learning.
Pearson correlation formula
Here, x and y represent two variables, x̄ and ȳ are their respective means, and each i represents a paired observation. The result is the Pearson correlation coefficient, usually represented by r.
Properties of a correlation matrix
- Square matrix: the number of rows and columns equals the number of variables.
- Symmetric: the correlation between X and Y equals the correlation between Y and X.
- Diagonal values: every diagonal entry is 1 for a variable with nonzero variance.
- Bounded coefficients: every Pearson coefficient is between -1 and +1.
- Unitless: correlation coefficients do not depend on the measurement units of the variables.
How to Interpret Correlation Coefficients
The sign of a coefficient describes the direction of a linear relationship. Its absolute value indicates the strength of that relationship.
| Correlation coefficient | Interpretation |
|---|---|
| +1.00 | Perfect positive linear correlation |
| +0.70 to +0.99 | Strong positive correlation |
| +0.40 to +0.69 | Moderate positive correlation |
| +0.20 to +0.39 | Weak positive correlation |
| −0.19 to +0.19 | Very weak linear correlation |
| −0.20 to −0.39 | Weak negative correlation |
| −0.40 to −0.69 | Moderate negative correlation |
| −0.70 to −0.99 | Strong negative correlation |
| −1.00 | Perfect negative linear correlation |
These labels are general guidelines, not universal statistical thresholds. The meaning of a correlation depends on the research context, sample size, data quality and the shape of the relationship.
Example of a Correlation Matrix
Suppose a dataset contains three variables: study hours, exam scores and sleep hours. After calculating the pairwise Pearson coefficients, a possible correlation matrix could look like this:
| Study hours | Exam score | Sleep hours | |
|---|---|---|---|
| Study hours | 1.00 | 0.85 | 0.20 |
| Exam score | 0.85 | 1.00 | 0.35 |
| Sleep hours | 0.20 | 0.35 | 1.00 |
In this illustrative matrix, study hours and exam scores have a strong positive linear association. Study hours and sleep hours have a weaker positive association. The diagonal values are all 1 because each variable is perfectly correlated with itself.
The example demonstrates how to read a correlation matrix; the values are illustrative and are not calculated from the default example dataset.
Correlation Matrix vs. Covariance Matrix
Both matrices describe relationships between variables, but they measure different quantities.
- A covariance matrix contains covariances and is affected by the scales and units of the variables.
- A correlation matrix contains standardized correlation coefficients between -1 and +1.
- Correlation is often easier to compare across variables with different measurement units.
Correlation coefficients can be calculated by dividing covariance by the product of the two variables' standard deviations.
Important Statistical Considerations
Correlation does not imply causation
A high correlation does not prove that one variable causes another. Two variables may be associated because of a third variable, coincidence, selection effects or another underlying process.
Pearson correlation measures linear association
Two variables can have a strong nonlinear relationship and still have a Pearson correlation close to zero. A scatter plot is useful for checking the shape of a relationship and identifying outliers.
Sample size matters
Correlations calculated from small datasets can be unstable. A coefficient should be interpreted alongside the sample size and, where appropriate, confidence intervals and statistical significance tests.
Missing data
This calculator requires a complete numerical dataset. Every observation must have a valid value in every variable column. It does not automatically replace missing values or estimate them.
Frequently Asked Questions
1. What is a correlation matrix used for?
It is used to examine the pairwise linear relationships among several variables. It is common in exploratory data analysis, finance, scientific research, feature selection and statistical modeling.
2. What is the difference between positive and negative correlation?
Positive correlation means that larger values of one variable tend to occur with larger values of the other. Negative correlation means that larger values of one variable tend to occur with smaller values of the other.
3. Why are the diagonal entries equal to 1?
Each variable has a perfect positive correlation with itself, provided it has nonzero variance. Therefore, the diagonal of a valid correlation matrix contains ones.
4. Why is the correlation matrix symmetric?
The Pearson correlation between X and Y is the same as the correlation between Y and X. Consequently, the entries on opposite sides of the main diagonal are equal.
5. Can a correlation coefficient be greater than 1?
No. A valid Pearson correlation coefficient must be between -1 and +1. A result outside this range indicates a calculation or data problem.
6. Why can the calculator reject a column?
If every observation in a column has the same value, its standard deviation is zero. Pearson correlation requires division by the standard deviations of both variables, so the correlation is undefined.
7. How many variables can I enter?
This calculator supports up to 20 variables and 1,000 observations. Every row must have the same number of columns.
8. Can I use this calculator for financial data?
Yes. You can enter numerical financial variables such as asset returns or prices. For financial analysis, returns are often more appropriate than raw price levels when examining relationships between assets.
9. Does this calculator use Pearson or Spearman correlation?
It calculates Pearson correlation. Spearman rank correlation is a different method based on ranked observations and is not calculated by this tool.
10. Does the calculator change or normalize my input data?
No. It calculates the Pearson coefficients directly from the numerical observations. The standardization is part of the correlation formula; the original dataset is not modified.