Statistics & decisions

Multivariate Correlation Lab

Up to four jointly normal variables with a target correlation pattern on a 0.01 ladder, a mean and a standard deviation each: an exact whole-number test of whether the pattern can exist (possible, on the edge or impossible, from every principal minor) naming the variable where it breaks, the pivots, the Cholesky factor in explicit cells, and for each correlation the range that keeps the pattern possible with the others held; up to 250 seeded samples (one integer stream, Box-Muller, mixed by the factor) with the sample correlations, their errors and Fisher intervals, the target and sample 95% ellipses of every pair, shared axis ranges and the running correlations. Five scored challenges are included. For learning correlation, covariance and the Cholesky factor.

Last updated

Calculator overview

Inputs and outputs

This summary comes from the calculator's published input and output contract.

Inputs

Variable 2 mean (required)
About this input

The mean of variable 2, in its own unit, from -1000 to 1000. It moves the cloud and never changes a sample correlation.

Default 0 Range -1000 to 1000
Variable 3 mean (required)
About this input

The mean of variable 3, in its own unit, from -1000 to 1000. Used from 3 variables; checked even when it is not used.

Default 0 Range -1000 to 1000
Number of variables (required)
About this input

The number of variables, a whole number from 2 to 4 (the chips above the matrix). A challenge may fix it. Raising it never changes the samples of the earlier variables.

Default 2 Range 2 to 4
Variable 1 mean (required)
About this input

The mean of variable 1, in its own unit, from -1000 to 1000. It moves the cloud and never changes a sample correlation.

Default 0 Range -1000 to 1000
Variable 4 mean (required)
About this input

The mean of variable 4, in its own unit, from -1000 to 1000. Used with 4 variables; checked even when it is not used.

Default 0 Range -1000 to 1000
Variable 3 standard deviation (required)
About this input

The standard deviation of variable 3, in its own unit, from 0.1 to 1000. Used from 3 variables; checked even when it is not used.

Default 1 Range 0.1 to 1000
Variable 4 standard deviation (required)
About this input

The standard deviation of variable 4, in its own unit, from 0.1 to 1000. Used with 4 variables; checked even when it is not used.

Default 1 Range 0.1 to 1000
Variable 1 standard deviation (required)
About this input

The standard deviation of variable 1, in its own unit, from 0.1 to 1000. It stretches the cloud and never changes a sample correlation.

Default 1 Range 0.1 to 1000
Variable 2 standard deviation (required)
About this input

The standard deviation of variable 2, in its own unit, from 0.1 to 1000. It stretches the cloud and never changes a sample correlation.

Default 1 Range 0.1 to 1000
Samples (required)
About this input

The samples used, a multiple of 10 from 10 to 250. More samples extend the same draw and keep the earlier samples unchanged.

Default 100 Range 10 to 250
Correlation of variables 1 and 2 (required)
About this input

The target correlation of variables 1 and 2, from -0.99 to 0.99 in steps of 0.01 (dragged on the matrix). Checked even when it is not used.

Default 0.6 Range -0.99 to 0.99
Correlation of variables 1 and 3 (required)
About this input

The target correlation of variables 1 and 3, from -0.99 to 0.99 in steps of 0.01 (dragged on the matrix). Used from 3 variables; checked even when it is not used.

Default 0 Range -0.99 to 0.99
Challenge (required)
About this input

Selects a challenge: 0 for none, 1 to 5 for a predefined challenge, which fixes the settings except the inputs it leaves to you (the means, the standard deviations and the level are always yours).

Default 0 Range 0 to 5
Confidence level (required)
About this input

The level of the Fisher intervals of the sample correlations, from 0.8 to 0.99.

Default 0.95 Range 0.8 to 0.99
Correlation of variables 1 and 4 (required)
About this input

The target correlation of variables 1 and 4, from -0.99 to 0.99 in steps of 0.01 (dragged on the matrix). Used with 4 variables; checked even when it is not used.

Default 0 Range -0.99 to 0.99
Correlation of variables 3 and 4 (required)
About this input

The target correlation of variables 3 and 4, from -0.99 to 0.99 in steps of 0.01 (dragged on the matrix). Used with 4 variables; checked even when it is not used.

