Bell Statistics

Correlation test calculator

Work out how many observations you need to detect a correlation of a given size, then get r or rho, the p-value and a Fisher-z interval. That interval is the reason to use this rather than a spreadsheet formula: an r from forty rows is compatible with a far wider range of truths than its readers assume.

Allon Korem

Written by Allon Korem

Chief Executive Officer

Last updated

Calculator

The weakest relationship still worth knowing about.

Required number of observations
ObservationsPoints, each with both coordinates.85
Achieved powerAt the whole-number sample above.80.0%
Fisher's zartanh ρ — the effect size on the scale the maths uses.0.3095
Before rounding84.93

Collect 85 paired observations and a true correlation of 0.30 will come out significant 80.0% of the time. That is a test of whether the correlation differs from zero, and it is a much weaker goal than estimating one: a study sized exactly here will typically return an interval several tenths wide, spanning "barely there" to "strong". If you need the number rather than its sign, plan on considerably more. And rows are not always observations — two trending, seasonal weekly series contain far less independent information than their length suggests.

  • This sizes a test of whether the correlation differs from zero. Estimating a correlation to a given precision is a different and usually larger question — a study powered to detect ρ = 0.3 still returns an interval roughly 0.3 wide.
Required observations against correlation to detectDetecting 0.05 takes 3,138 and 0.90 takes 7. At the 0.30 currently entered it is 85 — the requirement falls roughly as the square of the effect.101001,0000.200.400.600.80Correlation to detectRequired observations (log scale)0.30 → 85

Drag the dashed line — or focus it and use the arrow keys — to change correlation to detect.

Show these numbers as a table
Required observations against correlation to detect
Correlation to detectRequired observations
0.053,138
0.14415
0.22154
0.3179
0.4048
0.4931
0.5722
0.6616
0.7512
0.839

When to use it

Use a correlation test when you have two measurements on the same units and want to know whether they move together, and how strongly. Weekly ad spend and weekly revenue, session count and day-30 retention, page speed and bounce rate. Both variables are observed rather than assigned, which separates this from every other calculator here: nothing was randomised, so the analysis describes co-movement and stops. Pearson's r measures a straight-line relationship; Spearman's rho does the same on the ranks, which suits ordinal data and cases where a couple of extreme points would otherwise write the answer.

"Correlation is not causation" is true and almost useless, because it says nothing about how to read the number in front of you. Three failure modes are more actionable. Attenuation: measurement error in either variable pulls r toward zero, capping it at roughly the square root of the product of the two measures' reliabilities, so 0.45 between two noisy proxies can reflect something far stronger. Restriction of range: r shrinks when the sample is filtered on either variable, so correlating spend against return among campaigns that cleared a spend threshold understates the relationship. And non-comparability: r is a covariance rescaled by the sample's own standard deviations, so an identical slope gives different r values in two markets whose spend varies differently.

Use something else when the question is causal or the data is a different shape. To know what happens to revenue when you change spend — not whether the two drifted together — you need a design that breaks the confounding: a geo test, a randomised experiment, or an explicit causal model. Two categorical variables want a chi-square test; comparing groups rather than tracking co-movement wants the t-test or ANOVA; time-to-event data wants the log-rank test.

Assumptions

Computing r requires nothing — it describes whatever numbers you feed it. The p-value and the interval carry the assumptions, and one of them fails constantly in marketing data:

  • The pairs are independent observations. Two weekly time series are not: both trend, both carry seasonality, and both are autocorrelated, so 104 weeks contain far fewer than 104 independent observations and the interval comes out much too narrow. Unrelated trending series routinely correlate above 0.9. Difference or deseasonalise first — one reason marketing mix modelling is a discipline, not a spreadsheet.
  • Linearity, for Pearson. An r near zero means no linear component, not no relationship: a clean inverted-U — the shape diminishing returns actually takes — can produce r = 0.02. Plot the scatter first. Spearman relaxes this to monotonicity but still cannot see a curve that turns around.
  • Approximate bivariate normality, for the inference only. Mild departures matter little at reasonable n; heavy tails matter a great deal, because they make the Fisher-z interval too narrow. It constrains neither r itself nor Spearman's rho.
  • No single point is doing the work. One leverage point can create an r of 0.6 in a cloud with no relationship, or destroy a real one. Recompute without the extreme points and report both if they disagree — outliers bite harder here than in any test of means.
  • That testing r against exactly zero is worth doing. Usually it is not: no relationship whatsoever is rarely plausible for two business metrics, and with a few thousand rows almost any r clears significance.

How the calculation works

