Calculator
Portfolio Correlation Matrix
Across the 5 sample series (90 observations each) the average absolute correlation is 0.18, worth 4.1 independent bets.
On the documented defaults, computed by this tool's engine · the same answer as JSON
Pearson correlation heatmap, condition number, eigenvalue spectrum, effective-N. Diagnostics for redundant strategies before allocating.
01Calculator
Runs in your browser. Nothing you enter is uploaded, and no account or API key is needed.
Upload a returns CSV
Wide format: date,strategy_1,strategy_2,.... Each column is one strategy or asset return series. Up to about 20 columns renders legibly. Nothing leaves your browser.
What this tool computes
Classical multi-strategy correlation diagnostics. The synthetic demo includes a deliberately-redundant "clone_of_momentum" column so you can see how the condition number and effective-N reflect redundancy. Load a CSV or the demo to begin.
02Receipt
What the answer above ran on, how it is computed, where the data comes from, and a link that reopens it.
Inputs
series5 values
The documented defaults. Change any input above and the tool recomputes.
Method
How the hub's tools are built and checked
Engine /engines/correlation-matrix-visualizer.js, sha256 0dfdbec998f5. The page, the API and MCP run the same file.
Source
Your inputs
Page updated .
Permalink
aifinhub.io/correlation-matrix-visualizer/
The link carries the inputs you set, so it reopens this result.
03For agents
Any agent can run this calculator by URL or MCP and get the same answer as JSON: the inputs that used defaults, the result and a line to cite. The call below follows the inputs you set above. In code, import the same engine; it runs where you import it, with no request or key.
GET https://aifinhub.io/api/run/correlation-matrix-visualizer curl -s 'https://aifinhub.io/api/run/correlation-matrix-visualizer'
# Markdown instead of JSON:
curl -s 'https://aifinhub.io/api/run/correlation-matrix-visualizer?format=md' # MCP over Streamable HTTP, no sign-in: run_calculator
curl -s https://aifinhub.io/mcp \
-H 'content-type: application/json' \
-H 'accept: application/json, text/event-stream' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"run_calculator","arguments":{"calculator":"correlation-matrix-visualizer","input":{}}}}' import { compute } from "https://aifinhub.io/engines/correlation-matrix-visualizer.js";
const result = compute(input); {
"calculator": "correlation-matrix-visualizer",
"title": "Portfolio Correlation Matrix",
"site": "AI Fin Hub",
"input": {},
"defaults_used": {
"series": [
{
"name": "SPY",
"values": [
-0.012843,
0.005562,
-0.001332,
"… 87 more of 90"
]
},
{
"name": "QQQ",
"values": [
-0.031916,
0.002634,
-0.011198,
"… 87 more of 90"
]
},
{
"name": "TLT",
"values": [
-0.00348,
-0.009532,
-0.009495,
"… 87 more of 90"
]
},
{
"name": "GLD",
"values": [
-0.003609,
-0.012319,
-0.021546,
"… 87 more of 90"
]
},
{
"name": "XLE",
"values": [
-0.002192,
-0.018241,
-0.012517,
"… 87 more of 90"
]
}
]
},
"result": {
"columns": [
"SPY",
"QQQ",
"TLT",
"GLD",
"XLE"
],
"n": 90,
"m": 5,
"corr": [
[
1,
0.5663862962205396,
-0.29293017417329725,
0.08550422192032223,
0.28416072565588996
],
[
0.5663862962205396,
1,
-0.12526358315178723,
0.062091639265233846,
0.15157979473589436
],
[
-0.29293017417329725,
-0.12526358315178723,
1,
0.1130378635971051,
-0.05772216298239507
],
[
0.08550422192032223,
0.062091639265233846,
0.1130378635971051,
1,
0.05683261231811275
],
[
0.28416072565588996,
0.15157979473589436,
-0.05772216298239507,
0.05683261231811275,
1
]
],
"avgAbsOffDiag": 0.1795509074020577,
"conditionNumber": 4.710301702940861,
"largestEigenvalue": 1.819669592692515,
"explainedByFirst": 0.363933918538503,
"effectiveN": 4.089615666850892,
"eigenvalues": [
1.819669592692515,
1.1086084086705634,
0.8833104374991178,
0.8020945675667951,
0.38631699357100846
]
},
"provenance": {
"run": "https://aifinhub.io/api/run/correlation-matrix-visualizer",
"page": "https://aifinhub.io/correlation-matrix-visualizer/",
"methodology": "https://aifinhub.io/correlation-matrix-visualizer/",
"contract": "https://aifinhub.io/contracts/correlation-matrix-visualizer.json",
"engine": "https://aifinhub.io/engines/correlation-matrix-visualizer.js",
"engine_sha256": "0dfdbec998f57cdb0516b466415f73264ce8e0361df1a768eb543bae70ba4584",
"build": "1a772910d31ef1740892ed0e3a065ed71e8c7406"
},
"disclaimer": "Planning estimates only — not financial, tax, or investment advice.",
"license": "https://creativecommons.org/licenses/by/4.0/",
"cite": "AI Fin Hub, Portfolio Correlation Matrix (engine 0dfdbec998f5), https://aifinhub.io/api/run/correlation-matrix-visualizer"
} How to use it
- Upload a wide-format returns CSV (an optional date column, then one column per asset or strategy, one row per period) or load the five-strategy demo. You need at least 30 rows.
- Read the average absolute correlation and the effective number of independent bets: 5 strategies with an effective N near 2 behave like 2.
- Read the heatmap: red cells are positive correlations, blue cells negative, deeper color is stronger. Hover a cell for three decimals.
- Check concentration and conditioning: a first-eigenvalue share above 60% means one factor dominates, and a condition number above 1,000 (or an eigenvalue near 0) means some series are near-duplicates.
- Drop or merge the redundant series (the demo's clone_of_momentum shows the pattern) and re-run to see effective N rise.
Questions people ask
How is correlation computed?
Sample Pearson correlation on the columns you upload: cov(x, y) / (σx · σy), with n − 1 in both the covariance and the standard deviations. There is no rank (Spearman) option. Upload periodic returns rather than price levels; trending prices produce high correlations that say little about diversification.
What does shrinkage do?
The tool does not shrink the matrix; it reports the raw sample correlation. Shrinkage estimators such as Ledoit-Wolf pull noisy estimates toward a simpler target and matter most when the number of assets approaches the number of observations. If you see a very large condition number or an eigenvalue near zero here, that is the situation where a shrunk matrix would be safer for portfolio optimization.
Why is the diagonal sometimes not exactly 1.0?
It always is: the matrix is unshrunk, so every series correlates exactly 1 with itself, and the heatmap shows a dot on the diagonal instead of the number. The eigenvalues therefore always sum to the number of series.
How many observations do I need?
The tool requires at least 30 rows. Beyond that, the matrix is only invertible when you have more observations than series; with close to as many series as rows, the smallest eigenvalue heads to zero and the condition number explodes. Several hundred daily rows give much more stable estimates than a few dozen.
Why are some clusters in the heatmap obvious and others not?
The heatmap keeps your column order; it does not reorder or cluster assets. Put related columns next to each other in the CSV to see blocks. For a numeric read on concentration, use the first-eigenvalue share and the effective number of independent bets: a share above 60% means one common factor dominates.
Related tools
- Calculators Efficient Frontier Calculator
Paste a multi-asset returns CSV. See the Markowitz mean-variance frontier, the minimum-variance portfolio, the max-Sharpe (tangency) portfolio, and the per-asset weights for each highlighted point. Closed-form solution, client-side.
- Calculators Risk-Adjusted Returns Calculator
Paste a returns CSV. Sharpe, Sortino, Calmar, Omega, alpha, beta, tracking error, information ratio, max drawdown, and tail moments — plus a benchmark-relative block when you include one.
- Calculators Kelly Criterion Calculator
Size positions with full, half, quarter, or eighth Kelly and stress-test the choice with a drawdown Monte Carlo simulator. Client-side. Private by default.
Articles
- 7 min read Markowitz 1952 Portfolio Selection: A Worked Example
Markowitz 1952 Portfolio Selection on a real stocks/bonds/gold tape: the E-V rule, why variance holds diversification, and a live efficient frontier.