Default 0 Range -0.99 to 0.99
Seed (required)
About this input

The seed of the random stream, a whole number from 1 to 2147483646; the same seed always gives the same samples.

Default 2026 Range 1 to 2147483646
Correlation of variables 2 and 3 (required)
About this input

The target correlation of variables 2 and 3, from -0.99 to 0.99 in steps of 0.01 (dragged on the matrix). Used from 3 variables; checked even when it is not used.

Default 0 Range -0.99 to 0.99
Correlation of variables 2 and 4 (required)
About this input

The target correlation of variables 2 and 4, from -0.99 to 0.99 in steps of 0.01 (dragged on the matrix). Used with 4 variables; checked even when it is not used.

Default 0 Range -0.99 to 0.99

Outputs

The pairs: target and sample correlation, error, Fisher interval, the range that keeps the pattern possible, and the target and sample 95% ellipses
About this output

One row per pair 1-2, 1-3, 1-4, 2-3, 2-4, 3-4 (blank past the variable count): the target and sample correlation, the error, the Fisher interval and whether it covers the target (possible patterns only), the range the correlation could take with the others held (blank when no value works, and while challenge 2, 3 or 5 is not met), the target 95% ellipse (semi-axes and angle) and the sample 95% ellipse (possible patterns only).

No unit declared
Pattern
About this output

Whether the pattern can exist: Possible, On the edge (one variable would be an exact mix of the earlier ones) or Impossible, decided exactly from whole-number determinants. Blank when the inputs are not valid.

No unit declared
The pivots: the determinant of the first k variables and the share of variable k not explained by the variables before it
About this output

One row per variable used: the determinant of the first k variables and the pivot, the share of variable k's variance not explained by the variables before it (shown up to the failing variable).

No unit declared
Pairs
About this output

The number of pairs of the variables used, d(d - 1)/2. Blank when the inputs are not valid.

No unit declared
Model Status
About this output

NOT VALID with the reason when an input cannot be used; CHECK when the pattern is impossible or on the edge (no samples are drawn) or almost on the edge (a pivot below 0.0001), naming the variable; otherwise OK.

No unit declared
Model version
About this output

The model version.

No unit declared
Formula module versions
About this output

The formula modules the model is built from, with their versions.

No unit declared
Seed used
About this output

The seed used (a challenge may set its own). Blank when the inputs are not valid.

No unit declared
The target covariance matrix: each correlation scaled by both standard deviations
About this output

The target covariance matrix of the variables used: each correlation times both standard deviations, the variances on the diagonal.

No unit declared
Variables used
About this output

The number of variables used (a challenge sets its own). Blank when the inputs are not valid.

No unit declared
The variables: mean, standard deviation, sample mean and standard deviation, and the shared axis range of every panel
About this output

One row per variable used: the mean and standard deviation, the sample mean and standard deviation (possible patterns only), and the axis range every panel of the variable shares (at least 4 standard deviations each side of the mean).

No unit declared
Smallest pivot
About this output

The smallest pivot: the least share of a variable's variance not explained by the variables before it. Blank when the inputs are not valid or the pattern is not possible.

No unit declared
The running sample correlations every 10 samples
About this output

The sample correlations of every pair after 10, 20, ..., up to the sample count (25 rows; pair columns blank past the variable count). Blank when the pattern is not possible.

No unit declared
Samples used
About this output

The samples used (a challenge sets its own). Blank when the inputs are not valid.

No unit declared
The sample covariance matrix
About this output

The sample covariance matrix of the variables used. Blank when the pattern is not possible.

No unit declared
Largest correlation error
About this output

The largest difference between a sample correlation and its target. Blank when the inputs are not valid or the pattern is not possible.

No unit declared
Challenge result
About this output

No challenge selected, MET or NOT MET.

No unit declared
The Cholesky factor L of the target correlation matrix (lower triangle)
About this output

The Cholesky factor L of the target correlation matrix (lower triangle; L times its transpose is the matrix). Blank when the pattern is not possible.

No unit declared
Confidence level used
About this output

The confidence level used. Blank when the inputs are not valid.