The p-value comes from the usual t transformation on n − 2 degrees of freedom; the interval does not, and the reason is worth knowing. The sampling distribution of r is skewed whenever the true correlation is not zero — r is bounded at ±1, so an estimate of 0.85 has more room to fall than to rise, and a symmetric interval would run past 1. Fisher's z maps r onto an unbounded scale where that distribution is near normal with a variance depending only on n; the interval is built there and mapped back. Spearman's rho is Pearson's r on the tie-corrected ranks, so the same machinery applies.

Pearson correlation
r = Σ(xᵢ − x̄)(yᵢ − ȳ) / √( Σ(xᵢ − x̄)² · Σ(yᵢ − ȳ)² )

A covariance divided by the two standard deviations. That denominator is why r is not comparable across samples with different spread.

Test statistic
t = r·√(n − 2) / √(1 − r²), df = n − 2

Tests the null that the population correlation is exactly zero, and only that. Testing r against any other value, or comparing two correlations, goes through Fisher's z.

Fisher's z transformation
z = ½·ln((1 + r)/(1 − r)), SE(z) = 1/√(n − 3)

The interval is z ± z₁₋α/₂·SE, mapped back with r = tanh(z). The standard error depends on n alone — all the asymmetry comes from the back-transformation.

Sample size
n = ( (z₁₋α/₂ + z₁₋β) / atanh(ρ) )² + 3

At 80% power and α = 0.05 two-sided: about 782 observations for ρ = 0.10, 194 for 0.20, 85 for 0.30, 46 for 0.40, 29 for 0.50.

Spearman's rho
ρ_s = Pearson r computed on the ranks of x and y

The familiar 1 − 6Σd²/(n(n² − 1)) shortcut is correct only with no ties, so the calculator does not use it. Distrust any tool that shows you that formula.

Attenuation ceiling
r_observed ≈ r_true · √(reliability_x · reliability_y)

Spearman's own 1904 correction. Two measures with reliability 0.8 each cap the observable correlation at 0.8, however many rows you collect.

Worked example

Before committing to a full media model you want to know whether weekly paid-search impressions and weekly branded organic sessions move together at all. Anything below r = 0.30 would not be worth carrying into the model, so that is what the study has to detect, at 80% power and 5% two-sided.

Coefficient
Pearson r
Significance level (α)
0.05, two-sided
Power (1 − β)
0.80
Correlation to detect (ρ)
0.30
Tails
Two

85 weekly observations, a little over eighteen months of history. With the 40 weeks most teams have, an observed r of 0.30 comes with a 95% interval of roughly −0.01 to 0.56.

Two things fall out, and the second matters more. First, the interval at n = 40 spans everything from no relationship to a strong one, so "we saw a correlation of 0.3" from forty weeks is not a finding — it is a prompt to collect more data. Second, 85 weeks of weekly data does not contain 85 independent observations: both series trend and both are seasonal, so the effective sample is smaller than the row count and the real interval is wider than the one above. That gap between rows and information is the commonest way marketing analyses overstate their own precision.

Interpreting the output

Read the interval before anything else. An r of 0.42 from 30 observations carries a 95% interval of roughly 0.07 to 0.68 — technically significant, and consistent both with a relationship too weak to matter and with one strong enough to build a plan around. Small-sample correlations are among the least stable statistics in routine use, and the interval is the only thing on the output that says so — the argument for intervals over asterisks we make about reporting results.

Square r if you like, but be careful what you claim. r = 0.42 gives r² = 0.18, and "18% of the variance" is a statement about variance in this sample, biased upward — not 18% of revenue, or of anything a stakeholder will hear. Note too how modest the benchmarks are: an r of 0.30, widely called moderate, is under 10% of shared variance.

Before concluding a relationship is weak, work through the three biases. Is either variable measured with noise — survey responses, modelled attribution, a proxy for the thing you care about? Then r is attenuated and its ceiling may be well below 1. Has the sample been filtered on either variable, to active accounts or campaigns above a spend floor? Then the range is restricted and r is biased toward zero. And a difference in r across markets can reflect spread rather than relationship; compare regression slopes instead.

Finally, resist the pull from association to action. A strong correlation between spend and revenue is what you would see if both simply rose with demand, and what you would see if spend worked; the data cannot separate them and no sample size will. The only reliable route is a design where something was assigned rather than observed: a geo test turning spend up in some markets and not others, or a causal model stating its assumptions out loud — the longer version being why test lift differs from the real world.

Frequently asked questions

