Converter tool

Correlation Matrix for CSV

Pearson, Spearman or Kendall correlations between every numeric column, with p-values, the number of rows behind each pair and a coloured matrix. Free, and your file stays in this browser tab.

Step 1

Load a table

Or paste CSV or tab-separated text

Correlation Matrix for CSV

Operator: Abdulla Al Fahad. How tools are built and checked

A correlation matrix answers a plain question: which of these columns rise and fall together? Statistics packages produce one in a click, but the version most people meet in a spreadsheet is a bare grid of coefficients with no sample sizes, no significance and no say in how blank cells are handled. This page builds the whole table from a CSV or XLSX and keeps those missing pieces in view.

You choose the coefficient (Pearson for straight-line relationships, Spearman or Kendall tau-b for rank order), how missing values are treated, and whether the significance stars should survive a correction for testing many pairs at once. Every cell can show the coefficient, its p-value or the number of rows behind it, and any pair opens a scatter plot.

Key features

  • Pearson r, Spearman rho and Kendall tau-b, with ties handled in the last two
  • p-value for every pair, plus an optional Holm step-down or Bonferroni correction that drives the significance stars
  • Fisher z 95 percent confidence interval for each Pearson coefficient
  • Matrix cells that print the coefficient, the p-value or the row count, coloured blue for negative and orange for positive
  • A ranked list of pairs with a strength label, row count, p-value and adjusted p-value
  • A scatter plot with a least-squares line for any pair you select, with warnings for outlier-driven results and perfect collinearity
  • Downloads: matrix CSV, pairs CSV, and an XLSX with a colour-filled matrix sheet, P-values, N per pair, Pairs and Notes

Three coefficients, missing-value rules and how p-values are found

A column counts as numeric when at least 90 percent of its non-empty cells read as numbers and at least three cells do, so a percent sign (12% is read as 12) or a currency symbol does not disqualify it. Dates, yes/no columns and text are left out and listed under the column picker. Columns whose names end in id, index, row, no or number start unticked, because a row counter correlates with anything that drifts over time; tick them if you do want them.

At most 40 columns can sit in one matrix, which is 780 pairs, and the checkboxes stop accepting more once the limit is reached. Kendall tau-b is limited to 100,000 rows because it ranks every pair of columns separately; Spearman and Pearson have no tighter row limit than the 300,000 read.

Missing values are handled in one of two ways. Pairwise deletion, the default, uses for each pair every row where both columns have a number, so the number of rows can differ between pairs and is shown per cell. Listwise deletion first keeps only rows that are filled in every ticked column, so every pair uses the same rows. A pair with fewer than 3 shared rows has no defined correlation, and so does a column with a single repeated value; both are shown as n/a with the reason.

How it works

Pearson r is the covariance of the two columns divided by the product of their standard deviations, computed in two passes over the data. Spearman rho ranks each column, giving tied values the average of the ranks they span, and takes the Pearson correlation of those ranks. For both, the p-value comes from t = r times the square root of (n minus 2) over (1 minus r squared), compared with a t distribution with n minus 2 degrees of freedom. The Fisher interval transforms r with the inverse hyperbolic tangent, adds and subtracts 1.96 over the square root of (n minus 3), and transforms back.

Kendall tau-b counts pairs of rows that agree in order minus those that disagree, and divides by a denominator that removes the pairs tied in either column. The page does this in O(n log n) by sorting by the first column and counting inversions in the second with a merge sort, instead of comparing every pair of rows. The p-value uses the normal approximation to the count, with the variance corrected for ties. The fast routine was checked against a brute-force count on 300 random tie-heavy samples of 3 to 62 rows and agreed in every case.

Known values were also checked. For x = 1 to 5 and y = 2, 4, 5, 4, 5, Pearson r comes out at 0.7746 with a two-sided p of 0.1240. The Spearman example 1 to 5 against 5, 6, 7, 8, 7 gives 0.8208 with p 0.0886, and the Kendall example 12, 2, 1, 12, 2 against 1, 4, 7, 1, 0 gives tau-b of minus 0.4714 with p 0.2827, matching the published reference values for those inputs.

Holm correction sorts the p-values from smallest to largest, multiplies the k-th smallest by the number of tests minus k plus one, and keeps the running maximum so the adjusted values never decrease. Bonferroni multiplies every p-value by the number of tests. Both are capped at 1 and the tests counted are the pairs that have a p-value.

Common use cases

  • Screening a spreadsheet of survey scores for which questions move together before building an index from them
  • Checking which marketing inputs track signups, with an honest row count when some weeks are blank
  • Looking for near-duplicate columns in a dataset before fitting a regression, where a coefficient near 1 means one column adds nothing
  • Testing a course assignment's correlation by hand against the numbers a statistics package printed
  • Ranking dozens of sensor readings by how closely they follow a target column

How to use this tool

  1. Choose a file, paste a table, or press Use sample data for 30 weeks of made-up marketing numbers.
  2. Tick the numeric columns to include. Untick anything that is just a label or counter.
  3. Pick Pearson, Spearman or Kendall tau-b, then pairwise or listwise deletion.
  4. Set the significance level and, if the matrix is large, switch on Holm or Bonferroni.
  5. Press Calculate correlations, then switch the cells between coefficient, p-value and row count.
  6. Select a cell or a row in the ranked list to see the scatter plot, then download the matrix CSV, pairs CSV or the XLSX workbook.

Example

Sample file: 30 weeks, columns ad_spend, site_visits, signups, avg_price, support_tickets (week 11 has no signups), Pearson, pairwise deletion

week_id,ad_spend,site_visits,signups,avg_price,support_tickets
1,2178,12834,462,25.61,8
2,1670,11393,405,26.01,12
3,1290,8603,288,25.13,10
...
11,2299,13474,,24.71,15
12,955,7228,256,24.63,11
...