No unit declared
Challenge score
About this output

The challenge score: 100 when met, else 0.

No unit declared
Challenge feedback
About this output

Feedback on the selected challenge: the met text or the not-met hint (blank with none).

No unit declared
Challenge goal
About this output

The goal of the selected challenge (blank with none).

No unit declared
Challenge: the value scored
About this output

The value the selected challenge scores: the largest covariance mismatch (1), the correlation of variables 2 and 3 (2), the determinant (3), the sample correlation of variables 1 and 2 (4) or the weakest correlation with variable 4 (5); blank with none or when the inputs are not valid.

No unit declared
The correlated samples x = mu + sigma w, one row a sample (blank past the sample count, past the variable count, and when the pattern is not possible)
About this output

The correlated samples, one row a sample (250 rows): each variable's value, mean plus standard deviation times the mixed normal. Blank past the sample count, past the variable count, and when the pattern is not possible.

No unit declared
Before mixing: the independent standard normal draws z1 and z2 of each sample
About this output

Before mixing: the two independent standard normal draws z1 and z2 of each sample (250 rows), the round cloud the factor stretches into variables 1 and 2. Blank past the sample count and when the pattern is not possible.

No unit declared
Critical value of the intervals
About this output

The normal critical value of the intervals at the chosen level (1.96 at 95%). Blank when the inputs are not valid.

No unit declared
Matrix error
About this output

The size of the whole difference between the sample and the target correlation matrices (the square root of the sum of the squared differences of every off-diagonal cell). Blank when the inputs are not valid or the pattern is not possible.

No unit declared
Breaks at variable
About this output

The variable where the pattern breaks: the first variable whose leading determinant is zero or negative. Blank for a possible pattern and when the inputs are not valid.

No unit declared
Determinant of the correlation matrix
About this output

The determinant of the correlation matrix of the variables used (one exact division of two whole numbers); zero on the edge and negative for an impossible pattern. Blank when the inputs are not valid.

No unit declared
Intervals covering their target
About this output

How many of the pairs' Fisher intervals contain their target correlation. Blank when the inputs are not valid or the pattern is not possible.

No unit declared
Factor check: largest error of L times L transposed
About this output

The largest difference between L times its transpose and the target correlation matrix, a check of the factor (about 1E-16). Blank when the inputs are not valid or the pattern is not possible.

No unit declared
This page is provided by LogicCommons for informational purposes only. Results are analysis outputs computed from the inputs you supply and are not professional advice. Verify all inputs and results independently.

LogicCommons is in beta. If a result, label, or reference looks wrong, tell us here; we read every message.

Methodology

Purpose and model boundary

This lab builds a pattern of correlations between 2, 3 or 4 variables, gives each variable a mean and a standard deviation, and draws up to 250 seeded samples from the multivariate normal distribution with that pattern. It decides exactly whether the pattern can exist at all (Possible, On the edge or Impossible) and, if not, the variable where it breaks. For a possible pattern it builds the Cholesky factor that mixes independent standard normal draws into correlated ones, and compares the sample correlations with their targets: the error of each pair, the largest error, the error of the whole matrix and a Fisher confidence interval for each pair. For every pair it returns the target and sample 95% ellipses, and for each correlation the range of values that keeps the pattern possible with the others held. Five scored challenges use the same model.

It is a lab for learning what correlation and covariance are, why some patterns of correlation cannot exist together, how a Cholesky factor turns independent draws into correlated ones, and how far a sample correlation from a few hundred draws can sit from its target. It is not a statistical analysis tool: it takes no data, fits nothing, and a possible pattern is not evidence that real data follow it. Variables that are not normal, more than four variables, principal components, missing values, measurement error and dependence over time are not modelled.

The model is the calculation authority. The page sends the values you set to the model and draws only what it returns: the sample points of every pair, the independent draws before mixing, the target and sample ellipses, the shared axis ranges and the running correlations. The page computes no correlation, determinant, factor, range or sample itself.

Inputs and units

The variables are unitless ("Variable 1" to "Variable 4"). A mean and a standard deviation are in the variable's own unit, and a covariance in the product of two units. Correlations are pure numbers. Every input is required and is checked on its entered value, even an entry for a variable past the number of variables.