Should I use Pearson or Spearman?
Pearson when both variables are continuous, the relationship looks linear on a scatter plot, and there are no extreme points doing the heavy lifting. Spearman when either variable is ordinal, when the relationship is monotone but curved, or when a handful of outliers would otherwise dominate. If the two coefficients differ substantially, that difference is itself informative: it usually means either non-linearity or a few influential points, and you should find out which before reporting either number.
How many observations do I need for a correlation?
Far more than most analyses use. At 80% power and the conventional 5% two-sided level you need about 29 observations to detect a correlation of 0.5, 85 for 0.3, and 782 for 0.1. Correlations are commonly reported from twenty or thirty rows, where the confidence interval is so wide that the estimate carries almost no information — an observed 0.35 from n = 25 has an interval running from roughly -0.05 to 0.66.
Does r-squared tell me how much one variable explains the other?
It tells you the share of variance in one variable that is linearly associated with the other, in this sample, and it is biased upward as an estimate of the population value. It does not tell you how much of the outcome one variable causes, and it is not a share of the outcome itself. It is also a sobering number: a correlation of 0.30 corresponds to 9% of shared variance, and 0.50 to 25%.
My correlation is lower than I expected. What could be suppressing it?
Three things, all common. Measurement error in either variable attenuates the correlation toward zero, and the observable ceiling is the square root of the product of the two measures' reliabilities. Restriction of range shrinks it whenever the sample has been filtered on either variable, which happens invisibly when you analyse only active accounts or only campaigns above a spend threshold. And non-linearity means a real relationship that curves — diminishing returns, for instance — can show almost no linear correlation at all. Check all three before concluding that nothing is there.
Can I compare the correlation in one market with another?
Carefully, and usually not directly. There is a formal test — convert both to Fisher z values, take the difference and divide by the square root of the sum of 1/(n-3) terms — but the deeper issue is that r is rescaled by each sample's own standard deviations. Two markets with the same underlying relationship will report different correlations if one has more variation in the predictor. When the comparison actually matters, compare regression slopes in original units instead.
Can I correlate two weekly time series?
Not without adjustment. Both series are usually trending and seasonal, which means the observations are autocorrelated and the effective sample size is much smaller than the number of weeks. The result is a correlation that is inflated and an interval that is far too narrow — two entirely unrelated series that both grow over time will routinely correlate above 0.9. Difference or deseasonalise both series first, or use a model built for time structure. This is one of the specific problems marketing mix models are designed to handle.

Related calculators

  • Wilcoxon test

    Rank-sum (Mann-Whitney) and signed-rank tests, with the exact distribution for small samples.

  • One-proportion z-test

    Test one observed rate against a fixed target — an SLA, a benchmark, a contractual floor.

  • Proportion confidence interval

    A defensible interval around one rate — Wilson, Agresti-Coull, Jeffreys and Clopper-Pearson, side by side.

  • Log-rank test

    Compare two survival, retention or churn curves — events needed to plan, chi-square and p-value to analyse.

Terms on this page

  • Confidence interval

    The range your data can actually support, and why it answers the business question a p-value cannot.

  • Effect size

    How big the difference is — the number a p-value throws away and a business case runs on.

  • Causal inference

    Estimating what an action caused by reconstructing what would have happened without it.

  • Confounding variable

    A common cause of both variables — the reason a strong, stable correlation can mean nothing.

  • Difference-in-differences

    Subtract the untreated group's change from the treated group's — and everything rests on parallel trends.

  • Synthetic control

    Build the comparison group instead of finding one — the method for when you have one treated unit.

  • Marketing mix modelling

    One regression across every channel, built on aggregate data — no tracking, and strong assumptions.

  • Regression analysis

    Fit a line through the data — and the phrase 'holding everything else fixed' is where the trouble starts.

  • Correlation

    How tightly two variables move together — bounded, unitless, and silent about cause.

  • R-squared

    Share of variance explained — the most quoted and most over-interpreted number in any model output.

  • Multicollinearity

    When predictors move together the model cannot separate them — good predictions, meaningless coefficients.

  • Adstock

    Advertising does not stop working the week it stops running — and this is how models say so.

  • Diminishing returns

    The tenth million does less than the first — and why average ROAS is the wrong number to budget on.

  • Overfitting

    A model that memorised the noise — excellent on the data it saw, useless on the data it will meet.

Talk to the people who build these for a living

Correlations between spend and revenue are where every media analysis starts and where most of them stop. We build the model that separates the two. Marketing Mix Modeling

References

  • Fisher, R. A. (1921). On the "probable error" of a coefficient of correlation deduced from a small sample. Metron, 1, 3-32.
  • Spearman, C. (1904). The proof and measurement of association between two things. The American Journal of Psychology, 15(1), 72-101.
  • Cohen, J. (1988). Statistical Power Analysis for the Behavioral Sciences (2nd ed.). Lawrence Erlbaum Associates.