Selected pairs, uncorrected and with Holm correction at the 0.05 level

Pair                            r       n    p       p (Holm)
site_visits / signups           0.970   29   <0.0001 <0.0001
ad_spend / site_visits          0.951   30   <0.0001 <0.0001
ad_spend / signups              0.893   29   <0.0001 <0.0001   (95% CI 0.78 to 0.95)
site_visits / support_tickets   0.524   30   0.0030  0.0209
site_visits / avg_price        -0.404   30   0.0268  0.0804  (not significant after Holm)
avg_price / support_tickets    -0.194   30   0.3048  0.3048

Same visits and signups, Kendall tau-b: 0.842 with n = 29

Tips for best results

  • Switch the cells to row counts once. If one column has far fewer rows than the rest, every pair involving it stands on thin evidence.
  • Use Holm or Bonferroni whenever you scan many pairs. With 10 columns there are 45 pairs, and at the 0.05 level a couple would look significant by chance alone.
  • When Pearson and Spearman disagree by a lot, open the scatter plot. A single extreme point or a curved relationship is usually the reason.
  • Choose Kendall tau-b for small samples with many tied values, such as 1 to 5 ratings; its tie handling is cleaner than the ranks-of-ranks shortcut.
  • Untick any column that is itself a label (a week number, a sequence) so it does not dominate the list of strongest pairs.

Common pitfalls

Correlation does not show cause. Two columns can track each other because a third drives both, or because both simply trend over time.

Pearson only measures straight-line association. A U-shaped relationship can give r near zero while being perfectly predictable; the scatter plot shows it.

The p-values for Pearson and Spearman assume the t approximation holds, and the Kendall p-value is a normal approximation. With fewer than 10 shared rows these are rough, and the page flags any pair that small.

Pairwise deletion means different pairs can rest on different rows, so the matrix is not guaranteed to be a consistent set of correlations. If you plan to feed it into another calculation that expects one, use listwise deletion.

Spearman with many blanks can be slow, because ranks must be recomputed for each pair when columns differ in which rows they miss. A large file with a dozen gappy columns takes noticeably longer than Pearson on the same data, and 40 gappy columns on 300,000 rows takes much longer still; the Cancel button stops the run.

A significant p-value on a very large file does not mean a large effect. At 200,000 rows even a correlation of 0.01 can be significant; read the size of r first.

Common errors and how to fix them

Fewer than two columns in this file are mostly numbers
Check that the first row holds column names, and that numbers are not stored as text with stray characters. Percent signs, commas and currency symbols are fine; units such as 12kg are not.
A column shows n/a for every pair
It holds one repeated value, so it has no variation to correlate. Remove it from the ticked columns.
Kendall tau-b is refused because of the row count
It is limited to 100,000 rows. Use Spearman, which ranks the same way and has no such limit, or filter the file to fewer rows.
Listwise deletion leaves fewer than three rows
A sparse column is removing nearly every row. Untick it, or switch to pairwise deletion so each pair keeps the rows it has.

Best practices

  • Look at the scatter plot of any pair you plan to quote, not just its coefficient.
  • Say which coefficient, which deletion rule and how many rows when you report a figure from this table.
  • Switch to listwise deletion when every coefficient must rest on exactly the same rows; with pairwise deletion n differs by pair, so two cells of one matrix can describe different samples.

Choosing between the three coefficients

Pearson is the default because it is the one most readers expect, and it is the only one with a confidence interval here. Its weakness is sensitivity: one wild value can swing it. Spearman replaces values by their ranks, so a single extreme point counts no more than any other point, and it picks up any steadily rising or falling relationship, not only straight ones.

Kendall tau-b looks at every pair of rows and asks whether the two columns agree on which is larger. Its values run lower than Spearman's for the same data, as the example shows (0.842 against 0.960 for visits and signups), so the numbers should not be compared across coefficients. Quote the coefficient name with the number.

  • Strength labels on the ranked list: below 0.1 negligible, 0.1 to 0.3 weak, 0.3 to 0.5 moderate, 0.5 to 0.7 strong, 0.7 or more very strong, and perfect at 0.9999 or above
  • The labels are rules of thumb on the absolute value; what counts as strong depends on the field
  • Confidence intervals are Pearson-only, and need more than 3 shared rows

Why the stars can disappear after correction

Testing 10 pairs at the 0.05 level gives each a 5 percent chance of a false alarm, so the chance that at least one is false climbs well above 5 percent. Holm and Bonferroni raise each p-value so that the whole set is held to the level you chose. In the example above, site visits against average price has an uncorrected p of 0.0268 and would carry a star; after Holm it is 0.0804 and loses it, while the visits-and-tickets pair keeps its star at 0.0209.

Holm is never less powerful than Bonferroni, so use Holm unless you need the simplest rule to quote. The adjustment changes the stars and the Significant column only; the matrix still shows the raw p-value when you switch the cells to p.

Frequently asked questions

Does my file leave my computer?

No. The file is read and every coefficient is computed in this browser tab. Nothing is uploaded.

Why does Kendall's number differ from Spearman's?

They measure agreement in different ways, and Kendall's scale simply runs lower for the same relationship. Compare values only within one coefficient.

What does the asterisk mean?

That the pair's p-value, after the adjustment you chose, is below your significance level. It never appears on the diagonal, and it is not shown when the cells display row counts.

How are tied values and blanks handled?

Ties get average ranks for Spearman and a tau-b correction for Kendall. Blanks and non-numeric cells are dropped pair by pair, or row by row if you choose listwise deletion.

Can I correlate a date column?

Not directly, because dates are not read as numbers here. Convert the date to a number such as the year, or the days since a start date, in a separate column first.