Input Meaning and unit
Number of variables d, a whole number from 2 to 4 (default 2). Raising it never changes the samples of the earlier variables.
Correlation of variables 1 and 2 ρ₁₂, the target correlation, from -0.99 to 0.99 in steps of 0.01 (default 0.6).
Correlations 1-3, 1-4, 2-3, 2-4 and 3-4 ρ₁₃, ρ₁₄, ρ₂₃, ρ₂₄ and ρ₃₄, each from -0.99 to 0.99 in steps of 0.01 (default 0). A correlation involving a variable past d is checked but not used.
Variable 1 to 4 mean μᵢ, from -1,000 to 1,000 in the variable's unit (default 0). It moves the cloud and never changes a sample correlation.
Variable 1 to 4 standard deviation σᵢ, from 0.1 to 1,000 in the variable's unit (default 1). It stretches the cloud and never changes a sample correlation.
Seed The starting number of the random sequence, a whole number from 1 to 2,147,483,646 (default 2026). The same seed always gives the same samples.
Samples N, a multiple of 10 from 10 to 250 (default 100). More samples extend the same draw and leave the earlier samples unchanged.
Confidence level The level of the Fisher intervals, from 0.8 to 0.99 (default 0.95, which gives 95% intervals).
Challenge 0 for free exploration, or 1 to 5 to load a challenge (default 0).

Where each input is set:

  • On the canvas only: the number of variables (the chips above the matrix) and the six target correlations, set on the correlation matrix by dragging an entry or by tapping it; the drag snaps to the 0.01 steps.
  • In the input panel: the means and standard deviations (a Variables table with one row a variable), the seed, the number of samples, the confidence level and the challenge.

Governing relationships

The 0.01 ladder. A correlation is accepted when it lies from -0.99 to 0.99 and 100 times it is a whole number to within 1×10⁻⁹. Its ladder integer is a = ROUND(100·ρ), and the model uses ρ = a/100. The matrix A = 100·R therefore has 100 on its diagonal and whole numbers aᵢⱼ from -99 to 99 off it. With fewer than four variables, every correlation involving a variable past d is taken as 0.

Whether the pattern can exist. A set of correlations can belong to real variables exactly when the correlation matrix R is positive definite. By Sylvester's criterion this holds when every leading principal minor is positive. The model computes the minors of A as exact whole numbers, so the decision has no rounding and no tie band:

  • for each pair, mᵢⱼ = 10000 - aᵢⱼ²;
  • for each triple, Mᵢⱼₖ = 1000000 - 100·(aᵢⱼ² + aᵢₖ² + aⱼₖ²) + 2·aᵢⱼ·aᵢₖ·aⱼₖ;
  • for all four, the full 4 by 4 determinant D₄, expanded term by term.

The leading minors are D₁ = 100, D₂ = m₁₂, D₃ = M₁₂₃ and D₄. The class is:

  • Possible when D₁ to D_d are all positive;
  • otherwise the failing variable k is the first with D_k zero or negative, and the class is On the edge when every principal minor (the six mᵢⱼ, the four Mᵢⱼₖ and D₄) is zero or positive: variable k would have to be an exact linear mix of the variables before it;
  • Impossible otherwise.

Determinant and pivots. The determinant of the d by d correlation matrix is det R = D_d / 100^d, one exact division. The pivot of variable k is p_k = D_k / (100·D_(k-1)), with p₁ = 1. It is the share of variable k's variance that the variables before it do not explain; the product of the pivots is det R. A possible pattern is almost on the edge when some pivot is below 0.0001, tested exactly as 100·D_k < D_(k-1).

The Cholesky factor. For a possible pattern, R = L·Lᵀ with L lower triangular. The model takes each diagonal entry from the exact minors, L_kk = √p_k, and the others by forward substitution:

  • L₂₁ = ρ₁₂, L₃₁ = ρ₁₃, L₄₁ = ρ₁₄;
  • L₃₂ = (ρ₂₃ - L₃₁·L₂₁) / L₂₂, L₄₂ = (ρ₂₄ - L₄₁·L₂₁) / L₂₂;
  • L₄₃ = (ρ₃₄ - L₄₁·L₃₁ - L₄₂·L₃₂) / L₃₃.

