Correlation Matrix Generator
Not every symmetric grid of numbers between minus one and one is a possible correlation matrix. If A and B correlate at 0.9 and B and C at 0.9, then A and C cannot possibly be at minus 0.9 — the constraint is that the matrix must be positive semi-definite, and hand-picked values routinely violate it. These are built from a factor model where the property holds by construction, then verified.
What this generator does
Gives each variable a random loading on a small number of shared factors, then computes the correlations that structure implies. Because the matrix comes from real loadings it is automatically a possible correlation matrix.
How to use this tool
- Choose how many variables and how many shared factors drive them.
- Read the matrix and find the strongest pair.
- Try more factors to see the structure get richer.
- Copy the matrix to use as a covariance structure.
Understanding the controls
- How many variables
- Between 3 and 8 named variables, which sets the size of the square matrix.
- Shared factors
- How many underlying influences the variables draw on. One factor makes everything correlate through a single driver; more gives a richer and more realistic structure.
- Seed
- Reproduces the same loadings and therefore the same matrix.
Common use cases
- Valid correlation structures for a simulation or a test
- Showing why hand-picked correlations are often impossible
- Teaching what positive semi-definite means in practice
- Factor-model examples with visible shared drivers
- Reproducing the same matrix from a seed
How this generator works
Correlations are the normalised dot products of the loading vectors, which is exactly how a factor model produces them. The check confirms the diagonal is all ones, the matrix is symmetric, every entry lies between minus one and one, and — the property that matters — that a Cholesky decomposition succeeds, which is what positive semi-definite means.
Randomness and fairness
The factor loadings are random; the resulting matrix is a deterministic consequence and its validity is proved. Seeded matrices reproduce and are therefore explicitly not cryptographically secure, and unseeded ones use the browser's cryptographically secure generator.
For how randomness is produced across the whole site, see how Generate Random works.
Limitations and good to know
- Correlations come from a factor model, so the structure is always low-rank plus noise rather than arbitrary.
- No underlying data is generated, only the matrix.
- Variable names come from a fixed list.
- Entries are rounded to two decimal places for display, and rounding can in principle disturb the property — which is why it is checked after rounding.
- The matrix is not kept after the visit; seed it to reuse the same structure.
Privacy and your data
Loadings and correlations are computed in your browser. Nothing is transmitted or stored.
Related generators
- Positive Definite Matrix GeneratorMatrices built to be positive definite and proved so twice — by Cholesky decomposition and by Sylvester's criterion.
- Missing Data GeneratorDatasets with gaps under all three mechanisms — completely at random, dependent on a column you can see, and dependent on the missing value itself.
- Symmetric Matrix GeneratorMatrices that equal their own transpose, with the trace, determinant and the count of entries that are actually free.
- Multivariate Normal GeneratorCorrelated multi-column samples built by Cholesky factorisation, with the factor proved to reproduce the requested covariance exactly.
- Clustered Dataset GeneratorPoints grouped around known centres with the true group recorded, so you can check what a clustering algorithm actually recovered.