The factor check is the largest difference between L·Lᵀ and R over every entry.

The range of each correlation. With every other entry held, the determinant of A as a function of one entry x = aᵢⱼ is a quadratic q(x) = αx² + βx + γ with whole-number coefficients, where (k, l) are the other two variables, α = -m_kl, β = 200·(aᵢₖ·aⱼₖ + aᵢₗ·aⱼₗ) - 2·a_kl·(aᵢₖ·aⱼₗ + aᵢₗ·aⱼₖ), and γ is the remainder of the determinant. The entry can repair or keep the pattern only when the matrix without variable i and the matrix without variable j are both positive definite; then the possible values are the ladder values strictly between the two roots of q, and each end is confirmed by evaluating q exactly at whole numbers. When no value works, both ends are blank.

The generator. The model implements Park and Miller's minimal standard generator (MINSTD) with the multiplier 48271. Starting from s₀ = the seed, each state is

sₜ = MOD(48271 · sₜ₋₁, 2³¹ - 1), and each draw is uₜ = sₜ / (2³¹ - 1),

which lies strictly between 0 and 1. The first two states are discarded, so the first draw used is s₃. Every product stays below 2⁴⁷, so the integer sequence is exact. Sample k always uses the four draws of states 4(k - 1) + 3 to 4k + 2, called u₁ to u₄ below, whatever d and N are.

Box-Muller. The four draws of a sample give four independent standard normal values:

z₁ = √(-2 ln u₁) · cos(2π u₂), z₂ = √(-2 ln u₁) · sin(2π u₂), z₃ = √(-2 ln u₃) · cos(2π u₄), z₄ = √(-2 ln u₃) · sin(2π u₄).

Mixing. The factor turns them into correlated standard normals, w = L·z:

w₁ = L₁₁z₁, w₂ = L₂₁z₁ + L₂₂z₂, w₃ = L₃₁z₁ + L₃₂z₂ + L₃₃z₃, w₄ = L₄₁z₁ + L₄₂z₂ + L₄₃z₃ + L₄₄z₄,

and each sample value is xᵢ = μᵢ + σᵢ·wᵢ. Because L is lower triangular and each sample's draws are fixed, more samples never change the earlier ones and more variables never change the earlier variables.

Sample statistics. From running sums of w over the first n samples, the model forms the mean w̄ᵢ, the covariance cᵢⱼ = (Σwᵢwⱼ - (Σwᵢ)(Σwⱼ)/n) / (n - 1) and the sample correlation rᵢⱼ = cᵢⱼ / √(cᵢᵢ·cⱼⱼ). In data units the sample mean is μᵢ + σᵢ·w̄ᵢ, the sample standard deviation σᵢ·√cᵢᵢ and the sample covariance σᵢσⱼ·cᵢⱼ. Computing from w means the means and standard deviations change no sample correlation.

Errors. For each pair used, eᵢⱼ = rᵢⱼ - ρᵢⱼ. The largest error is the largest |eᵢⱼ|, and the matrix error is √(2·Σ eᵢⱼ²), the size of the whole difference between the sample and target correlation matrices.

Fisher intervals. With z the normal critical value for the level (1.96 at 95%), y = ½ ln((1 + r)/(1 - r)) and h = z / √(N - 3), the interval runs from (e^(2(y - h)) - 1)/(e^(2(y - h)) + 1) to (e^(2(y + h)) - 1)/(e^(2(y + h)) + 1). It covers the target when ρ lies inside it, to within 1×10⁻⁹.

Ellipses. For a pair with 2 by 2 covariance [[a, b], [b, c]] (target: a = σᵢ², c = σⱼ², b = σᵢσⱼρᵢⱼ; sample: the sample covariances), the eigenvalues are λ = (a + c)/2 ± √(((a - c)/2)² + b²). The 95% ellipse has semi-axes √(5.991·λ), where 5.991 = 2 ln 20 is the 95% point of the chi-square distribution with 2 degrees of freedom, and its major axis makes the angle ½·atan2(2b, a - c) with the axis of variable i, in degrees from -90 to 90 (0 for a circle). The target ellipse is centred on the means and the sample ellipse on the sample means.

Axes. Every panel of a variable shares one axis range: at least 4 standard deviations each side of the mean, widened to hold every sample drawn.

Calculation sequence

The model works through the relationships above in this order:

  1. It checks the entered values in the order of the status list under Errors and warnings.
  2. It fixes the values used: your inputs, or in a challenge the challenge's own values for the inputs it fixes.
  3. It reads each correlation's ladder integer and computes every principal minor exactly, then the class, the failing variable, the determinant and the pivots.
  4. For a possible pattern it builds the Cholesky factor and checks it.
  5. It computes the range of each correlation with the others held.
  6. It generates the seeded stream, four draws a sample after the two discarded states, turns them into normal values by Box-Muller, and mixes them by the factor into the samples.
  7. It computes the sample means, standard deviations, covariances and correlations, the errors and the Fisher intervals, and the running correlations every 10 samples.
  8. It computes the target and sample ellipses of every pair and the shared axis ranges.
  9. It sets the status and, in a challenge, scores the challenge.

Outputs and interpretation

  • Can the pattern exist?: Possible, On the edge or Impossible, decided from whole-number determinants.
  • Failing variable: the first variable whose leading determinant is zero or negative; blank for a possible pattern.
  • Determinant of the correlation matrix: det R, from 0 to 1 for a possible pattern, 0 on the edge and negative for an impossible one. Near 0 means some variable is nearly a mix of the others.
  • Smallest pivot: the least share of a variable's variance not explained by the variables before it.
  • Factor check: the largest difference between L·Lᵀ and the target matrix, about 1×10⁻¹⁶.
  • Pairs, largest error, matrix error, intervals covering their target: the number of pairs d(d - 1)/2, the largest gap between a sample correlation and its target, the size of the whole matrix difference, and how many Fisher intervals contain their target. At 95%, about one interval in twenty misses by chance.
  • Critical value: the normal critical value of the intervals (1.96 at 95%).
  • Settings used: the number of variables, seed, samples and confidence level of the run (a challenge may set its own), the model version and its formula module versions.
  • Pair table: one row per pair: the target and sample correlation, the error, the interval ends and whether it covers the target, the range the correlation could take with the others held ("Possible from" and "Possible to"), and the semi-axes and angle of the target and sample 95% ellipses.
  • Variable table: each variable's mean and standard deviation, its sample mean and standard deviation, and the axis range every panel of that variable shares.
  • Target and sample covariance: each correlation times both standard deviations, with the variances on the diagonal, and the same from the samples.
  • Cholesky factor and pivot table: the factor L (lower triangle), and for each variable the leading determinant and the pivot, shown up to the failing variable.
  • Samples and independent draws: the correlated values of every sample, and before mixing the two independent draws z₁ and z₂, the round cloud the factor stretches into variables 1 and 2.
  • Running correlations: the sample correlation of every pair after 10, 20, and so on up to N samples.

Reading the canvas: the matrix shows the target correlations you set. Each scatter panel draws one pair's samples with its target ellipse (the region holding 95% of the distribution) and its sample ellipse; when the two differ, the sample has strayed from the pattern by chance. The "before mixing" panel shows the independent draws, so you can see the factor tilt and squeeze a round cloud. The running chart shows each sample correlation settling as the samples grow, roughly as one over the square root of the count.

What to take from the lab: correlations constrain each other, so two strong links force the third; a covariance is a correlation scaled by two standard deviations; and one seed's sample correlation, especially from a few dozen samples, can sit well away from the truth.

Challenges

Choosing a challenge number from 1 to 5 loads that challenge. It fixes the number of variables, the correlations, the seed and the sample count, except the inputs it leaves open; the means, the standard deviations and the confidence level are always yours. The result reads MET (score 100) or NOT MET (score 0), with the goal, the value the challenge is scored on and a short explanation or hint. Every challenge needs valid inputs and a possible pattern.

  1. Match a covariance matrix. Set the standard deviations and correlations of variables 1 to 3 so the covariance matrix has variances 4, 25 and 1, covariance 5 between 1 and 2, -0.6 between 1 and 3, and 1 between 2 and 3. Open: the correlations 1-2, 1-3 and 2-3. Scored on the largest difference between the target covariance and the goal over the six distinct entries; met at 0.005 or less.
  2. The smallest possible link. Variable 1 correlates 0.8 with variables 2 and 3; find the smallest correlation between 2 and 3 that keeps the pattern possible. Open: the correlation 2-3. Scored on that correlation; met when it equals the low end of its possible range, so one step lower is not possible.
  3. Not transitive. Make variables 1 and 2 correlate at least 0.7, and 2 and 3 at least 0.7, while 1 and 3 have zero or negative correlation, in a possible pattern. Open: the correlations 1-2, 1-3 and 2-3. Scored on the determinant; met when the pattern is possible and the three conditions hold.
  4. Correlation by chance. Variables 1 and 2 are truly uncorrelated; with 30 samples, find a seed whose sample correlation is at least 0.3 in size. Open: the seed. Scored on the sample correlation of variables 1 and 2; met when its size is 0.3 or more. The exact chance of this at 30 samples is about 0.107.
  5. One variable, three causes. Variables 1, 2 and 3 are uncorrelated with each other; make the weakest of their three correlations with variable 4 as strong as possible while the pattern stays possible. Open: the correlations 1-4, 2-4 and 3-4. Scored on the weakest of the three; met when it is 0.57 or more.

Challenges 2, 3 and 5 hold back the answer: while one of them is selected and not met, the "Possible from" and "Possible to" columns of the pair table are blank, and the impossible-pattern status ends with "(hidden while challenges 2, 3 and 5 are unsolved)". Once the challenge is met, the ranges show again. Challenges 1 to 3 and 5 do not depend on the seed; challenge 4 is about the sampling itself.

Validation and status logic

The status reads the first match in the list under Errors and warnings. The NOT VALID checks apply to the entered values, including entries for variables past the number of variables and inside a challenge. The CHECK items apply to the values used, so a challenge's own correlations decide them; several challenges start from an impossible pattern on purpose. A CHECK for an almost-on-the-edge pattern stops nothing: every sample and statistic is still shown.

Assumptions and limitations

  • Up to 4 jointly normal variables with the given means, standard deviations and correlations; correlations on the 0.01 ladder from -0.99 to 0.99; 10 to 250 samples in steps of 10; one fixed seeded stream.
  • The class, the failing variable, the edge and near-edge tests and the range ends are exact whole-number results with no rounding. The factor, samples, statistics, intervals and ellipses are floating point.
  • The generator is deterministic and reproducible: the same seed gives the same samples. It is a small linear congruential generator; consecutive draws fall on a lattice, seeds that differ by a small factor give related streams, and Box-Muller from it shows a lattice effect in the far tails, where no normal value exceeds about 6.56 in size. It is fine for teaching and wrong for cryptography or serious simulation.
  • The Fisher interval is an approximation for normal samples. About one 95% interval in twenty misses its target by design, and a sample correlation from a few dozen samples can be far from its target.
  • A value within 1×10⁻⁹ of the interval coverage band or of a challenge threshold may go either way.
  • Variables that are not normal, more than four variables, principal components, missing values, measurement error and dependence over time are not modelled.

Restrictions and non-computing states

Every input is required and is checked on its entered value, used or not.

Under NOT VALID every result and table is blank, except the model and module versions, the challenge goal and hint, the challenge result (NOT MET when a challenge is selected, otherwise No challenge selected) and a score of 0. A challenge number that is not a whole number from 0 to 5 counts as no challenge.

When the pattern is Impossible or On the edge, no samples are drawn. The class, the failing variable, the determinant, the pivots up to the failing variable, the target covariance, the target ellipses, the axis ranges (4 standard deviations each side of the mean) and the possible range of each correlation are still shown. The samples, independent draws, sample statistics, errors, intervals, sample ellipses, sample covariance, Cholesky factor, smallest pivot, factor check and running correlations are blank.

Outputs for variables and pairs past the number of variables are blank.

Errors and warnings

The status messages, first match wins:

  • NOT VALID: the number of variables must be a whole number from 2 to 4
  • NOT VALID: the correlation of variables i and j must be from -0.99 to 0.99 in steps of 0.01: the first failing pair in the order 1-2, 1-3, 1-4, 2-3, 2-4, 3-4; all six are checked whatever the number of variables.
  • NOT VALID: variable k needs a mean from -1000 to 1000 and a standard deviation from 0.1 to 1000: the lowest such variable; all four are checked.
  • NOT VALID: the seed must be a whole number from 1 to 2147483646
  • NOT VALID: the number of samples must be a multiple of 10 from 10 to 250
  • NOT VALID: the confidence level must be from 0.8 to 0.99
  • NOT VALID: the challenge number must be a whole number from 0 to 5
  • CHECK: no variables can have all these correlations at once; the pattern breaks at variable k, so no samples are drawn. Change a correlation: Advanced shows the range each one could take with the others held: the pattern is Impossible. While challenge 2, 3 or 5 is selected and not met, the message ends with "(hidden while challenges 2, 3 and 5 are unsolved)".
  • CHECK: this pattern is on the edge: variable k would have to be an exact mix of the variables before it, so no samples are drawn. Move a correlation by 0.01: the pattern is On the edge.
  • CHECK: this pattern is almost on the edge: variable k is nearly an exact mix of the variables before it (its pivot is below 0.0001), so its own independent part is tiny: the pattern is possible, but a pivot is below 0.0001; every result is still shown.
  • OK: the pattern is possible with nothing to flag.

References

This laboratory is an educational model of correlated normal variables. It decides whether a pattern of correlations can exist by Sylvester's criterion, from exact leading principal minors of the correlation matrix, and factors a possible pattern by the Cholesky decomposition. Its random numbers come from the Park-Miller minimal standard (MINSTD) generator with the multiplier 48271, turned into independent normal values by the Box-Muller transform and mixed into correlated ones by the factor. Sample covariances and correlations use the divisor n - 1, each sample correlation gets a Fisher z confidence interval, and each pair gets a 95% ellipse whose axes follow the eigenvectors of its covariance matrix.

Sources and further reading

  • The sample mean, variance, covariance and correlation, and the determinant of a covariance matrix: The Pennsylvania State University, STAT 505 Applied Multivariate Statistical Analysis, Lesson 1, Measures of Central Tendency, Dispersion and Association, sections 1.2 and 1.3. Penn State STAT 505
  • The multivariate normal distribution and its prediction ellipses, with half-lengths from the eigenvalues and axes along the eigenvectors: The Pennsylvania State University, STAT 505 Applied Multivariate Statistical Analysis, Lesson 4, Multivariate Normal Distribution, sections 4.5, 4.6 and 4.8. Penn State STAT 505
  • The confidence interval for a correlation by Fisher's transformation: The Pennsylvania State University, STAT 505 Applied Multivariate Statistical Analysis, Lesson 5, Sample Mean Vector and Sample Correlation and Related Inference Problems, section 5.3, Inferences for Correlations. Penn State STAT 505
  • Positive definite matrices, the test by leading principal minors and the Cholesky factorization: R. A. Horn and C. R. Johnson, Matrix Analysis, 2nd edition, Cambridge University Press, 2013, chapter 7, Positive Definite and Semidefinite Matrices.
  • The minimal standard generator: S. K. Park and K. W. Miller, "Random number generators: good ones are hard to find", Communications of the ACM 31(10), 1988, pages 1192-1201.
  • The transform of two uniform draws into two independent normal values: G. E. P. Box and M. E. Muller, "A note on the generation of random normal deviates", The Annals of Mathematical Statistics 29(2), 1958, pages 610-611.

No table or text from any of these publications is reproduced, and none of their authors or publishers has reviewed or endorses this laboratory.

This laboratory is for learning. Its results hold only within its stated ranges; a sample correlation from at most 250 seeded draws carries sampling error, and a possible pattern is not evidence that real data follow it.

Links were current at build time. If one moves, search the document's title rather than reporting a broken link as a defect.

Results are informational and not professional advice. See our Terms of Use. Powered by SpreadsheetWeb · About · Privacy · Terms